ret = ioctl(s->fd, USBDEVFS_CONTROL, &ct);
if (ret < 0) {
- perror("usb_linux_update_endp_table");
- return 1;
+ alt_interface = interface;
}
/* the current interface descriptor is the active interface
*/
static int usb_host_scan_dev(void *opaque, USBScanFunc *func)
{
- FILE *f = 0;
+ FILE *f = NULL;
char line[1024];
char buf[1024];
int bus_num, addr, speed, device_count, class_id, product_id, vendor_id;
*/
static int usb_host_scan_sys(void *opaque, USBScanFunc *func)
{
- DIR *dir = 0;
+ DIR *dir = NULL;
char line[1024];
int bus_num, addr, speed, class_id, product_id, vendor_id;
int ret = 0;
static int usb_host_scan(void *opaque, USBScanFunc *func)
{
Monitor *mon = cur_mon;
- FILE *f = 0;
- DIR *dir = 0;
+ FILE *f = NULL;
+ DIR *dir = NULL;
int ret = 0;
const char *fs_type[] = {"unknown", "proc", "dev", "sys"};
char devpath[PATH_MAX];
/* only check the host once */
if (!usb_fs_type) {
+ dir = opendir(USBSYSBUS_PATH "/devices");
+ if (dir) {
+ /* devices found in /dev/bus/usb/ (yes - not a mistake!) */
+ strcpy(devpath, USBDEVBUS_PATH);
+ usb_fs_type = USB_FS_SYS;
+ closedir(dir);
+ dprintf(USBDBG_DEVOPENED, USBSYSBUS_PATH);
+ goto found_devices;
+ }
f = fopen(USBPROCBUS_PATH "/devices", "r");
if (f) {
/* devices found in /proc/bus/usb/ */
dprintf(USBDBG_DEVOPENED, USBDEVBUS_PATH);
goto found_devices;
}
- dir = opendir(USBSYSBUS_PATH "/devices");
- if (dir) {
- /* devices found in /dev/bus/usb/ (yes - not a mistake!) */
- strcpy(devpath, USBDEVBUS_PATH);
- usb_fs_type = USB_FS_SYS;
- closedir(dir);
- dprintf(USBDBG_DEVOPENED, USBSYSBUS_PATH);
- goto found_devices;
- }
found_devices:
if (!usb_fs_type) {
monitor_printf(mon, "husb: unable to access USB devices\n");