NW   NE
 

Sharp Zaurus Developer Information

Corrections and Comments: Spencer Huang
 
SW   SE
NW   NE
 
Howtos

Upgrading The ROM

Connectivity
Wireless 802.11b

Linux Connectivity
Generic (USB)
Debian (USB)
Red Hat (USB)
Suse (USB)
Mandrake (USB)
Generic (PPP USB)
Generic (PPP Serial)

Windows Connectivity
Win2K (Serial)
Win98se (Serial)
WinMe Over (Serial)
WinNTSP6 (Serial)
WinXP Over (Serial)

Developing
Compiler Setup
Compiling the Kernel
Special Considerations
Checklist
System Layout
Application Help Files
IPKG Howto
Buzzer Howto
Led Howto
IrDa Howto
Audio Howto
Fullscreen Howto
Resume Event
Keys
Turning off the screen

Syncing
Linux
Win2K
Wireless

Other
Wireless Comparison
The Z Boot Process
Ipv6 Setup
Servers Setup
SD And CF FAQ
Setting Up A Feed
Converting TTF fonts
Building a ROM
MPEG Encoding

Downloads
ZaurusZone Feed
Links
 
SW   SE
NW   NE
  Howto make a network connection to the Zaurus from a Linux machine using USB.

This document is a generic howto. See your respective distributions howto for possible packages and or information pertaining to spesific distributions.

1) Patching the Linux Kernel

1.1) Download the appropriate patch for your kernel.
usbdnet-2.4.17-patch.gz
usbdnet-2.4.18-patch.gz
usbdnet-2.4.19-patch.gz

1.2) Patch the kernel source.
Assuming the Linux sources are in /usr/src/linux do the following (replacing usbdnet-2.4.x.patch.gz with the patch you downloaded):
cp usbdnet-2.4.x.patch.gz /usr/src
cd /usr/src
zcat usbdnet-2.4.x.patch.gz | patch -p0

1.3) Reconfigure the kernel to add support.
Pull up the kernel menuconfig.
cd /usr/src/linux
make menuconfig
In "Code maturity level options", select "Prompt for development and/or incomplete code/drivers"
In "USB support", section "USB Network adaptors", select (as a module) "USBD Network (Encapsulated) Host-to-Host Link (EXPERIMENTAL)"
Then enter 04dd in USBD Network idVendor and 8004 in USBD Network idProduct

Make sure that the core usb support (usbcore) is supported in your kernel either as a module or built in. Also make sure that a host controller (usb-uhci or usb-ohci) is a build in or a module. If you don't know which usb module to use for your machine ( usb-uhci or usb-ohci ) then check this page, it contains instructions on how to find out.

1.4) Build the kernel and modules.
If you set everything as a module simply run:
make clean dep modules modules_install
which will build the modules and install them.

If you built the components into the kernel you need to build a kernel image, install it into your bootloader, and the system should be rebooted. These steps are outside of the scope of this document and www.linuxdoc.org should be consulted. On the plus side you can skip step 5.

1.5) Running the new modules.
Install the new modules using modprobe. You need to be root to run this utility. The following three items need to be running to connect to the Zaurus. If they were all build as modules simply run "modprobe module". To see what modules are currently running run the application "lsmod".

usbcore - USB core, needed for any usb activity.
usb-uhci or usb-ohci - USB host controller driver.
usbdnet - USB networking which is what the Zaurus uses (and is the above patch).

1.6) Check to make sure the drivers are working.
Put the Zaurus in the cradle. Make sure it is on of course.
You should see a message like the following in /var/log/messages:

hub.c: USB new device connect on bus1/1, assigned device number 38
usb.c: USB device 38 (vend/prod 0x4dd/0x8004) is not claimed by any active driver.
v0.4b sl@lineo.com, tbr@lineo.com
usbdnet.c: v0.4b sl@lineo.com, tbr@lineo.com
usbdnet.c: USB Host to Device Network - for Linux USB Devices using MDLM/CDC
usb.c: registered new driver usbdnet

If you don't see this, try pushing the sync button on the cradle, it should help

Run ifconfig -a in a root shell. A new interface ( more then likely usb0 ) should appear along with lo, eth0 etc. If this does not happen check over the above steps.

