Skip to content

Commit 8a424bf

Browse files
Sebastian Andrzej Siewiorgregkh
authored andcommitted
tools/usb: remove last USBFS user
In commit fb28d58 ("USB: remove CONFIG_USB_DEVICEFS") USBFS got removed. Since it is gone we can stop using it in testusb and try udev nodes right away. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0837e7e commit 8a424bf

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

tools/usb/testusb.c

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,6 @@ static int find_testdev(const char *name, const struct stat *sb, int flag)
253253

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

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

357354
static const char *usbfs_dir_find(void)
358355
{
359-
static char usbfs_path_0[] = "/dev/usb/devices";
360-
static char usbfs_path_1[] = "/proc/bus/usb/devices";
361356
static char udev_usb_path[] = "/dev/bus/usb";
362357

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 */
381358
if (access(udev_usb_path, F_OK) == 0)
382359
return udev_usb_path;
383360

@@ -489,7 +466,7 @@ int main (int argc, char **argv)
489466
goto usage;
490467
if (!all && !device) {
491468
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");
493470
goto usage;
494471
}
495472

0 commit comments

Comments
 (0)