USB networking

Image:Ambox_content.png
This is an article from the old midgard wiki that hasn't yet been fully updated for this wiki, please update it.
Please see the talk page for discussion.


Contents

Setting up USB networking

This page describes how the maemo platform can be turned into a USB network device. The first part describes how to configure the Nokia tablet as a USB pluggable network device. The second part describes how to configure various platforms to use the Nokia tablet as a network device.

You might want to use the tablet as a USB network device to log into your tablet remotely, or to transfer data from your tablet to another computer, in a situation where wifi or bluetooth are not an option.


Tablet USB network configuration

USB statusbar plugin

The usb-otg-plugin applet lets you set up USB networking tablet-side, and switch between host and client mode. This is the easy way to do things and no other tablet-side configuration is required.

Behind the scenes

In normal circumstances, the USB Mass storage driver had control of the USB hardware. USBNet allows the g_ether network driver to take control of the USB interface.

After installing USB networking, set up a dummy access point by running the following:

gconftool -s -t string /system/osso/connectivity/IAP/DEFAULT/type DUMMY

You should see a "DEFAULT" connection appear in the connection manager.

Starting and stopping USB network mode

To easily start & stop USB network mode, place the following script in /etc/init.d/usbnet on your tablet. To do this, you will need root access to the device.

While switching between modes by running the script, it is important to disconnect the USB cable.

#! /bin/sh
#
# Startup script for USBnet (networking, instead of USB Mass Storage behaviour)
# Author: Michael Mlivoncic

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=usbnet
DESC="USB Networking for Nokia Internet Tablets"
INITFILE=/etc/init.d/$NAME

case "$1" in
start)
        umount /media/mmc1
        umount /media/mmc2
        sleep 2
        USBNET="`lsmod | grep g_ether`"
        KERNEL_VERSION="`uname -r`"
        if [ "$USBNET" = "" ]
        then
           echo "Entering Ethernet via USB mode (g_ether)..."
           insmod /mnt/initfs/lib/modules/$KERNEL_VERSION/g_ether.ko
           echo "Waiting, then bringing up the usb0 interface.."
           sleep 1
           /sbin/ifup usb0
        else
          echo "Already in Ethernet-via-USB mode..."
          echo "Try ping 192.168.2.15"
        fi
        ;;
stop)
         echo "switching back to USB Mass Storage mode..."
         echo "removing module g_ether"
         /sbin/ifdown usb0
         sleep 2
         rmmod g_ether
        ;;
*)
        printf "Usage: $INITFILE {start|stop}\n" >&2
        exit 1
        ;;
esac

exit 0

This script is quite basic, but can be run automatically at start-up, or manually using the command:

sudo /etc/init.d/usbnet [start|stop]

to activate or deactivate USB networking.

There is a default USB network interface configuration on Nokia N800 and 770 tablets. In the file /etc/network/interfaces, you should see a section which looks like this:

auto usb0
iface usb0 inet static
       address 192.168.2.15
       netmask 255.255.255.0
       gateway 192.168.2.14

With this default configuration, the tablet interface will have the IP address 192.168.2.15, and the remote end will have the IP address 192.168.2.14.

Host USB Network Configuration

Windows

WARNING Currently there is a bug in the g_ether.ko driver of ITOS2008 (both 4.0.1 and 4.1) which prevents USB networking from working correctly with Windows machines (but not with Linux machines). See bug #3243 for details. The bug was introduced somewhere between kernels 2.6.18 and 2.6.21, so ITOS versions based on 2.6.18 kernels (e.g. ITOS2007 and earlier) will work.

That said, nothing prevents you from trying the instructions below, but be warned that most likely you won't succeed unless bug #3243 is solved.

Requirements

  • Windows XP SP2 contains the required .sys files.
  • Download the file Nokia770 USB Ethernet RNDIS.inf from here or here It will instruct Windows XP that its built-in RNDIS driver is appropriate for Linux USB networking devices, and the Nokia 770 as such.
  • If you are using an N800, skip all the steps below which apply to the N770; the bora distribution supplies a control panel applet called "maemo-statusbar-usbnet". Once installed, the control panel "Maemo-DM" will allow you to change the function of the USB port from "MMC emulation" to a RNDIS emulation of a USB ethernet interface. You will also need to set the WinXP side's IP address to be fixed at 192.168.2.14.

