Setting up USB link between PC and iPAQ running Linux

Summary

The brief story is that you connect to the iPAQ through usbnet, which is ethernet through usb. The module is already part of Sigillo's kernel and is called usbnet; just add it to /etc/modules or possibly to /etc/modutils/ethernet. Note that there is now an ipkg package for usbnet on the iPAQ, which should make the connection far easier to establish than the following instructions suggest. See also these  very detailed but also dated instructions, still potentially useful -- this is part of an official-looking Linux iPAQ HOWTO.

It's possible that the new KitchenSync uses a straight USB connection -- you can ask on one of the mailing lists. The information in this file may be outdated; I pulled it off a Google cache.

Instructions

This document applies not only to iPAQ, but also to any SA11x0 based device, proveded that it have USB client port. This document applies only to kernels 2.4.2 and later. (here is old version)
This document implies that you are running Linux on both your PC and iPAQ. This document does not deal with things like interconnecting Linux PC and WinCE iPAQ.

iPAQ side

First you need to have USB client and ethernet-over-usb drivers to be either compiled into your kernel, or available as kernel modules. Module names are sa1100_usb.o and usb-eth.o.Compilation instructions. Load module by issuing modprobe usb-eth command. New network interface with name usbf should appear (can be checked with ifconfig -a command). Now you should be able to configure it as usual with ifconfig command. Once module is inserted, you can plug your ipaq into USB craddle (or USB craddle into USB bus). (Note: Do not try to first insert iPAQ to USB craddle and then load modules, that will fail, as host tries to assign address to iPAQ on it's appearance on USB bus. Also, if you reboot your iPAQ, you need to unplug and replug it to USB bus, once reboot is complete and necessary modules are loaded.)

PC side

You need to have supported USB Hub in your PC, and have kernel module for it installed. After that you should obtain kernel module named "usbnet". Since 2.4.10 it is available in Linus' linux kernel.
Enable support for CONFIG_USB_USBNET in your kernel ("USB support" -> "USB-to-USB Networking cable device support") Once module is compiled - you can insert it with insmod usbnet. Once module is loaded, new network interface usbN (where N is number starting from 0) will appear for each USB device inserted that is supported by this driver (ipaq, some usb-network cards and so on). You can configure it like any other ethernet interface (except that this one is in fact point-to-point connection to your iPAQ.)

Example configuration

Here is my own configuration for both sides, as I use it.

iPAQ side (/etc/init.d/usbnet file):
#!/bin/sh

# chkconfig: 345 45 96
# processname: usbnet
# pidfile: /var/run/usbnet.pid
# lockfile: /var/lock/subsys/usbnet

# rc.netbase 1.27 1999/09/27 16:45:01 (David Hinds)
# adapted to start usbnet by Oleg Drokin

usage()
{
    echo "Usage: $0 {start|stop|status}"
}

for x in "1" ; do

    if [ $# -lt 1 ] ; then usage ; break ; fi
    action=$1

    case "$action" in

    start)
        modprobe usb-eth
        ifconfig usbf up 1.1.1.1 netmask 255.255.255.0
        echo 10 >/proc/scale
        route add default gw 1.1.1.2
        ;;

    stop)
        ifconfig usbf down
        rmmod usb-eth sa1100_usb
        ;;

    status)
        ifconfig usbf
        ;;

    *)
        usage
        ;;

    esac

done

# Only exit if we're in our own subshell
if [ "${0##*/}" = "usbnet" ] ; then
    exit $EXITCODE
fi
Here is my PC configuration:

On PC side there is so called hotplug mechanism when everything is configured automatically when iPAQ is plugged into the USB bus. You need recent distribution to be installed for hotplug support (I use RedHat 7.1). It recognises iPAQ automatically and loads usbnet driver. If you want your network device to be configured, too you need to put ifcfg-usb0 file into /etc/sysconfig/network-scripts/ directory. Here is contents of this file for my setup:

DEVICE=usb0
BOOTPROTO=static
BROADCAST=1.1.1.255
IPADDR=1.1.1.2
NETMASK=255.255.255.0
NETWORK=1.1.1.0
ONBOOT=no


Alternatively, it is still possible to use manual configuration:

modprobe uhci  # This is to load USB host controller driver
insmod usbnet
# Now you are supposed to plug iPAQ into USB bus
ifconfig usb0 1.1.1.2 netmask 255.255.255.0
ipchains -I forward -s 1.1.1.1/32 -j MASQ # this is for iPAQ to be able to communicate with other world besides my PC host

Notem that you may want to configure your firewall at system start, especially when you are using hotplug.

Mystery

  • All known issues seems to be resolved

USB-client driver compilation

First of all you need 2 things:

  • Arm crosscompiling toolchain. e.g. this one
  • Arm kernel sources (made of mainstream sources with patches from here and here. Or you can grab already patched source from cvs at www.handhelds.org

Now cd to directory with arm sources, issue command make menuconfig, include support for SA1100 USB function support and Support for SA11x0 USB network link function, compile kernel and modules (make zImage modules), transfer them into your iPAQ, and you are done.

Troubleshooting

  1. The usbnet driver provided with stock RedHat 7.1 is too old and won't work with iPAQ USB networking.
  2. usb-eth in Familiar v0.3 is too old and will not work with recent usbnet.
  3. SMP motherboards on VIA chipsets do not distribute USB interrupts correctly in MPS 1.4 mode if kernel is earlier than 2.4.5-ac7. Or one might just revert from MPS 1.4 to MPS 1.1 mode (tunable BIOS setup parameter). Symptoms may include timeouts on USB device insertion (any device)and huge packet loss on usbnet netlink.
  4. usbnet driver bundled with linux kernel versions prior to 2.4.13 hangs when you try to bring interface down. Consider upgrading.
  5. usbnet seems not to work in 2.4.18 kernel. This case is being investigated still.


This document was brought to you by Oleg Drokin. If you have any questions, feel free to mail me. If you have a technical question please provide as much information as possible. Provide the kernel versions (both desktop and ipaq) and where you got usbnet.c at a minimum.
June, 2001

 

 

 

top

 

Debate
Evolution
CogSci

Maintained by Francis F. Steen, Communication Studies, University of California Los Angeles


CogWeb