diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/usb/testusb.c | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/tools/usb/testusb.c b/tools/usb/testusb.c index b0adb2710c02..68d0734b2081 100644 --- a/tools/usb/testusb.c +++ b/tools/usb/testusb.c | |||
@@ -253,9 +253,6 @@ static int find_testdev(const char *name, const struct stat *sb, int flag) | |||
253 | 253 | ||
254 | if (flag != FTW_F) | 254 | if (flag != FTW_F) |
255 | return 0; | 255 | return 0; |
256 | /* ignore /proc/bus/usb/{devices,drivers} */ | ||
257 | if (strrchr(name, '/')[1] == 'd') | ||
258 | return 0; | ||
259 | 256 | ||
260 | fd = fopen(name, "rb"); | 257 | fd = fopen(name, "rb"); |
261 | if (!fd) { | 258 | if (!fd) { |
@@ -356,28 +353,8 @@ restart: | |||
356 | 353 | ||
357 | static const char *usbfs_dir_find(void) | 354 | static const char *usbfs_dir_find(void) |
358 | { | 355 | { |
359 | static char usbfs_path_0[] = "/dev/usb/devices"; | ||
360 | static char usbfs_path_1[] = "/proc/bus/usb/devices"; | ||
361 | static char udev_usb_path[] = "/dev/bus/usb"; | 356 | static char udev_usb_path[] = "/dev/bus/usb"; |
362 | 357 | ||
363 | static char *const usbfs_paths[] = { | ||
364 | usbfs_path_0, usbfs_path_1 | ||
365 | }; | ||
366 | |||
367 | static char *const * | ||
368 | end = usbfs_paths + sizeof usbfs_paths / sizeof *usbfs_paths; | ||
369 | |||
370 | char *const *it = usbfs_paths; | ||
371 | do { | ||
372 | int fd = open(*it, O_RDONLY); | ||
373 | close(fd); | ||
374 | if (fd >= 0) { | ||
375 | strrchr(*it, '/')[0] = '\0'; | ||
376 | return *it; | ||
377 | } | ||
378 | } while (++it != end); | ||
379 | |||
380 | /* real device-nodes managed by udev */ | ||
381 | if (access(udev_usb_path, F_OK) == 0) | 358 | if (access(udev_usb_path, F_OK) == 0) |
382 | return udev_usb_path; | 359 | return udev_usb_path; |
383 | 360 | ||
@@ -489,7 +466,7 @@ usage: | |||
489 | goto usage; | 466 | goto usage; |
490 | if (!all && !device) { | 467 | if (!all && !device) { |
491 | fprintf (stderr, "must specify '-a' or '-D dev', " | 468 | fprintf (stderr, "must specify '-a' or '-D dev', " |
492 | "or DEVICE=/proc/bus/usb/BBB/DDD in env\n"); | 469 | "or DEVICE=/dev/bus/usb/BBB/DDD in env\n"); |
493 | goto usage; | 470 | goto usage; |
494 | } | 471 | } |
495 | 472 | ||