This file is my updated/improved version of linux.inf from gumstix. The original version did not work with the current download for Windows 2000 from above.

I tried these 3 .inf files on a Windows2000 (5.00.2195 SP3) plateform, but none of them reconized the N770 (the list of drivers stays blank after selecting the directory where the .inf and .sys files are)... any ideas ?

  • ...and of course, as usual, i.e. need to be root / have xterm on the Nokia 770.

Preparing the Windows host

When you connect the Nokia to the PC, it will look for a suitable driver. As opposed to the USB mass device mode, Windows will not find a suitable driver by default. Actually, Windows XP comes with built-in support for so called RNDIS devices, but it does not know that the N770 will act as such. Therefore, we need to instruct it to do so: In the driver dialog, choose that you will provide the driver's location. Point it to the directory where you previously downloaded the Nokia770 USB Ethernet RNDIS.inf (or linux.inf) file. It will show you a driver called Linux USB Ethernet/RNDIS Gadget. Install it.

Additional step for Windows 2000

As mentioned before, Windows 2000 lacks of the basic driver files. So, first unpack RNDIS-USB-Kit_05.exe you have downloaded above (266kB from July 2005). You only need to copy rndismpy.sys (30 KB) and usb8023y.sys (14 KB) from

RNDIS USB kit 2005\Drivers\x86fre\sys files to a folder of your choice, e.g. c:\Drivers\Nokia770_RNDIS. Add Nokia770 USB Ethernet RNDIS.inf to the same folder; this will complete your driver set. As with Windows XP, now just install it from the Device Manager dialog.

A new network card with this name will become visible afterwards. I assume, you know or can figure out how to set up this network adapter. Minimally, set its IP-address to static 192.168.2.14. Optionally activate ICS (Internet Connection Sharing) on your network adapter to share the outside world with your little Nokia.

Testing the connection

To test the connection, you can either type ping 192.168.2.15 on your PC or vice versa, ping 192.168.2.14 in the xterm.

For troubleshooting, use ifconfig -a and route to verify on the Nokia, ipconfig /all and route print.


Linux

Kernel Configuration

You should have the usbnet module available for your Linux kernel. On most distributions, this is the case by default. If this is not the case for your distribution, you will need to enable USB networking support in the kernel.

#
# USB Network Adapters
#
...
CONFIG_USB_USBNET=m

Fedora

Fedora supports Ethernet USB gadgets out-of-the-box. To configure the USB networking:

  • Connect the tablet with g_ether.ko loaded to your Linux PC
  • Open System -> Administrate -> Network (or run system-config-network from command line).
  • Press the "New" button to create a new network interface. Select "Ethernet" network card type.
  • On the next screen, select the "Netchip Technology, Inc. Linux-USB Ethernet/RNDIS Gadget (usb0)".
  • Choose "Static IP address" and enter the IP address 192.168.2.15 for your PC, if you are using the default usb0 configuration on your tablet. Don't fill the gateway field on the Fedora side.
  • Fill other settings (DNS etc) if you want to, then press "Finish".

Now reconnect the tablet to PC and the interface should automatically configure.

Debian

Known issues

When unplugging and replugging the USB cable between the two devices, Windows will indicate a code 10-error indicating that the device could not start properly. The problem appears to be with the Nokia tablet, since after rebooting the device, networking works again. Remember to first initialize g_ether before plugging your tablet into the USB host.

Frequently asked questions

  1. So if we have already plugged in our 770 into XP, and it recognized it as a drive, do we need to remove the driver software that makes it appear as a USB drive, and replace it with the USBNet drivers?
    • No, windows registers the tablet in network mode as a different device.
    • However, as stated above: you have to insmod the kernel module on your tablet before you connect the cable!
  2. When I try to do the above, I get an error stating that the driver I am trying to choose doesn't have anything to do with my hardware.
    • Make sure you have activated USB networking on the Nokia side correctly.
  3. My tablet can now talk to my XP machine, but how do I get out to the rest of the network?

First, set up a dummy access point, as described above, so that you can configure the network settings in connection manager for your usbnet connection. This will allow you to configure proxy server access. Secondly, install a proxy on your local machine. Examples include proxomitron or freeproxy.