Setting up USBnet

From GumstixDocsWiki

Jump to: navigation, search

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Customers using Gumstix OpenEmbedded should go to gumstix.net and the related user wiki

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

For customers using buildroot:

Contents

USBNet (not) on Verdex

As of August, 2007, the USBNet module does not work well on the Verdex. According to this mailing-list message from Craig Hughes,

The linux USB client driver for the PXA270 has serious problems, which basically mean it doesn't currently work, and might not ever work (there was discussion on the linux-arm mailing list about this a week or two ago). So effectively, the PXA270 is host-only, even though there is nominal USB client support on the SoC, in practice it does not work. David Brownell, the linux-usb guy, is very perjorative on the PXA family's USB client controllers.


USBNet under Linux

USBNet (tcp/ip connection over usb) depends heavily on the kernel-version you are using on the host, and the gumstix-image you've flashed on your gumstix: - If you have a Linux 2.6.10+ everything should work out of the box (regardless of the gumstix-image). All you need to do, is modprobe the usbnet-module. If you don't have one, you'll need to recompile your modules/kernel. You can then proceed to test your connection.

If you have the above kernel and the usbnet modules loaded but it still does not work, then when compiling the kernel make sure when doing make menuconfig that Device Drivers -> USB Support -> USB Network Adapters -> Embedded Arm Linux Links (CONFIG_USB_ARMLINUX) is selected Also under Device Drivers -> USB Support -> USB Gadget Support The following are selected: Support for USB Gadgets, USB Gadget Drivers (Ethernet Gadget), Ethernet Gadget, and RNDIS support are selected. I selected them to be included in the kernel, not as modules. I do not know if this makes a difference.

For Linux 2.6.13.?+ you will need to add: Device Drivers -> USB Support -> USB Network Adapters. Select "Multi-purpose USB Networking Framework" "Simple USB Network Links (CDC Ethernet Subset)" and "Embedded ARM Linux Links (iPaq, ...)" You can also select "Host for RNDIS devices (EXPERIMENTAL)"

- If you have Linux 2.6.9-, you'll need to patch the kernel: drivers/usb/net/usbnet.c needs to be changed, so that it recognizes the gumstix as usb-net device (the file should be in the attachement-section of this page):


--- usbnet_orig.c       2004-11-12 22:55:56.000000000 +0100
+++ usbnet.c    2004-11-22 20:37:14.000000000 +0100
@@ -3320,6 +3320,10 @@
}, {
       USB_DEVICE (0x8086, 0x07d3),    // "blob" bootloader
       .driver_info =  (unsigned long) &blob_info,
+}, {

+       // Linux Ethernet/RNDIS gadget on pxa210/25x/26x

+       USB_DEVICE_VER (0x0525, 0xa4a2, 0x0203, 0x0203),

+       .driver_info =  (unsigned long) &linuxdev_info,
 
},
#endif


Just as reminder. The usual procedure to patch:

cd /usr/src/linux/drivers/usb/net
patch < ~/usbnet.patch


If you build usbnet as a module you'll just need to rebuild and install the modules (make modules modules_install), otherwise you'll need to rebuild the kernel. This solves the host-part. The attached patch doesn't work with recent gumstix-images though, as they are made work with Windows too (and only recent linux-kernels are able to deal with this). The easiest workaround is building the gumstix-image without RNDIS (==windows-usb-net). Obviously you won't be able to attach your gumstix to Windows-machines anymore. First fetch the build-root environment (using svn as described above), but do not yet build it. Enter the gumstix-buildroot/sources directory and disable RNDIS in the linux.conf file:


cd gumstix-buildroot/sources
sed -i 's/CONFIG_USB_ETH_RNDIS=y/# CONFIG_USB_ETH_RNDIS is not set/' linux.config


Now build you environment as usual:


cd ..
make


This should create a new rootfs.arm_nofpu.jffs2 image that you can upload to the Gumstix.

USBNet under Windows

Main article: Windows XP usbnet

In the current revision (r434) usb isn't started automatically at boot-up anymore. In this case just add "auto usb0" to /etc/network/interfaces (on the gumstix) before proceeding. Normally you just need to install the linux.inf from the gumstix linux source tree (gumstix-buildroot/build_arm/linux-X/Documentation/usb). You can get the file in the attachement-section of this page too. Windows should then automatically detect your gumstix. If it doesn't your gumstix-image might not be up to date. Flash a newer version and try again. Windows should automatically detect your gumstix. Follow Windows_XP_usbnet to install the driver. You'll need DOS version of linux.inf external link before proceeding. Dave Hylands has some nice instructions of getting dhcp to work under windows. Have a look at his pageexternal link, until its content is merged here.

