http://wiki.maemo.org/USB_networkingUSB networkingThis 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. This article is based loosely on the Maemo 3.x configuring USB networking HOWTO. 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. If you wish to connect your tablet to a Linux machine over TCP/IP, the PC connectivity section in the Maemo SDK documentation also contains useful information. WARNING Currently there is a bug in the g_ether.ko driver of OS2008 (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 Maemo versions based on 2.6.18 kernels (e.g. OS2007 and earlier) will work.
[edit] Tablet USB network configuration[edit] USB statusbar pluginThe usb-otg-plugin applet [BAD LINK] 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. Alternatively you could try the usb networking applet found here: http://repository.maemo.org/extras-devel/pool/diablo/free/m/maemo-control/ [edit] Behind the scenesIn 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. WARNINGCurrently there is a bug in Diablo that causes DUMMY connections not to show up in connection manager, a semi-official fix is outlined in bug #3306. [edit] Starting and stopping USB network modeTo 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. [edit] Host USB Network Configuration[edit] Windows[edit] Requirements
[edit] Preparing the Windows hostOn Windows 2000, dowload & unpack RNDIS-USB-Kit_05.exe on the Microsoft web site. You 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. 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. Windows supports 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, 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. A new network card with this name will become visible afterwards, which you can configure normally. Set the IP address to 192.168.2.14. Optionally activate ICS (Internet Connection Sharing) on your network adapter to share the outside world with your little Nokia. [edit] Linux[edit] Kernel ConfigurationYou 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. If you build your own kernel then you want 'CDC Ethernet support' in USB Network adaptors. # # USB Network Adapters # ... CONFIG_USB_USBNET=m ... CONFIG_USB_NET_CDCETHER=m ... [edit] FedoraFedora supports Ethernet USB gadgets out-of-the-box. To configure the USB networking:
Now reconnect the tablet to PC and the interface should automatically configure. [edit] DebianEnsure that the usbnet module is available to your kernel (try modprobe usbnet, then lsmod to check). Add the following to /etc/network/interfaces: allow-hotplug usb0 mapping hotplug script grep map usb0 iface usb0 inet static address 192.168.2.14 netmask 255.255.255.0 broadcast 192.168.2.255 up iptables -I INPUT 1 -s 192.168.2.15 -j ACCEPT After plugging in the tablet, you can bring up the network interface with the command ifup usb0. [edit] Configuring the host as a gatewayIf your host has no firewalling rules, you can set the gateway rules by modifying /etc/interfaces file. iface usb0 inet static address 192.168.2.14 netmask 255.255.255.0 up echo 1 > /proc/sys/net/ipv4/ip_forward up iptables -P FORWARD ACCEPT up iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.2.0/24 down echo 0 > /proc/sys/net/ipv4/ip_forward down iptables -t nat -F POSTROUTING Else add the necessary MASQUERADE rules to normal firewall rules. If you get the following error: iptables v1.2.11: can't initialize iptables table `NAT': Table does not exist (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded. You need verify that your kernel has the relevant iptables modules included, and hotplug or udev is set up properly on your computer. [edit] Configuring the host as a bridgeNormally eth0 is on dhcp. This configuration allows my tablet to be on the same LAN as the rest of my boxes. You need the bridge module for 802.1d Ethernet Bridging installed. iface br0 inet dhcp hostname ash pre-up echo "Adding ethernet bridge between LAN and PAN" pre-up ifconfig eth0 0.0.0.0 pre-up brctl addbr br3 pre-up brctl setfd br3 0 pre-up brctl stp br3 off pre-up brctl addif br3 eth0 pre-down echo "Removing ethernet bridge between LAN and PAN" post-down brctl delif br3 eth0 post-down brctl delbr br3 post-down ifdown eth0 post-down ifup eth0 I do ifup br0 And the tablet is then on the LAN. [edit] Configuring the host firewallIf you have your Linux host configured with a strict firewall, you may need to modify your iptables to allow the tablet to access the internet over USB networking. To allow access both to & from the tablet, the following iptables rules are required: iptables -A OUTPUT -o usb0 -j ACCEPT iptables -A INPUT -i usb0 -j ACCEPT [edit] Testing the connectionTo test the connection, you can either type ping 192.168.2.15 on your PC or ping 192.168.2.14 in an xterm on your tablet. For troubleshooting, use ifconfig -a and route to verify on the Nokia and on a Linux or Unix PC, and ipconfig /all and route print on Windows. [edit] Known issuesWhen 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. This seems to be the case with Ubuntu too. Replugging causes following messages appear in the kernel log: [182104.412082] usb 3-1: new full speed USB device using uhci_hcd and address 29 [182104.824071] usb 3-1: device not accepting address 29, error -71 [182104.824100] hub 3-0:1.0: unable to enumerate USB device on port 1 Rebooting the tablet seems to work. [edit] Frequently asked questions
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.
|