mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-17 21:26:13 -07:00
USB user interface
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1603 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
8738a8d079
commit
a594cfbf3e
9 changed files with 458 additions and 135 deletions
15
hw/usb.c
15
hw/usb.c
|
|
@ -201,7 +201,6 @@ int set_usb_string(uint8_t *buf, const char *str)
|
|||
|
||||
typedef struct USBHubPort {
|
||||
USBPort port;
|
||||
USBDevice *dev;
|
||||
uint16_t wPortStatus;
|
||||
uint16_t wPortChange;
|
||||
} USBHubPort;
|
||||
|
|
@ -342,7 +341,7 @@ static void usb_hub_attach(USBPort *port1, USBDevice *dev)
|
|||
USBHubPort *port = &s->ports[port1->index];
|
||||
|
||||
if (dev) {
|
||||
if (port->dev)
|
||||
if (port->port.dev)
|
||||
usb_attach(port1, NULL);
|
||||
|
||||
port->wPortStatus |= PORT_STAT_CONNECTION;
|
||||
|
|
@ -351,9 +350,9 @@ static void usb_hub_attach(USBPort *port1, USBDevice *dev)
|
|||
port->wPortStatus |= PORT_STAT_LOW_SPEED;
|
||||
else
|
||||
port->wPortStatus &= ~PORT_STAT_LOW_SPEED;
|
||||
port->dev = dev;
|
||||
port->port.dev = dev;
|
||||
} else {
|
||||
dev = port->dev;
|
||||
dev = port->port.dev;
|
||||
if (dev) {
|
||||
port->wPortStatus &= ~PORT_STAT_CONNECTION;
|
||||
port->wPortChange |= PORT_STAT_C_CONNECTION;
|
||||
|
|
@ -361,7 +360,7 @@ static void usb_hub_attach(USBPort *port1, USBDevice *dev)
|
|||
port->wPortStatus &= ~PORT_STAT_ENABLE;
|
||||
port->wPortChange |= PORT_STAT_C_ENABLE;
|
||||
}
|
||||
port->dev = NULL;
|
||||
port->port.dev = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -498,7 +497,7 @@ static int usb_hub_handle_control(USBDevice *dev, int request, int value,
|
|||
if (n >= s->nb_ports)
|
||||
goto fail;
|
||||
port = &s->ports[n];
|
||||
dev = port->dev;
|
||||
dev = port->port.dev;
|
||||
switch(value) {
|
||||
case PORT_SUSPEND:
|
||||
port->wPortStatus |= PORT_STAT_SUSPEND;
|
||||
|
|
@ -529,7 +528,7 @@ static int usb_hub_handle_control(USBDevice *dev, int request, int value,
|
|||
if (n >= s->nb_ports)
|
||||
goto fail;
|
||||
port = &s->ports[n];
|
||||
dev = port->dev;
|
||||
dev = port->port.dev;
|
||||
switch(value) {
|
||||
case PORT_ENABLE:
|
||||
port->wPortStatus &= ~PORT_STAT_ENABLE;
|
||||
|
|
@ -624,7 +623,7 @@ static int usb_hub_broadcast_packet(USBHubState *s, int pid,
|
|||
|
||||
for(i = 0; i < s->nb_ports; i++) {
|
||||
port = &s->ports[i];
|
||||
dev = port->dev;
|
||||
dev = port->port.dev;
|
||||
if (dev && (port->wPortStatus & PORT_STAT_ENABLE)) {
|
||||
ret = dev->handle_packet(dev, pid,
|
||||
devaddr, devep,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue