|
@@ -1276,27 +1276,31 @@ static int usb_host_scan(void *opaque, USBScanFunc *func)
|
|
usb_fs_type = USB_FS_PROC;
|
|
usb_fs_type = USB_FS_PROC;
|
|
fclose(f);
|
|
fclose(f);
|
|
dprintf(opened, USBPROCBUS_PATH, devices);
|
|
dprintf(opened, USBPROCBUS_PATH, devices);
|
|
|
|
+ goto found_devices;
|
|
}
|
|
}
|
|
/* try additional methods if an access method hasn't been found yet */
|
|
/* try additional methods if an access method hasn't been found yet */
|
|
f = fopen(USBDEVBUS_PATH "/devices", "r");
|
|
f = fopen(USBDEVBUS_PATH "/devices", "r");
|
|
- if (!usb_fs_type && f) {
|
|
|
|
|
|
+ if (f) {
|
|
/* devices found in /dev/bus/usb/ */
|
|
/* devices found in /dev/bus/usb/ */
|
|
strcpy(devpath, USBDEVBUS_PATH);
|
|
strcpy(devpath, USBDEVBUS_PATH);
|
|
usb_fs_type = USB_FS_DEV;
|
|
usb_fs_type = USB_FS_DEV;
|
|
fclose(f);
|
|
fclose(f);
|
|
dprintf(opened, USBDEVBUS_PATH, devices);
|
|
dprintf(opened, USBDEVBUS_PATH, devices);
|
|
|
|
+ goto found_devices;
|
|
}
|
|
}
|
|
dir = opendir(USBSYSBUS_PATH "/devices");
|
|
dir = opendir(USBSYSBUS_PATH "/devices");
|
|
- if (!usb_fs_type && dir) {
|
|
|
|
|
|
+ if (dir) {
|
|
/* devices found in /dev/bus/usb/ (yes - not a mistake!) */
|
|
/* devices found in /dev/bus/usb/ (yes - not a mistake!) */
|
|
strcpy(devpath, USBDEVBUS_PATH);
|
|
strcpy(devpath, USBDEVBUS_PATH);
|
|
usb_fs_type = USB_FS_SYS;
|
|
usb_fs_type = USB_FS_SYS;
|
|
closedir(dir);
|
|
closedir(dir);
|
|
dprintf(opened, USBSYSBUS_PATH, devices);
|
|
dprintf(opened, USBSYSBUS_PATH, devices);
|
|
|
|
+ goto found_devices;
|
|
}
|
|
}
|
|
|
|
+ found_devices:
|
|
if (!usb_fs_type) {
|
|
if (!usb_fs_type) {
|
|
term_printf("husb: unable to access USB devices\n");
|
|
term_printf("husb: unable to access USB devices\n");
|
|
- goto the_end;
|
|
|
|
|
|
+ return -ENOENT;
|
|
}
|
|
}
|
|
|
|
|
|
/* the module setting (used later for opening devices) */
|
|
/* the module setting (used later for opening devices) */
|
|
@@ -1307,7 +1311,7 @@ static int usb_host_scan(void *opaque, USBScanFunc *func)
|
|
} else {
|
|
} else {
|
|
/* out of memory? */
|
|
/* out of memory? */
|
|
perror("husb: unable to allocate memory for device path");
|
|
perror("husb: unable to allocate memory for device path");
|
|
- goto the_end;
|
|
|
|
|
|
+ return -ENOMEM;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1319,8 +1323,10 @@ static int usb_host_scan(void *opaque, USBScanFunc *func)
|
|
case USB_FS_SYS:
|
|
case USB_FS_SYS:
|
|
ret = usb_host_scan_sys(opaque, func);
|
|
ret = usb_host_scan_sys(opaque, func);
|
|
break;
|
|
break;
|
|
|
|
+ default:
|
|
|
|
+ ret = -EINVAL;
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
- the_end:
|
|
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|