Changeset 1898
- Timestamp:
- 05/03/07 04:46:03 (6 years ago)
- Location:
- trunk/src/host/qemu-neo1973
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/host/qemu-neo1973/usb-linux-gadget.c
r1864 r1898 362 362 goto fail; 363 363 cfg = (struct usb_config_descriptor *) src; 364 if (packet->len < cfg->wTotalLength) 365 goto fail; 364 366 if (dl + cfg->wTotalLength > sizeof(buffer)) 365 367 goto fail; … … 377 379 goto fail; 378 380 memcpy(dst, hci->dev_desc, hci->desc_len); 381 /* HACK: report always only a single Configuration */ 382 ((struct usb_device_descriptor *) dst)->bNumConfigurations = 1; 379 383 dl += hci->desc_len; 380 384 dst += hci->desc_len; … … 492 496 int ret, len; 493 497 494 if (!s-> addr)498 if (!s->connected) 495 499 return; 496 500 … … 498 502 if (ret < 0 && errno != EAGAIN) 499 503 fprintf(stderr, "%s: event error: %i\n", __FUNCTION__, errno); 500 if (ret < sizeof(event))504 if (ret < (int) sizeof(event)) 501 505 return; 502 506 … … 713 717 atexit(gadget_done); 714 718 719 hci->addr = 0; 720 715 721 qemu_register_usb_port(&hci->port, hci, USB_INDEX_HOST, gadget_attach); 716 722 -
trunk/src/host/qemu-neo1973/vl.c
r1825 r1898 3956 3956 static USBPort *used_usb_ports; 3957 3957 static USBPort *free_usb_ports; 3958 static USBPort *host_usb_ports; 3959 static USBDevice *usb_gadget; 3958 3960 3959 3961 /* ??? Maybe change this to register a hub to keep track of the topology. */ … … 3964 3966 port->index = index; 3965 3967 port->attach = attach; 3966 port->next = free_usb_ports; 3967 free_usb_ports = port; 3968 if (index == USB_INDEX_HOST) { 3969 port->next = host_usb_ports; 3970 host_usb_ports = port; 3971 } else { 3972 port->next = free_usb_ports; 3973 free_usb_ports = port; 3974 } 3975 } 3976 3977 void qemu_register_usb_gadget(USBDevice *device) 3978 { 3979 usb_gadget = device; 3968 3980 } 3969 3981 … … 3990 4002 return -1; 3991 4003 dev = usb_net_init(&nd_table[nr]); 4004 } else if (!strcmp(devname, "gadget")) { 4005 dev = usb_gadget; 4006 port = host_usb_ports; 4007 if (!dev || !port) 4008 return -1; 4009 goto attach; 3992 4010 } else { 3993 return -1;4011 return 0; 3994 4012 } 3995 4013 if (!dev) … … 4014 4032 port->next = used_usb_ports; 4015 4033 used_usb_ports = port; 4034 attach: 4016 4035 usb_attach(port, dev); 4017 4036 return 0; … … 4025 4044 int bus_num, addr; 4026 4045 const char *p; 4046 4047 if (!strcmp(devname, "gadget")) { 4048 port = host_usb_ports; 4049 if (!port) 4050 return -1; 4051 usb_attach(port, NULL); 4052 return 0; 4053 } 4027 4054 4028 4055 if (!used_usb_ports) -
trunk/src/host/qemu-neo1973/vl.h
r1667 r1898 1230 1230 /* usb ports of the VM */ 1231 1231 1232 #define USB_INDEX_HOST -1 1232 1233 void qemu_register_usb_port(USBPort *port, void *opaque, int index, 1233 1234 usb_attachfn attach); 1235 void qemu_register_usb_gadget(USBDevice *device); 1234 1236 1235 1237 #define VM_USB_HUB_SIZE 8 … … 1458 1460 #include "hw/i2c.h" 1459 1461 1462 #define unlikely(cond) __builtin_expect(cond, 0) 1463 1460 1464 #ifdef TARGET_ARM 1461 1465 #include "hw/pxa.h"
Note: See TracChangeset
for help on using the changeset viewer.
