Revision 0f5160d1 usb-linux.c

b/usb-linux.c
62 62
    uint16_t wLength;
63 63
};
64 64

  
65
typedef int USBScanFunc(void *opaque, int bus_num, int addr, int class_id,
66
                        int vendor_id, int product_id,
65
typedef int USBScanFunc(void *opaque, int bus_num, int addr, int devpath,
66
                        int class_id, int vendor_id, int product_id,
67 67
                        const char *product_name, int speed);
68 68

  
69 69
//#define DEBUG
......
141 141
    /* Host side address */
142 142
    int bus_num;
143 143
    int addr;
144
    int devpath;
144 145
    struct USBAutoFilter match;
145 146

  
146 147
    QTAILQ_ENTRY(USBHostDevice) next;
......
885 886
}
886 887

  
887 888
static int usb_host_open(USBHostDevice *dev, int bus_num,
888
                         int addr, const char *prod_name)
889
                         int addr, int devpath, const char *prod_name)
889 890
{
890 891
    int fd = -1, ret;
891 892
    struct usbdevfs_connectinfo ci;
......
911 912

  
912 913
    dev->bus_num = bus_num;
913 914
    dev->addr = addr;
915
    dev->devpath = devpath;
914 916
    dev->fd = fd;
915 917

  
916 918
    /* read the device description */
......
1173 1175
        if (line[0] == 'T' && line[1] == ':') {
1174 1176
            if (device_count && (vendor_id || product_id)) {
1175 1177
                /* New device.  Add the previously discovered device.  */
1176
                ret = func(opaque, bus_num, addr, class_id, vendor_id,
1178
                ret = func(opaque, bus_num, addr, 0, class_id, vendor_id,
1177 1179
                           product_id, product_name, speed);
1178 1180
                if (ret) {
1179 1181
                    goto the_end;
......
1226 1228
    }
1227 1229
    if (device_count && (vendor_id || product_id)) {
1228 1230
        /* Add the last device.  */
1229
        ret = func(opaque, bus_num, addr, class_id, vendor_id,
1231
        ret = func(opaque, bus_num, addr, 0, class_id, vendor_id,
1230 1232
                   product_id, product_name, speed);
1231 1233
    }
1232 1234
 the_end:
......
1275 1277
{
1276 1278
    DIR *dir = NULL;
1277 1279
    char line[1024];
1278
    int bus_num, addr, speed, class_id, product_id, vendor_id;
1280
    int bus_num, addr, devpath, speed, class_id, product_id, vendor_id;
1279 1281
    int ret = 0;
1280 1282
    char product_name[512];
1281 1283
    struct dirent *de;
......
1292 1294
            if (!strncmp(de->d_name, "usb", 3)) {
1293 1295
                tmpstr += 3;
1294 1296
            }
1295
            bus_num = atoi(tmpstr);
1297
            if (sscanf(tmpstr, "%d-%d", &bus_num, &devpath) < 1) {
1298
                goto the_end;
1299
            }
1296 1300

  
1297 1301
            if (!usb_host_read_file(line, sizeof(line), "devnum", de->d_name)) {
1298 1302
                goto the_end;
......
1343 1347
                speed = USB_SPEED_FULL;
1344 1348
            }
1345 1349

  
1346
            ret = func(opaque, bus_num, addr, class_id, vendor_id,
1350
            ret = func(opaque, bus_num, addr, devpath, class_id, vendor_id,
1347 1351
                       product_id, product_name, speed);
1348 1352
            if (ret) {
1349 1353
                goto the_end;
......
1434 1438

  
1435 1439
static QEMUTimer *usb_auto_timer;
1436 1440

  
1437
static int usb_host_auto_scan(void *opaque, int bus_num, int addr,
1441
static int usb_host_auto_scan(void *opaque, int bus_num, int addr, int devpath,
1438 1442
                              int class_id, int vendor_id, int product_id,
1439 1443
                              const char *product_name, int speed)
1440 1444
{
......
1470 1474
        }
1471 1475
        DPRINTF("husb: auto open: bus_num %d addr %d\n", bus_num, addr);
1472 1476

  
1473
        usb_host_open(s, bus_num, addr, product_name);
1477
        usb_host_open(s, bus_num, addr, devpath, product_name);
1474 1478
    }
1475 1479

  
1476 1480
    return 0;
......
1630 1634
}
1631 1635

  
1632 1636
static int usb_host_info_device(void *opaque, int bus_num, int addr,
1633
                                int class_id,
1637
                                int devpath, int class_id,
1634 1638
                                int vendor_id, int product_id,
1635 1639
                                const char *product_name,
1636 1640
                                int speed)

Also available in: Unified diff