Revision 7f74a56b hw/usb.c
b/hw/usb.c | ||
---|---|---|
227 | 227 |
* |
228 | 228 |
* Returns length of the transaction or one of the USB_RET_XXX codes. |
229 | 229 |
*/ |
230 |
int usb_generic_handle_packet(USBDevice *s, USBPacket *p) |
|
230 |
static int usb_generic_handle_packet(USBDevice *s, USBPacket *p)
|
|
231 | 231 |
{ |
232 | 232 |
/* Rest of the PIDs must match our address */ |
233 | 233 |
if (s->state < USB_STATE_DEFAULT || p->devaddr != s->addr) |
... | ... | |
318 | 318 |
if (dev == NULL) { |
319 | 319 |
return USB_RET_NODEV; |
320 | 320 |
} |
321 |
assert(dev->addr == p->devaddr); |
|
321 | 322 |
|
322 | 323 |
assert(p->owner == NULL); |
323 |
ret = usb_device_handle_packet(dev, p);
|
|
324 |
ret = usb_generic_handle_packet(dev, p);
|
|
324 | 325 |
if (ret == USB_RET_ASYNC) { |
325 |
if (p->owner == NULL) { |
|
326 |
p->owner = usb_ep_get(dev, p->pid, p->devep); |
|
327 |
} else { |
|
328 |
/* We'll end up here when usb_handle_packet is called |
|
329 |
* recursively due to a hub being in the chain. Nothing |
|
330 |
* to do. Leave p->owner pointing to the device, not the |
|
331 |
* hub. */; |
|
332 |
} |
|
326 |
p->owner = usb_ep_get(dev, p->pid, p->devep); |
|
333 | 327 |
} |
334 | 328 |
return ret; |
335 | 329 |
} |
... | ... | |
339 | 333 |
handle_packet. */ |
340 | 334 |
void usb_packet_complete(USBDevice *dev, USBPacket *p) |
341 | 335 |
{ |
342 |
/* Note: p->owner != dev is possible in case dev is a hub */ |
|
343 | 336 |
assert(p->owner != NULL); |
344 | 337 |
p->owner = NULL; |
345 | 338 |
dev->port->ops->complete(dev->port, p); |
Also available in: Unified diff