Setting up the USB networking

Introduction

This document has been reviewed for maemo 3.x.

This document describes how you can set up USB networking between your host Linux machine and your Internet Tablet device. Note however, that you are not forced to use the USB networking between your Linux PC and the device. You could just use the WLAN networking between the devices.

This example is using the IT OS 2007 sales image. This image is pre-installed to the Tablet in the factory.

USB networking means that the Internet Tablet device and your Linux laptop are talking IP protocol over the USB cable.

Setting up the Internet Tablet for USB-networking

First, you need to install both the OpenSSH software and OSSO-XTERM to your Internet Tablet device. Information about these applications and how to install them can be found from maemo.org website. Follow the links below:

After you have installed these you need to check that the Tablet has the g_ether.ko kernel object loaded.

Now start the OSSO-XTERM and login as root.

     Nokia-N800: $ id
     uid=29999(user) gid=29999 (users)
     Nokia-N800: $ sudo /usr/sbin/gainroot
     Root shell enabled 
     ...
     ...
     Nokia-N800: #

If the system asks a root password it is rootme.

Remember to change your root password if you enable SSHD daemon process in your Tablet.

Next, load the g_ether.ko kernel object. The USB cable needs to be connected between PC and Tablet before you execute the command below.

Nokia-N800: # insmod /mnt/initfs/lib/modules/2.6.18-omap1/g_ether.ko
Nokia-N800: #

Now check if the lsmod command lists the g_ether.ko module.

Nokia-N800: # lsmod
Module                  Size  Used by
g_ether 26448 0 - Live 0xbf056000
g_file_storage 24456 0 - Live 0xbf04f000
cx3110x 50632 0 - Live 0xbf041000
umac 258596 1 cx3110x, Live 0xbf000000
Nokia-N800: # 

You should see the g_ether.ko module in the list.

Next use ifup usb0 command to start the usb0 interface in the Tablet side. Just run commands:


Nokia-N800: # ifup usb0
Nokia-N800: # ifconfig
...

After you run the ifconfig command you should see the usb0 interface in the list produced by ifconfig.

Your tablet should now be ready to accept network connections over USB. Next you need to configure your Linux PC side. This is explained in the next chapter.

Setting up your Linux PC for USB networking

These Linux host side instructions are for Debian and they might differ a little bit for other Linux distributions.

The IT OS sales image is configured to use a static IP address for USB networking.

  • IP address = 192.168.2.15

Do the following modifications in your host Linux machine:

  1. Disconnect the device from the USB connection
  2. Make sure that your Linux PC's kernel has usbnet support enabled
  3. Add the following lines to /etc/network/interfaces. You need root user rights to do this on your host
    
    auto usb0
    iface usb0 inet static
    address 192.168.2.14
    netmask 255.255.255.0
    network 192.168.2.0
    broadcast 192.168.2.255
    up iptables -t nat -A POSTROUTING -o eth0 -s 192.168.2.15 -j MASQUERADE
    up echo 1 > /proc/sys/net/ipv4/ip_forward
    down iptables -t nat -D POSTROUTING -o eth0 -s 192.168.2.15 -j MASQUERADE
    down echo 0 > /proc/sys/net/ipv4/ip_forward 
    	  
    
  4. Now bring up the usb0 network interface up in your Linux PC with the following command:
    
    Linux-PC: $ ifup usb0
    	  
    

Now you have configured both the Tablet and Linux PC side for USB networking.

Testing the USB-connection

To test that the USB connection between your Linux PC and the Internet Tablet device works follow these simple steps.

  1. Attach the USB cable to the device
  2. The device should now be connected. You can check this by running the ifconfig command in your Linux PC. You should see the usb0 device in the list:
    
    Linux-PC $ ifconfig
    or
    Linux-PC $ ifconfig usb0
    	  
    
    Study the output. The usb0 interface should be in the list and it should be "UP" and it should have IP address. For details how to use the ifconfig program try man ifconfig.
  3. Now you can try to ping the device from your Linux PC over the USB network with the address 192.168.2.15. Run command:
    
    Linux-PC $ ping 192.168.2.15	    
    	  
    
  4. If the ping answers, log into the device as root (you need to install the SSH-server software to the Internet Tablet and start the SSHD daemon process first). The root password is rootme. Run the following commands:
    
    Linux-PC $ ssh root@192.168.2.15 
    root@192.168.2.15's password:  *******
    
    BusyBox v1.4.1 (2007-03-12 19:00:25 EET) Built-in shell (ash)
    Enter 'help' for a list of built-in commands.
    
    Nokia-N800 ~# 
    
    Give the password when it is asked from you and after hitting ENTER you should get the "Nokia-N800 #" prompt. You are now succesfully logged in the Internet Tablet.

Once you are logged into the device, you can change the DNS resolve set up. By default, it is not functional. To do this you should edit /etc/resolv.conf on the device and for example add the same information your host machine has to it.

Knowns issues

There are some issues you need to be aware of related to USB networking.

  1. The USB port in the Internet Tablet can play only one role at a time. This means that you can not have both USB mass storage and USB networking working at the same time.
  2. The USB network connection might occasionally die. If this happens then just disconnect the USB cable and connect it again.
  3. If the Linux PC mounts your Tablets MMC card when you connect the USB cable then you need to first unmount the MMC card before you can use the USB networking. However, this does not happen if you have insmodded the g_ether.ko module.
  4. Sometimes when you give the ifup usb0 command the interface may not come up. If this happens then run the command couple of times. If repeating the command does not help then check your configuration files.

Now that you have setup the USB networking working between the device and the Linux PC you can basically use any network services between the device and the Linux host PC.



Improve this page