Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 325856
b: refs/heads/master
c: 8a424bf
h: refs/heads/master
v: v3
  • Loading branch information
Sebastian Andrzej Siewior authored and Greg Kroah-Hartman committed Sep 10, 2012
1 parent 602bfb8 commit 7d4e6f4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0837e7e5270bd5547ba5763f11611dc43f677b3d
refs/heads/master: 8a424bf40d772fedacc91862ecc86f10541fabb3
25 changes: 1 addition & 24 deletions trunk/tools/usb/testusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,6 @@ static int find_testdev(const char *name, const struct stat *sb, int flag)

if (flag != FTW_F)
return 0;
/* ignore /proc/bus/usb/{devices,drivers} */
if (strrchr(name, '/')[1] == 'd')
return 0;

fd = fopen(name, "rb");
if (!fd) {
Expand Down Expand Up @@ -356,28 +353,8 @@ static void *handle_testdev (void *arg)

static const char *usbfs_dir_find(void)
{
static char usbfs_path_0[] = "/dev/usb/devices";
static char usbfs_path_1[] = "/proc/bus/usb/devices";
static char udev_usb_path[] = "/dev/bus/usb";

static char *const usbfs_paths[] = {
usbfs_path_0, usbfs_path_1
};

static char *const *
end = usbfs_paths + sizeof usbfs_paths / sizeof *usbfs_paths;

char *const *it = usbfs_paths;
do {
int fd = open(*it, O_RDONLY);
close(fd);
if (fd >= 0) {
strrchr(*it, '/')[0] = '\0';
return *it;
}
} while (++it != end);

/* real device-nodes managed by udev */
if (access(udev_usb_path, F_OK) == 0)
return udev_usb_path;

Expand Down Expand Up @@ -489,7 +466,7 @@ int main (int argc, char **argv)
goto usage;
if (!all && !device) {
fprintf (stderr, "must specify '-a' or '-D dev', "
"or DEVICE=/proc/bus/usb/BBB/DDD in env\n");
"or DEVICE=/dev/bus/usb/BBB/DDD in env\n");
goto usage;
}

Expand Down

0 comments on commit 7d4e6f4

Please sign in to comment.