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