Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 337988 | Differences between
and this patch

Collapse All | Expand All

(-)a/hw/usb.h (+5 lines)
Lines 117-122 Link Here
117
#define USB_DT_INTERFACE		0x04
117
#define USB_DT_INTERFACE		0x04
118
#define USB_DT_ENDPOINT			0x05
118
#define USB_DT_ENDPOINT			0x05
119
119
120
#define USB_DT_DEVICE_LEN		18
121
#define USB_DT_CONFIG_LEN		9
122
#define USB_DT_INTERFACE_LEN		9
123
#define USB_DT_ENDPOINT_LEN		7
124
120
#define USB_ENDPOINT_XFER_CONTROL	0
125
#define USB_ENDPOINT_XFER_CONTROL	0
121
#define USB_ENDPOINT_XFER_ISOC		1
126
#define USB_ENDPOINT_XFER_ISOC		1
122
#define USB_ENDPOINT_XFER_BULK		2
127
#define USB_ENDPOINT_XFER_BULK		2
(-)a/usb-linux.c (-16 / +22 lines)
Lines 288-294 static void async_cancel(USBPacket *unused, void *opaque) Link Here
288
288
289
static int usb_host_claim_interfaces(USBHostDevice *dev, int configuration)
289
static int usb_host_claim_interfaces(USBHostDevice *dev, int configuration)
290
{
290
{
291
    int dev_descr_len, config_descr_len;
291
    int dev_descr_len, config_descr_total_len;
292
    int interface, nb_interfaces;
292
    int interface, nb_interfaces;
293
    int ret, i;
293
    int ret, i;
294
294
Lines 297-328 static int usb_host_claim_interfaces(USBHostDevice *dev, int configuration) Link Here
297
297
298
    DPRINTF("husb: claiming interfaces. config %d\n", configuration);
298
    DPRINTF("husb: claiming interfaces. config %d\n", configuration);
299
299
300
    i = 0;
301
    dev_descr_len = dev->descr[0];
300
    dev_descr_len = dev->descr[0];
302
    if (dev_descr_len > dev->descr_len) {
301
    if (dev_descr_len == 0x18 && dev->descr[ 8] == 0x47 && dev->descr[ 9] == 0x46
302
                              && dev->descr[10] == 0x00 && dev->descr[11] == 0x30)
303
        dev_descr_len = USB_DT_DEVICE_LEN; /* for buggy MX-950 remote reporting len in hex */
304
305
    if (dev_descr_len > dev->descr_len || dev_descr_len < USB_DT_DEVICE_LEN || dev->descr[1] != USB_DT_DEVICE) {
306
        fprintf(stderr, "husb: invalid device descriptor\n");
303
        goto fail;
307
        goto fail;
304
    }
308
    }
305
309
306
    i += dev_descr_len;
310
    for (i = dev_descr_len; i < dev->descr_len; ) {
307
    while (i < dev->descr_len) {
308
        DPRINTF("husb: i is %d, descr_len is %d, dl %d, dt %d\n",
311
        DPRINTF("husb: i is %d, descr_len is %d, dl %d, dt %d\n",
309
                i, dev->descr_len,
312
                i, dev->descr_len,
310
               dev->descr[i], dev->descr[i+1]);
313
               dev->descr[i], dev->descr[i+1]);
311
314
312
        if (dev->descr[i+1] != USB_DT_CONFIG) {
315
        if (dev->descr[i] < 2) {
313
            i += dev->descr[i];
316
            fprintf(stderr, "husb: invalid descriptor\n");
314
            continue;
317
            goto fail;
315
        }
318
        }
316
        config_descr_len = dev->descr[i];
319
        if (dev->descr[i+1] == USB_DT_CONFIG) {
320
            config_descr_total_len = dev->descr[i+2] + (dev->descr[i+3] << 8);
317
321
318
        printf("husb: config #%d need %d\n", dev->descr[i + 5], configuration);
322
            printf("husb: config #%d need %d\n", dev->descr[i + 5], configuration);
319
323
320
        if (configuration < 0 || configuration == dev->descr[i + 5]) {
324
            if (configuration < 0 || configuration == dev->descr[i + 5]) {
321
            configuration = dev->descr[i + 5];
325
                configuration = dev->descr[i + 5];
322
            break;
326
                break;
323
        }
327
            }
324
328
325
        i += config_descr_len;
329
            i += config_descr_total_len;
330
        }
331
        else
332
            i += dev->descr[i];
326
    }
333
    }
327
334
328
    if (i >= dev->descr_len) {
335
    if (i >= dev->descr_len) {
329
- 

Return to bug 337988