Skip to contentSkip to conversation

USB network interface

PATCH In review Thomas Sailer 2 participants 2 messages Oct 31, 2006 – Nov 1, 2006 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 USB network interface

This patch contains an initial version of an USB network interface (RNDIS / CDC Ethernet) emulator. It has been tested with Linux (Fedora Core 6). It uses the same vendor and product ID's as the linux gadget network device driver, therefore the "linux.inf" file from Documentation/usb of a linux-2.6 kernel source archive can be used under windows.

Usage:
-net user -net nic,model=usb -usbdevicenet:0
gives you the default setup (i.e. without any -net option), but with the USB adapter instead of the default PCI adapter.

Problems:
I couldn't so far get it to work under Windows, neither on W2K SP1 nor SP2. Although on SP2 it gets a lot farther. Both versions start accessing the device, and then sometime an interrupt in terminates with USBD_STATUS_INTERNAL_HC_ERROR and then the device more or less hangs. So it looks to me like a USB host controller emulation bug or a bug in the host controller driver... Maybe someone has an idea...

Tom

vl.c renamed from vl.c.usbnet +5 -0
@@ -3766,6 +3766,11 @@
 	dev = usb_tablet_init();
     } else if (strstart(devname, "disk:", &p)) {
         dev = usb_msd_init(p);
+    } else if (strstart(devname, "net:", &p)) {
+        unsigned int nr = strtoul(p, NULL, 0);
+	if (nr >= (unsigned int)nb_nics || strcmp(nd_table[nr].model, "usb"))
+		return -1;
+        dev = usb_net_init(&nd_table[nr]);
     } else {
         return -1;
     }
Makefile.target renamed from Makefile.target.usbnet +1 -1
@@ -336,7 +336,7 @@
 VL_OBJS+= scsi-disk.o cdrom.o lsi53c895a.o
 
 # USB layer
-VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o
+VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o usb-net.o
 
 # PCI network cards
 VL_OBJS+= ne2000.o rtl8139.o pcnet.o
hw/pc.c renamed from hw/pc.c.usbnet +2 -0
@@ -672,6 +672,8 @@
         }
         if (strcmp(nd->model, "ne2k_isa") == 0) {
             pc_init_ne2k_isa(nd);
+	} else if (strcmp(nd->model, "usb") == 0) {
+	    /* ignore */
         } else if (pci_enabled) {
             pci_nic_init(pci_bus, nd);
         } else {
hw/usb-net.c renamed from hw/usb-net.c.usbnet +1342 -0

1,342 lines not on this page · raw message

hw/ndis.h renamed from hw/ndis.h.usbnet +217 -0

217 lines not on this page · raw message

hw/usb.h renamed from hw/usb.h.usbnet +3 -0
@@ -218,3 +218,6 @@
 
 /* usb-msd.c */
 USBDevice *usb_msd_init(const char *filename);
+
+/* usb-net.c */
+USBDevice *usb_net_init(NICInfo *nd);
#1 lore raw

Hi Thomas,

Quoted 21 lines · --- Thomas Sailer

This patch contains an initial version of an USB network interface (RNDIS / CDC Ethernet) emulator. It has been tested with Linux (Fedora Core 6). It uses the same vendor and product ID's as the linux gadget network device driver, therefore the "linux.inf" file from Documentation/usb of a linux-2.6 kernel source archive can be used under windows.

Usage:
-net user -net nic,model=usb -usbdevicenet:0
gives you the default setup (i.e. without any -net option), but with the USB adapter instead of the default PCI adapter.

Problems:
I couldn't so far get it to work under Windows, neither on W2K SP1 nor SP2. Although on SP2 it gets a lot farther. Both versions start accessing the device, and then sometime an interrupt in terminates with USBD_STATUS_INTERNAL_HC_ERROR and then the device more or less hangs. So it looks to me like a USB host controller emulation bug or a bug in the host controller driver... Maybe someone has an idea...

Quoted 1 line

Tom

It works beautifully here with Windows XP SP1 if you configure it with static IP and user redirector.
It works with -net tap too.

Kind regards,
Sylvain Petreolle (aka Usurp)
--- --- --- --- --- --- --- --- --- --- --- --- ---
Run your favorite Windows apps with free ReactOS : http://www.reactos.org
Listen to non-DRMised Music: http://www.jamendo.com