1.7) Notes.

  • As mentioned by many people, make sure you've compiled in the correct driver into the kernel in the USB Controllers subsection of the USB configuration.
  • Some people report that they're getting the following message when loading the usbdnet module echo_tx not found it looks like you can safely ignore it since it does not prevent the driver from working.
  • Some people have reported file transfer problem on file larger than 65kB, it appears that is was due to the fact that they where using the uhci module instead of the usb-uhci. If you're having this kind of problem and you are using the uhci module, try using usb-uhci instead.
  • I've also received reports of kernel crashes when transferring large files with some motherboards ( at least Gigabyte X71 ) and kernel versions ( 2.4.10 and 2.4.18 ). The solution seems to update to a kernel 2.4.19pre8 or higher.

2) Setting up the network.

USB Networking is similar to PPP. Each device on either end gets an IP address. The IP address on the Zaurus is set via the network setup tool. If it is not "192.168.129.201" then use the given IP adddress when trying to ping the Zaurus below.
If when you put the Zaurus in the cradle an interface other then usb0 is created replace all instances with usb0 with that interface name for this section of the howto.
You should be able to configure the device using the following commands:

ifconfig usb0 192.168.129.1 netmask 255.255.255.0 up
route add -host 192.168.129.201 usb0 

Then try to ping the Zaurus "ping 192.168.129.201", if you've got a reply then you are sucessfully connected!

Note that if you are using a ROM newer then 2.37 you need to run a dhcp client (such as dhcpcd or pump) on your desktop to get an IP address from the Zaurus. (i.e. you can't connect untill you have an ip.) It is a security measure to only allow those connecting via the usb port to connect to the device. The dhcp server on the Zaurus only runs on the usb interface and will not give out ip's over 802.11b, LAN, etc. The networking will only allow those that have one of the IP addresses that were given out by the dhcp server to connect.

3) Connecting to the Internet from the Zaurus

To get the Zaurus on the internet through the host machine you need to masquerade the Zaurus's IP address.
Assuming on the desktop the interface eth0 with ip address 192.168.1.100 is connected to the internet you need to do the following: (Replace eth0 and 192.168.1.100 with your interface and its ip address of course.)

3.1) Enable masquerading in the kernel.
Make sure that the following options are turned on in the kernel:
In "Networking options", select :

  • Network packet filtering (replaces ipchains)
  • in "IP: Netfilter Configuration" select at least
    • "IP tables support (required for filtering/masq/NAT)" (as a module if you want)
    • "Connection tracking (required for masq/NAT)" (as a module if you want)
    • "Full NAT" (as a module if you want)
    • "MASQUERADE target support (NEW)" (as a module if you want)

3.2) Install on the desktop the new kernel and modules, rebooting if needed.

3.3) Enable the masqurading
On the desktop turn on the masqurading for the Zaurus. Note that you may need to replace "192.168.129.1" and "usb0" with the appropriate values as found in sections 1.6 and section 2.0.
ifconfig usb0 192.168.129.1 netmask 255.255.255.255 up
route add -host 192.168.129.201 usb0
iptables -t nat -F
iptables -t nat -A POSTROUTING -j SNAT -o ethX --to MY_IP
echo 1 > /proc/sys/net/ipv4/ip_forward

3.4) Configure the Zaurus
Add a default route pointing to your linux PC:
route add -host 192.168.129.1 usbd0
route delete -net 192.168.129.0/24 usbd0
route add default gw 192.168.129.1

then edit /etc/resolv.conf to add the IP of your DNS server.
Add a line like this nameserver xxx.xxx.xxx.xxx where xxx.xxx.xxx.xxx is the address of a nameserver as found in "/etc/resolv.conf".

4) Hot Plug

To automate all of the above steps you can make it so when you put the Zaurus in the cradle it will automaticly configure itself. This step is different depending on the distribution and you should look at the specific distributions howtos.

Depending on your distrobution the following may or may not work:

In order to have hotplug setup everything when you plug your Zaurus on your PC, you'll need to create a script /etc/hotplug/usb/usbdnet that should look like this ( feel free to adapt it to your needs )
Remember to replace eth0, 192.168.1.1, usb0, 192.168.129.1, and 192.168.129.201 with the correct values on your system!

#! /bin/bash
localIface=eth0
localIp=192.168.1.1
zIface=usb0
zIfaceIP=192.168.129.1
zIP=192.168.129.201

typeset -i num
num=`ifconfig | grep $zIface | wc -l`
if [ $num -eq 0 ] ; then
ifconfig $zIface $zIfaceIP netmask 255.255.255.255 up
route add -host $zIP $zIface
fi
iptables -t nat -F
iptables -t nat -A POSTROUTING -j SNAT -o $localIface --to $localIp
echo 1 > /proc/sys/net/ipv4/ip_forward

 
SW   SE

    This page was last updated: Wednesday, 09-Apr-2003 04:57:24 PDT