If you are using Windows 2000, you may need an RNDIS driver, which is available at: RNDIS driver

Windows 2000 does not appear to support bridging, however if you configure Windows' RNDIS interface to use 192.168.1.1, and Gumstix' usb0 to use 192.168.1.2, you should be able to access the Gumstix from your Windows box. (Or use 192.168.2.X if your network already uses 192.168.1.

USBnet on Mac OS X

Head over to the AJZaurusUSB page and get the latest version of their Mac OS X driver, install the driver but before you restart you need to add Gumstix to the list of devices. Using the terminal edit the file /System/Library/Extensions/AJZaurusUSB.kext/Contents/Info.plist and add the following below


      <key>IOKitPersonalities</key>
      <dict>


the text:


               <key>Gumstix</key>
                       <dict>
                         <key>CFBundleIdentifier</key>
                         <string>org.lucidcake.driver.AJZaurusUSB</string>
                         <key>IOClass</key>
                         <string>org_lucidcake_driver_AJZaurusUSB</string>
                         <key>IOProviderClass</key>
                         <string>IOUSBDevice</string>
                         <key>idProduct</key>
                         <integer>42146</integer>
                         <key>idVendor</key>
                         <integer>1317</integer>
                   </dict>


Restart and when you plug the usb cable in (and waited a bit for Linux to boot) you should be informed of a new network device which once configured will allow you to ssh in.

Thanks to OpenEZX for describing the method and pointing me in the direction of the latest driver.

USBnet on Mac OS X 10.5.X

By default, Mac OS X 10.5.X prefers to use the CDC-ACM interface of USB networking devices instead of CDC-ECM with the exception of a broadcom network card. The result being a serial network interface instead of an ethernet network interface. To remedy this, you can download a patched AppleUSBCDC driver that will recognize the usb id/vendor pair of g_ether and force it to use CDC-ECM (ethernet network interface). You can obtain the OS X 10.5.X patched driver from: http://bugcommunity.com/downloads/usbcdc-g_ether.zip. Source code: http://bugcommunity.com/downloads/files/AppleUSBCDCDriver-g_ether.326.4.1.zip

Installation guide is found at http://bugcommunity.com/wiki/index.php/Start_Guide_Mac_OS_X_10.5

The issue of multiple network interfaces showing up whenever the device is rebooted/power-cycled is due to the g_ether driver randomly setting the host and device mac addresses. This problem is remedied by passing the same host and device mac addresses during the modprobe of g_ether.

For example:

modprobe g_ether host_addr=46:0d:9e:67:69:eb dev_addr=46:0d:9e:67:69:ec

Testing the connection

If everything works as expected you should have an usb0 interface (ifconfig -a) on both host (if Linux) and Gumstix after having plugged the USB-cable. From here on it's standard networking. If you are unfamiliar with Linux/Windows networks here some short lines to test your connection. Under Linux type "ifconfig", and look for adresses starting with 192.168.0.X. If you have some, replace 192.168.0.1 with 10.0.0.1 and 192.168.0.2 with 10.0.0.2 in the following lines (same applies for Windows: if you have already a network that uses 192.168.0.X, switch to another network): On the Gumstix (over serial line):

# ifconfig usb0 192.168.0.2

On the linux-machine:

# ifconfig usb0 192.168.0.1
# ssh root@192.168.0.2

And you should be connected to your gumstix over the usb-connection. Under Windows just configure the USB-interface to have 192.168.0.1 as IP-address. You can test the connection by httping to the gumstix (http://192.168.0.2).

If you want to have a static IP on your gumstix edit /etc/network/interfaces on you gumstix and replace

   iface usb0 inet dhcp
       pre-up /sbin/modprobe g_ether;/sbin/modprobe af_packet
       post-down /sbin/modprobe -r g_ether

with

   iface usb0 inet static
       address 192.168.0.2
       netmask 255.255.255.0
       pre-up /sbin/modprobe g_ether;/sbin/modprobe af_packet
       post-down /sbin/modprobe -r g_ether

Note however, that reflashing the gumstix will erase this file! Therefore the cleanest solution is to add a dhcp-server on the host-machine.

You might also have a look at the Ethernet Gadget-page.

Personal tools