Skip to contentSkip to conversation

[4884] Add CDC-Ethernet usb NIC (original patch from Thomas Sailer).

Qemu-devel Andrzej Zaborowski 1 participant 1 message Jul 17, 2008 Kbuild

lore
Share & tools
lore
#0 lore raw

Revision: 4884

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4884
Author:   balrog
Date:     2008-07-17 20:47:13 +0000 (Thu, 17 Jul 2008)

Log Message:
-----------
Add CDC-Ethernet usb NIC (original patch from Thomas Sailer).

Modified Paths:
--------------
trunk/Makefile
trunk/hw/usb.h
trunk/qemu-doc.texi
trunk/vl.c

Added Paths:
-----------
trunk/hw/usb-net.c

Modified: trunk/Makefile
===================================================================

Makefile +2 -1
@@ -60,7 +60,8 @@
 OBJS+=tmp105.o lm832x.o
 OBJS+=scsi-disk.o cdrom.o
 OBJS+=scsi-generic.o
-OBJS+=usb.o usb-hub.o usb-linux.o usb-hid.o usb-msd.o usb-wacom.o usb-serial.o
+OBJS+=usb.o usb-hub.o usb-linux.o usb-hid.o usb-msd.o usb-wacom.o
+OBJS+=usb-serial.o usb-net.o
 OBJS+=sd.o ssi-sd.o
 
 ifdef CONFIG_BRLAPI

Added: trunk/hw/usb-net.c
===================================================================

hw/usb-net.c +1470 -0

1,470 lines not on this page · raw message

Modified: trunk/hw/usb.h
===================================================================

hw/usb.h +3 -0
@@ -219,6 +219,9 @@
 /* usb-msd.c */
 USBDevice *usb_msd_init(const char *filename);
 
+/* usb-net.c */
+USBDevice *usb_net_init(NICInfo *nd);
+
 /* usb-wacom.c */
 USBDevice *usb_wacom_init(void);
 

Modified: trunk/qemu-doc.texi
===================================================================

qemu-doc.texi +14 -1
@@ -567,6 +567,9 @@
 Braille device.  This will use BrlAPI to display the braille output on a real
 or fake device.
 
+@item net:nic_num
+Network adapter that supports CDC ethernet and RNDIS protocols.
+
 @end table
 
 @end table
@@ -584,7 +587,7 @@
 Valid values for @var{type} are
 @code{i82551}, @code{i82557b}, @code{i82559er},
 @code{ne2k_pci}, @code{ne2k_isa}, @code{pcnet}, @code{rtl8139},
-@code{e1000}, @code{smc91c111}, @code{lance} and @code{mcf_fec}.
+@code{e1000}, @code{smc91c111}, @code{lance}, @code{mcf_fec} and @code{usb}.
 Not all devices are supported on all targets.  Use -net nic,model=?
 for a list of available devices for your target.
 
@@ -1707,6 +1710,16 @@
 @item braille
 Braille device.  This will use BrlAPI to display the braille output on a real
 or fake device.
+@item net:@var{nic_num}
+Network adapter that supports CDC ethernet and RNDIS protocols.  This must be
+used together with the @code{-net nic,model=usb,...} option (see description),
+where @var{nic_num} specifies the index of the @code{-net nic,...} option
+describing the interface (zero-based).
+For instance, user-mode networking can be used by specifying
+@example
+qemu -net user,vlan=1 -net nic,model=usb,vlan=1 -usbdevice net:0 [...OPTIONS...]
+@end example
+Currently this cannot be used in machines that support PCI NICs.
 @end table
 
 @node host_usb_devices

Modified: trunk/vl.c
===================================================================

vl.c +6 -0
@@ -5475,6 +5475,12 @@
     } else if (!strcmp(devname, "braille")) {
         dev = usb_baum_init();
 #endif
+    } else if (strstart(devname, "net:", &p)) {
+        int nicidx = strtoul(p, NULL, 0);
+
+        if (nicidx >= nb_nics || strcmp(nd_table[nicidx].model, "usb"))
+            return -1;
+        dev = usb_net_init(&nd_table[nicidx]);
     } else {
         return -1;
     }