dev-hub.c (8c43a6f05d5ef3c9484bd2be9d4e818d58e62016) | dev-hub.c (8550a02d1239415342959f6a32d178bc05c557cc) |
---|---|
1/* 2 * QEMU USB HUB emulation 3 * 4 * Copyright (c) 2005 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 150 unchanged lines hidden (view full) --- 159 trace_usb_hub_attach(s->dev.addr, port1->index + 1); 160 port->wPortStatus |= PORT_STAT_CONNECTION; 161 port->wPortChange |= PORT_STAT_C_CONNECTION; 162 if (port->port.dev->speed == USB_SPEED_LOW) { 163 port->wPortStatus |= PORT_STAT_LOW_SPEED; 164 } else { 165 port->wPortStatus &= ~PORT_STAT_LOW_SPEED; 166 } | 1/* 2 * QEMU USB HUB emulation 3 * 4 * Copyright (c) 2005 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 150 unchanged lines hidden (view full) --- 159 trace_usb_hub_attach(s->dev.addr, port1->index + 1); 160 port->wPortStatus |= PORT_STAT_CONNECTION; 161 port->wPortChange |= PORT_STAT_C_CONNECTION; 162 if (port->port.dev->speed == USB_SPEED_LOW) { 163 port->wPortStatus |= PORT_STAT_LOW_SPEED; 164 } else { 165 port->wPortStatus &= ~PORT_STAT_LOW_SPEED; 166 } |
167 usb_wakeup(s->intr); | 167 usb_wakeup(s->intr, 0); |
168} 169 170static void usb_hub_detach(USBPort *port1) 171{ 172 USBHubState *s = port1->opaque; 173 USBHubPort *port = &s->ports[port1->index]; 174 175 trace_usb_hub_detach(s->dev.addr, port1->index + 1); | 168} 169 170static void usb_hub_detach(USBPort *port1) 171{ 172 USBHubState *s = port1->opaque; 173 USBHubPort *port = &s->ports[port1->index]; 174 175 trace_usb_hub_detach(s->dev.addr, port1->index + 1); |
176 usb_wakeup(s->intr); | 176 usb_wakeup(s->intr, 0); |
177 178 /* Let upstream know the device on this port is gone */ 179 s->dev.port->ops->child_detach(s->dev.port, port1->dev); 180 181 port->wPortStatus &= ~PORT_STAT_CONNECTION; 182 port->wPortChange |= PORT_STAT_C_CONNECTION; 183 if (port->wPortStatus & PORT_STAT_ENABLE) { 184 port->wPortStatus &= ~PORT_STAT_ENABLE; 185 port->wPortChange |= PORT_STAT_C_ENABLE; 186 } | 177 178 /* Let upstream know the device on this port is gone */ 179 s->dev.port->ops->child_detach(s->dev.port, port1->dev); 180 181 port->wPortStatus &= ~PORT_STAT_CONNECTION; 182 port->wPortChange |= PORT_STAT_C_CONNECTION; 183 if (port->wPortStatus & PORT_STAT_ENABLE) { 184 port->wPortStatus &= ~PORT_STAT_ENABLE; 185 port->wPortChange |= PORT_STAT_C_ENABLE; 186 } |
187 usb_wakeup(s->intr); | 187 usb_wakeup(s->intr, 0); |
188} 189 190static void usb_hub_child_detach(USBPort *port1, USBDevice *child) 191{ 192 USBHubState *s = port1->opaque; 193 194 /* Pass along upstream */ 195 s->dev.port->ops->child_detach(s->dev.port, child); 196} 197 198static void usb_hub_wakeup(USBPort *port1) 199{ 200 USBHubState *s = port1->opaque; 201 USBHubPort *port = &s->ports[port1->index]; 202 203 if (port->wPortStatus & PORT_STAT_SUSPEND) { 204 port->wPortChange |= PORT_STAT_C_SUSPEND; | 188} 189 190static void usb_hub_child_detach(USBPort *port1, USBDevice *child) 191{ 192 USBHubState *s = port1->opaque; 193 194 /* Pass along upstream */ 195 s->dev.port->ops->child_detach(s->dev.port, child); 196} 197 198static void usb_hub_wakeup(USBPort *port1) 199{ 200 USBHubState *s = port1->opaque; 201 USBHubPort *port = &s->ports[port1->index]; 202 203 if (port->wPortStatus & PORT_STAT_SUSPEND) { 204 port->wPortChange |= PORT_STAT_C_SUSPEND; |
205 usb_wakeup(s->intr); | 205 usb_wakeup(s->intr, 0); |
206 } 207} 208 209static void usb_hub_complete(USBPort *port, USBPacket *packet) 210{ 211 USBHubState *s = port->opaque; 212 213 /* --- 145 unchanged lines hidden (view full) --- 359 port->wPortStatus |= PORT_STAT_SUSPEND; 360 break; 361 case PORT_RESET: 362 if (dev && dev->attached) { 363 usb_device_reset(dev); 364 port->wPortChange |= PORT_STAT_C_RESET; 365 /* set enable bit */ 366 port->wPortStatus |= PORT_STAT_ENABLE; | 206 } 207} 208 209static void usb_hub_complete(USBPort *port, USBPacket *packet) 210{ 211 USBHubState *s = port->opaque; 212 213 /* --- 145 unchanged lines hidden (view full) --- 359 port->wPortStatus |= PORT_STAT_SUSPEND; 360 break; 361 case PORT_RESET: 362 if (dev && dev->attached) { 363 usb_device_reset(dev); 364 port->wPortChange |= PORT_STAT_C_RESET; 365 /* set enable bit */ 366 port->wPortStatus |= PORT_STAT_ENABLE; |
367 usb_wakeup(s->intr); | 367 usb_wakeup(s->intr, 0); |
368 } 369 break; 370 case PORT_POWER: 371 break; 372 default: 373 goto fail; 374 } 375 } --- 208 unchanged lines hidden --- | 368 } 369 break; 370 case PORT_POWER: 371 break; 372 default: 373 goto fail; 374 } 375 } --- 208 unchanged lines hidden --- |