Commit f6fe916ed0a383ae89b041200dae271579c053b3
Committed by
Greg Kroah-Hartman
1 parent
1996e6c572
Exists in
master
and in
20 other branches
USB: testusb: add path /dev/bus/usb to default search paths for usbfs
As real device-nodes managed by udev whose nodes lived in /dev/bus/usb are mostly used today, let testusb tool use that directory as one default path make tool be more convenient to use. Signed-off-by: Du Changbin <changbinx.du@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 5 additions and 0 deletions Side-by-side Diff
tools/usb/testusb.c
... | ... | @@ -358,6 +358,7 @@ |
358 | 358 | { |
359 | 359 | static char usbfs_path_0[] = "/dev/usb/devices"; |
360 | 360 | static char usbfs_path_1[] = "/proc/bus/usb/devices"; |
361 | + static char udev_usb_path[] = "/dev/bus/usb"; | |
361 | 362 | |
362 | 363 | static char *const usbfs_paths[] = { |
363 | 364 | usbfs_path_0, usbfs_path_1 |
... | ... | @@ -375,6 +376,10 @@ |
375 | 376 | return *it; |
376 | 377 | } |
377 | 378 | } while (++it != end); |
379 | + | |
380 | + /* real device-nodes managed by udev */ | |
381 | + if (access(udev_usb_path, F_OK) == 0) | |
382 | + return udev_usb_path; | |
378 | 383 | |
379 | 384 | return NULL; |
380 | 385 | } |