/* the syntax is : 'bus.addr' (decimal numbers) or 'vendor_id:product_id' (hexa numbers) */ static int usb_host_find_device(int *pbus_num, int *paddr, const char *devname, struct usb_device **device) { const char *p; int ret; FindDeviceState fs; p = strchr(devname, '.'); if (p) { fs.vendor_id = -1; fs.product_id = -1; fs.bus_num = strtoul(devname, NULL, 0); fs.addr = strtoul(p + 1, NULL, 0); ret = usb_host_scan(&fs, device, usb_host_find_device_scan); if (ret) { *pbus_num = fs.bus_num; *paddr = fs.addr; return 0; } } p = strchr(devname, ':'); if (p) { fs.vendor_id = strtoul(devname, NULL, 16); fs.product_id = strtoul(p + 1, NULL, 16); ret = usb_host_scan(&fs, device, usb_host_find_device_scan); if (ret) { *pbus_num = fs.bus_num; *paddr = fs.addr; return 0; } } return -1; }
static void usb_host_auto_timer(void *unused) { usb_host_scan(NULL, usb_host_auto_scan); qemu_mod_timer(usb_auto_timer, qemu_get_clock(rt_clock) + 2000); }