r1825 - in trunk/src/host/qemu-neo1973: . hw
andrew at sita.openmoko.org
andrew at sita.openmoko.org
Tue Apr 24 21:52:47 CEST 2007
Author: andrew
Date: 2007-04-24 21:52:45 +0200 (Tue, 24 Apr 2007)
New Revision: 1825
Modified:
trunk/src/host/qemu-neo1973/Makefile.target
trunk/src/host/qemu-neo1973/hw/usb-net.c
trunk/src/host/qemu-neo1973/hw/usb.h
trunk/src/host/qemu-neo1973/vl.c
Log:
Initial Linux gadgetfs support. Fix usb-net USB config descriptors.
Modified: trunk/src/host/qemu-neo1973/Makefile.target
===================================================================
--- trunk/src/host/qemu-neo1973/Makefile.target 2007-04-24 17:15:09 UTC (rev 1824)
+++ trunk/src/host/qemu-neo1973/Makefile.target 2007-04-24 19:52:45 UTC (rev 1825)
@@ -338,6 +338,7 @@
# USB layer
VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o usb-net.o
+VL_OBJS+= usb-linux-gadget.o
# PCI network cards
VL_OBJS+= ne2000.o rtl8139.o pcnet.o
Modified: trunk/src/host/qemu-neo1973/hw/usb-net.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/usb-net.c 2007-04-24 17:15:09 UTC (rev 1824)
+++ trunk/src/host/qemu-neo1973/hw/usb-net.c 2007-04-24 19:52:45 UTC (rev 1825)
@@ -111,14 +111,14 @@
STRING_MANUFACTURER, /* u8 iManufacturer; */
STRING_PRODUCT, /* u8 iProduct; */
STRING_SERIALNUMBER, /* u8 iSerialNumber; */
- 0x02 /* u8 bNumConfigurations; */
+ 0x01 /* u8 bNumConfigurations; */
};
static const uint8_t qemu_net_rndis_config_descriptor[] = {
/* Configuration Descriptor */
0x09, /* u8 bLength */
USB_DT_CONFIG, /* u8 bDescriptorType */
- 0x00, 0x00, /* le16 wTotalLength */
+ 0x43, 0x00, /* le16 wTotalLength */
0x02, /* u8 bNumInterfaces */
DEV_RNDIS_CONFIG_VALUE, /* u8 bConfigurationValue */
STRING_RNDIS, /* u8 iConfiguration */
@@ -193,7 +193,7 @@
/* Configuration Descriptor */
0x09, /* u8 bLength */
USB_DT_CONFIG, /* u8 bDescriptorType */
- 0x00, 0x00, /* le16 wTotalLength */
+ 0x50, 0x00, /* le16 wTotalLength */
0x02, /* u8 bNumInterfaces */
DEV_RNDIS_CONFIG_VALUE, /* u8 bConfigurationValue */
STRING_RNDIS, /* u8 iConfiguration */
@@ -972,12 +972,12 @@
case USB_DT_CONFIG:
switch (value & 0xff) {
- case 0:
+ case 1:
ret = sizeof(qemu_net_rndis_config_descriptor);
memcpy(data, qemu_net_rndis_config_descriptor, ret);
break;
- case 1:
+ case 0:
ret = sizeof(qemu_net_cdc_config_descriptor);
memcpy(data, qemu_net_cdc_config_descriptor, ret);
break;
Modified: trunk/src/host/qemu-neo1973/hw/usb.h
===================================================================
--- trunk/src/host/qemu-neo1973/hw/usb.h 2007-04-24 17:15:09 UTC (rev 1824)
+++ trunk/src/host/qemu-neo1973/hw/usb.h 2007-04-24 19:52:45 UTC (rev 1825)
@@ -214,6 +214,9 @@
USBDevice *usb_host_device_open(const char *devname);
void usb_host_info(void);
+/* usb-linux-gadget.c */
+int usb_gadget_init(void);
+
/* usb-hid.c */
USBDevice *usb_mouse_init(void);
USBDevice *usb_tablet_init(void);
Modified: trunk/src/host/qemu-neo1973/vl.c
===================================================================
--- trunk/src/host/qemu-neo1973/vl.c 2007-04-24 17:15:09 UTC (rev 1824)
+++ trunk/src/host/qemu-neo1973/vl.c 2007-04-24 19:52:45 UTC (rev 1825)
@@ -6135,6 +6135,7 @@
#endif
"-usb enable the USB driver (will be the default soon)\n"
"-usbdevice name add the host or guest USB device 'name'\n"
+ "-usbgadget enable the linux USB GadgetFS as an HCD\n"
#if defined(TARGET_PPC) || defined(TARGET_SPARC)
"-g WxH[xDEPTH] Set the initial graphical resolution and depth\n"
#endif
@@ -6287,6 +6288,7 @@
QEMU_OPTION_win2k_hack,
QEMU_OPTION_usb,
QEMU_OPTION_usbdevice,
+ QEMU_OPTION_usbgadget,
QEMU_OPTION_smp,
QEMU_OPTION_vnc,
QEMU_OPTION_no_acpi,
@@ -6369,6 +6371,7 @@
{ "pidfile", HAS_ARG, QEMU_OPTION_pidfile },
{ "win2k-hack", 0, QEMU_OPTION_win2k_hack },
{ "usbdevice", HAS_ARG, QEMU_OPTION_usbdevice },
+ { "usbgadget", 0, QEMU_OPTION_usbgadget },
{ "smp", HAS_ARG, QEMU_OPTION_smp },
{ "vnc", HAS_ARG, QEMU_OPTION_vnc },
@@ -6626,6 +6629,7 @@
QEMUMachine *machine;
char usb_devices[MAX_USB_CMDLINE][128];
int usb_devices_index;
+ int usbgadget_enabled = 0;
int fds[2];
LIST_INIT (&vm_change_state_head);
@@ -7038,6 +7042,9 @@
optarg);
usb_devices_index++;
break;
+ case QEMU_OPTION_usbgadget:
+ usbgadget_enabled = 1;
+ break;
case QEMU_OPTION_smp:
smp_cpus = atoi(optarg);
if (smp_cpus < 1 || smp_cpus > MAX_CPUS) {
@@ -7324,6 +7331,12 @@
}
}
+ if (usbgadget_enabled) {
+ if (usb_gadget_init() < 0) {
+ fprintf(stderr, "Warning: could not find USB gadgetfs\n");
+ }
+ }
+
gui_timer = qemu_new_timer(rt_clock, gui_update, NULL);
qemu_mod_timer(gui_timer, qemu_get_clock(rt_clock));
More information about the commitlog
mailing list