summaryrefslogtreecommitdiff
path: root/hw/usb.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-08-31 14:23:59 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-09-09 14:55:17 -0500
commita30d0fe2ca8e1f5f46dea89ef3fa47255f417316 (patch)
treeef5ebf0b2f0aebb33cfbb6a3c7b58de8092a079c /hw/usb.c
parented0d2c220932a87f8b5a85fec310aa1a92ca9cec (diff)
downloadqemu-a30d0fe2ca8e1f5f46dea89ef3fa47255f417316.tar.gz
qemu-a30d0fe2ca8e1f5f46dea89ef3fa47255f417316.tar.bz2
qemu-a30d0fe2ca8e1f5f46dea89ef3fa47255f417316.zip
qdev/usb: add usb bus support to qdev, convert drivers.
* Add USBBus. * Add USBDeviceInfo, move device callbacks here. * Add usb-qdev helper functions. * Switch drivers to qdev. TODO: * make the rest of qemu aware of usb busses and kill the FIXMEs added by this patch. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/usb.c')
-rw-r--r--hw/usb.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/hw/usb.c b/hw/usb.c
index c17266d9d3..a326bcfffe 100644
--- a/hw/usb.c
+++ b/hw/usb.c
@@ -59,8 +59,8 @@ static int do_token_setup(USBDevice *s, USBPacket *p)
index = (s->setup_buf[5] << 8) | s->setup_buf[4];
if (s->setup_buf[0] & USB_DIR_IN) {
- ret = s->handle_control(s, request, value, index,
- s->setup_len, s->data_buf);
+ ret = s->info->handle_control(s, request, value, index,
+ s->setup_len, s->data_buf);
if (ret < 0)
return ret;
@@ -83,7 +83,7 @@ static int do_token_in(USBDevice *s, USBPacket *p)
int ret = 0;
if (p->devep != 0)
- return s->handle_data(s, p);
+ return s->info->handle_data(s, p);
request = (s->setup_buf[0] << 8) | s->setup_buf[1];
value = (s->setup_buf[3] << 8) | s->setup_buf[2];
@@ -93,8 +93,8 @@ static int do_token_in(USBDevice *s, USBPacket *p)
case SETUP_STATE_ACK:
if (!(s->setup_buf[0] & USB_DIR_IN)) {
s->setup_state = SETUP_STATE_IDLE;
- ret = s->handle_control(s, request, value, index,
- s->setup_len, s->data_buf);
+ ret = s->info->handle_control(s, request, value, index,
+ s->setup_len, s->data_buf);
if (ret > 0)
return 0;
return ret;
@@ -126,7 +126,7 @@ static int do_token_in(USBDevice *s, USBPacket *p)
static int do_token_out(USBDevice *s, USBPacket *p)
{
if (p->devep != 0)
- return s->handle_data(s, p);
+ return s->info->handle_data(s, p);
switch(s->setup_state) {
case SETUP_STATE_ACK:
@@ -179,7 +179,7 @@ int usb_generic_handle_packet(USBDevice *s, USBPacket *p)
s->remote_wakeup = 0;
s->addr = 0;
s->state = USB_STATE_DEFAULT;
- s->handle_reset(s);
+ s->info->handle_reset(s);
return 0;
}
@@ -225,7 +225,7 @@ void usb_send_msg(USBDevice *dev, int msg)
USBPacket p;
memset(&p, 0, sizeof(p));
p.pid = msg;
- dev->handle_packet(dev, &p);
+ dev->info->handle_packet(dev, &p);
/* This _must_ be synchronous */
}