Revision a594cfbf hw/usb.c

b/hw/usb.c
201 201

  
202 202
typedef struct USBHubPort {
203 203
    USBPort port;
204
    USBDevice *dev;
205 204
    uint16_t wPortStatus;
206 205
    uint16_t wPortChange;
207 206
} USBHubPort;
......
342 341
    USBHubPort *port = &s->ports[port1->index];
343 342
    
344 343
    if (dev) {
345
        if (port->dev)
344
        if (port->port.dev)
346 345
            usb_attach(port1, NULL);
347 346
        
348 347
        port->wPortStatus |= PORT_STAT_CONNECTION;
......
351 350
            port->wPortStatus |= PORT_STAT_LOW_SPEED;
352 351
        else
353 352
            port->wPortStatus &= ~PORT_STAT_LOW_SPEED;
354
        port->dev = dev;
353
        port->port.dev = dev;
355 354
    } else {
356
        dev = port->dev;
355
        dev = port->port.dev;
357 356
        if (dev) {
358 357
            port->wPortStatus &= ~PORT_STAT_CONNECTION;
359 358
            port->wPortChange |= PORT_STAT_C_CONNECTION;
......
361 360
                port->wPortStatus &= ~PORT_STAT_ENABLE;
362 361
                port->wPortChange |= PORT_STAT_C_ENABLE;
363 362
            }
364
            port->dev = NULL;
363
            port->port.dev = NULL;
365 364
        }
366 365
    }
367 366
}
......
498 497
            if (n >= s->nb_ports)
499 498
                goto fail;
500 499
            port = &s->ports[n];
501
            dev = port->dev;
500
            dev = port->port.dev;
502 501
            switch(value) {
503 502
            case PORT_SUSPEND:
504 503
                port->wPortStatus |= PORT_STAT_SUSPEND;
......
529 528
            if (n >= s->nb_ports)
530 529
                goto fail;
531 530
            port = &s->ports[n];
532
            dev = port->dev;
531
            dev = port->port.dev;
533 532
            switch(value) {
534 533
            case PORT_ENABLE:
535 534
                port->wPortStatus &= ~PORT_STAT_ENABLE;
......
624 623

  
625 624
    for(i = 0; i < s->nb_ports; i++) {
626 625
        port = &s->ports[i];
627
        dev = port->dev;
626
        dev = port->port.dev;
628 627
        if (dev && (port->wPortStatus & PORT_STAT_ENABLE)) {
629 628
            ret = dev->handle_packet(dev, pid, 
630 629
                                     devaddr, devep,

Also available in: Unified diff