diff --git a/dongle.c b/dongle.c index a05684b5924b8e154997b2c27c0a382b743402aa..beb4405b524cf100c38f8fdc9ed17725b95ef794 100644 --- a/dongle.c +++ b/dongle.c @@ -395,7 +395,7 @@ int get_devices_from_path(char *input_path) struct stat st; struct device *dev; int rv; - + printf("initial input_path %s\n", input_path); //strncpy(usb_path, "/sys/bus/usb/devices/", PATH_MAX); dir = opendir(input_path); if (!dir) { @@ -408,14 +408,15 @@ int get_devices_from_path(char *input_path) continue; if (strstr(de->d_name, ":") || strstr(de->d_name, "usb")) continue; - snprintf(product_path, PATH_MAX, "%s%s/product", input_path, de->d_name); + snprintf(product_path, PATH_MAX, "%s/product", input_path); + printf("stat path %s\n", product_path); memset(&st, 0, sizeof(st)); rv = stat(product_path, &st); if (rv < 0) { //perror("stat"); continue; } - snprintf(path, PATH_MAX, "%s%s/", input_path, de->d_name); + snprintf(path, PATH_MAX, "%s/", input_path); name = get_device_name(path); if (!name) continue; @@ -432,6 +433,7 @@ int get_devices_from_path(char *input_path) dev->ip = get_device_ip(dev->usb.if_name); add_device(dev); + break; } closedir(dir); return 0;