Help - Search - Members - Calendar
Full Version: Usb Connection Howto
OESF Forums > Distros, Development, and Model Specific Forums > Distro Support and Discussion > Angstrom & OpenZaurus
lardman
Another pinned topic :-)

Let's nail setting up USB connections between a Z and a PC (running WinXP or Linux), which is a basic thing which ought to be documented (and which comes up from time to time).

What we need is:
* Your Z (hardware, OZ version, kernel version)
* Your PC OS (including kernel version/service pack/etc.)
* Where you got the drivers from (if needed)
* What changes you made on the PC (if any, mainly for Linux)
* What changes you made on your Z (if any)

Cheers,


Si

P.S. I know there are already HowTos in the ZUG HowTos area, however these generally apply to Sharp ROMs (and although there may not be many differences, there are enough).

By all means, lift the info from there if it works, it'll go back in there once this is all sorted.
lardman
Zaurus - C750, 2.6.11 kernel, OZ 3.5.3pre (probably other C7/8x0 machines, possibly all machines with the 2.6.x kernel).

Windows XP.

Quite simple, no real drivers are required, just an .inf file you should point the hardware wizard to when it says it can't recognise your Z).

The linux.inf file comes from Documentation/usb/linux.inf in the kernel 2.6.x source (it will need to be converted to Windows format first if you take it directly from thje kernel source - use unix2dos, or open it with WordPad and re-save it).

The file is attached to this post for the time being, but we'll find a more permanent location when 3.5.3 is released.

http://www.oesf.org/forums/index.php?showt...indpost&p=73169


Si
darac
Zaurus:
SL-5500 (Collie)
Hentges.net ROM T7 (based on OpenZaurus 3.5.2)

PC:
Debian 3.1 "Sarge", Vanilla Kernel 2.6.11.6 (Should work with earlier 2.6 kernels, but note that the driver location has moved.)

Drivers:
Device Drivers -> USB Support -> USB Network Adapters
Set "Multi-purpose USB Networking Framework" as a Module and turn on "Embedded ARM Linux links (iPaq, ...)" and "Sharp Zaurus (stock ROMs)"
Rebuild your kernel or just "make; make modules_install" if you're feeling brave.
(In other words, CONFIG_USB_USBNET=m, CONFIG_USB_ARMLINUX=y and CONFIG_USB_ZAURUS=y)

This will make the "usbnet.ko" module.

PC-Side changes
Install the "hotplug" package.

Add the following line into /etc/hotplug/usb.distmap:
CODE
usbnet    0x003    0x04dd    0x8004    0x0000    0x0000    0x00    0x00    0x00    0x00    0x00    0x00    0x00000000

(That's one single line with Thirteen (13) white-space-delimited fields)

Now create the following file /etc/hotplug/usb/usbnet:
CODE
#! /bin/bash
typeset -i num
num=`ifconfig | grep usb0 | wc -l`
if [ $num -eq 0 ]; then
   ifup usb0
else
   ifdown usb0
   sleep 1
   ifup usb0
fi

and make it executable with "chmod +x /etc/hotplug/usb/usbnet"

Add the following to /etc/network/interfaces:
CODE
# USBd Interface to the Zaurus
# Statically configure the interface (i.e. no DHCP)
iface usb0 inet static
   address 192.168.129.200     # Address of PC's end of link
   pointopoint 192.168.129.201   # Address of Zaurus' end of link
   netmask 255.255.255.255
   # Now call some commands when the link comes up
   up iptables -t nat -F      # Flush the NAT table
   up iptables -t nat -A POSTROUTING -j SNAT -o eth0 --to $addr
        # Set up Source Network Address Translation (SNAT)
        # Note:
        # eth0 - Interface towards the internet.
        #   This can probably be ppp0 if the PC is dialled up.
        # $addr - Set this to the address of the above interface.
   up echo "1" > /proc/sys/net/ipv4/ip_forward
                   # Turn on IP Forwarding
   # Now call some commands AFTER the link has gone down
   post-down echo "0" > /proc/sys/net/ipv4/ip_forward
                   # Turn off IP Forwarding
   post-down iptables -t nat -F  # Flush the NAT table

# Optional IPv6 on interface
iface usb0 inet6 static
   address 2001:618:429:cafe::5501 # Choose an address in your own block
        # I have ...::5501 at this end and the
        # Zaurus configured as ...::5500
   netmask 128
   mtu 1500


Zaurus-side changes
In Network Settings, for usbd0:
Turn ON "Automatically bring up"
Turn OFF "DHCP"
IP Address: 192.168.129.201 (To match pointopoint address above)
Subnet Mask: 255.255.255.0
Gateway: 192.168.129.200 (To match address on PC)
First DNS: Whatever you like
Second DNS: Whatever you like

Now, you should be able to just plug the Zaurus in. Hotplug will detect the SL-5500, load usbnet.ko, configure the interface and iptables will allow the Zaurus to connect to the internet.

NOTE: We've only used Source NAT so, while the Zaurus can access the internet (pull down ipks etc), it is not accessible to internet computers connecting to it. (That is, you won't be able to ping the Zaurus or connnect to any servers on the Zaurus from any computer other than the one at the end of the USB cable). Also note that you WILL want to tweak the lines in /etc/network/interfaces if you perform other NAT functions on the PC. Suggestions are welcome for more specific (and better) iptables commands.
gfdsa
Zaurus:
SL-600L, OZ 3.5.2, Dock Station
PC:
WinXP SP2
Drivers:
Shipped on CD with Z, or download:
http://ezaurus.com/bzsolution/download/SL6...SL6000Setup.exe
http://www.gfdsa.org/~gfdsa/SL6000Setup.exe

After Windows recognizes SL-6000, point it to UsbDrivers Dir, follow the wizards.

PC-Side Changes
When it finally settles down, go to network connections, enable connection sharing for your internet connection.
Z-Side Changes
Change usbd0 ip to 192.168.0.x or enable dhcp
ifdown usbd0
ifup usbd0

NOTE: Disconnects on large files transffers with SCP, requires device disconnecting and ifdown/ifup
jancici
hi, for me this is not working, I can remember that with original sharp ROM it was working very well. I did flash OZ 3.5.2 and it was not working, yeasterday I did flash OZ 3.5.3. and still I have problem.

so on Z I have OpenZaurus 3.5.3, uname -a saying 2.4.18-mk7-pxa3-embedix
I have done :
1. settings -> network -> usbd0 : to bring it UP automaticaly, and set up static IP
2. restart Z
after that usbd0 net interface is up

on my desktop I am running gentoo with 2.6.11-gentoo-r5 kernel
I did use same configuration as for SharpROM, so I think it's should work (if necesary I can post my config

when I plug Z to cardle and then I plug usb cable to desktop I can see Zaurus on desktop using "lsusb" command. but hotplug on desktop is not starting usbnet and I don't know why.

when I am typing modprobe -l on Z I am getting empty list :-(

I am totaly tired with this, I did try follow several hot-to by did not help.

thanks
lardman
Start a seperate thread please, this thread is just for reference purposes.

Si

P.S.

Say which machine you have - it'll help people.
lardman
Zaurus:

OZ 3.5.3 C7x0 with 2.4.18 kernel (GPE only atm)

PC:

Windows XP (should work for other versions of Windows too)

Drivers:

On the CD with your Z, or download the standard Windows USB drivers for the C7x0 machines from ZUG:

http://www.zaurususergroup.org/UpDownload+...t-lid-199.phtml

When the add hardware wizard asks where to look for the drivers, choose the custom location and point it to the net sub-directory in the above zip file.

PC-Side Changes
Go to network connections, select a static IP address (unless your PC or your Z is running a DHCP server - chances are neither is).

Z-Side Changes
Change usb connection IP address to a static address or enable dhcp if either your Z or PC is running a DHCP server.
obergix
QUOTE(darac @ Apr 13 2005, 10:45 PM)
Add the following to /etc/network/interfaces:
CODE
# USBd Interface to the Zaurus
# Statically configure the interface (i.e. no DHCP)
iface usb0 inet static

[SNIP]

   up iptables -t nat -A POSTROUTING -j SNAT -o eth0 --to $addr



NOTE: We've only used Source NAT so, while the Zaurus can access the internet (pull down ipks etc), it is not accessible to internet computers connecting to it. (That is, you won't be able to ping the Zaurus or connnect to any servers on the Zaurus from any computer other than the one at the end of the USB cable). Also note that you WILL want to tweak the lines in /etc/network/interfaces if you perform other NAT functions on the PC. Suggestions are welcome for more specific (and better) iptables commands.
*


On my system (Debian Sarge), the --to should be replaced by --to-source and followed by the address of the standard network interface of the PC (eth0).

Hope this helps
dansawyer
The howto is very helpful as it is. I would suggest a 'debug' section to help when the interface freezes. My Z on a FC2 freezes about every 2 days. Sometimes it is on the Linux side; it seems that usbnet does not like to suspend-resume and have the Z connnection change. So one debug note is the use of lsusb. Is there a way to force reload usbnet w/o rebooting?

The Z hangs occationally as well. The interface will not come up. I am not sure what to do about this? There used to be a change to the suspend resume scripts. Does anyone know if this will help? If it will then I will dig them up, try them, and post here.

Dan
niv
Windowz:
you may want to use NT/2000/XP routing to get ur zaurus to the web.
use these commands:

netsh routing ip nat install
netsh routing ip nat add interface “YOUR LAN INTERFACE NAME” full
netsh routing ip nat add interface Internal private

YOUR LAN INTERFACE NAME has to be replaced with the name of the interface connected to the internet

I think I am missing a line, as it doesn't work yet. will fix it soon.

Niv
charcler
HELLO
sysops... gurus... wanna.. new... all ;)

My (very) first time with Zaurus, (old) model SL 5500, strong Arm 1110 rev 9
Unpack :
Zaurus + dock + SD 128 + flash 128 + wifi Dlink + multicards usb reader + cables ;)

"kernel card 3.1.2" = kernel 2.4.18 rmk7 pxa3 embedix 021129 compiled by mickey@r2d2 ;))
OpenZaurus 3.5.2
Opie, Open PalmTop Integrated Environnement v 1.1.7
Zaurus has been 'burned, cuted' ... cool
tests : gfx rendering : 2560 gops/second // ram performance : 26.5 mb/s Cool!!!

All right's :))

Install first ipk : kismet. ok ! second : wellenreiter. np too. searchin about Zeb paquage to mplayer compil for arm :(( link at it s home at uklinux ... no tarball... any idea ? thanks :)

Well done, The USB Connection :
my workstation :
kernel 2.6.12.6 -- gnu -- mandriva 2005le -- xorg 6.8 -- kde 3.4 --

So :
connect dock with usb and power. Connect Z on.
LSUSB:
Bus 002 Device 003: ID 04dd:8004 Sharp Corp. Zaurus SL-5000D/SL-5500 PDA
ok
less /var/log/kernel/info
Aug 5 05:22:17 charcler kernel: usb 1-2: new full speed USB device using uhci_hcd and address 12
Aug 5 05:22:17 charcler kernel: usb0: register usbnet at usb-0000:00:14.2-2, Sharp Zaurus SL-5x00
Perfect ...

Go into network configuration ...
shutting down shoreline firewall /etc/init.d/shorewall stop (or service shorewall stop or CLICK MandrakeControlCenter - system - services - click on "stop" shorewall )
--CLICK MandrakeControlCenter - Internet/network - Share internet - select usb0 - patient... OK
simply restart firewall (it adapte itself on new nat connection)
Zaurus :
--CLICK settings - network - usb0 - ip/dhcp (hehehe) - start OK
Open Opera : all works good ;) I am on the internet with my Z throught usb connection.
30 secondes for all settings. (2 seconds for settings, 28 seconds to view step-by-step the logs)
roxor.

note : in fixed ip : 4 secondes without log view ;)

Wireless ? too... :))
now : i have the choice between 3 sync applx. Opie, sync and other one... I think it s not hard to sync with Kontact ;)

see you !
ajaygautam
Z: SL5500, OZ 3.5.3,2.4.18-rmk7-pxa3-embedix
PC: Gentoo Linux / x86, 2.6.12-gentoo-r6

Just got IP forwarding / NAT working, so that I can access internet from my Zaurus via the USB connection. Here is the script that worked for me:

CODE
# make sure you have iptables stuff / modules compiled
# needs to be run on PC
modprobe ip_tables
modprobe iptable_nat

echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/ip_dynaddr

EXTIF="eth0"
INTIF="usb0"

iptables -P INPUT ACCEPT
iptables -F INPUT
iptables -P OUTPUT ACCEPT
iptables -F OUTPUT
iptables -P FORWARD DROP
iptables -F FORWARD
iptables -t nat -F

iptables -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
iptables -A FORWARD -j LOG

iptables -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
echo "Make sure Zaurus's /etc/resolv.conf points to correct entries"


Ajay
NickNak
Using an ethernet bridge to plug your Zaurus into your network seems to me preferable to routing a two-node subnet between your PC and the Z and then using NAT to give the Z access to your network/the internet. Details of how to do it are at the usbnet website. On Gentoo, this is particularly easy:

1. Create symlinks to /etc/init.d/net.lo called /etc/init.d/net.usb0 and /etc/init.d/net.br0
2. Put the following in /etc/conf.d/net:

CODE
bridge_br0="eth0"
# You need to configure eth0 and usb0 as null so that dhcp is not used,
# we don't want IP addresses etc for these interfaces.
config_eth0=( "null" )
config_usb0=( "null" )
# Could use config_br0=( "dhcp" )
config_br0=( "192.168.2.30" )
depend_br0() {
   need net.eth0
}
gateway="br0/192.168.2.1"
# when hotplug configures usb0, add it to the bridge.
postup() {
   local iface=${1}
   if [[ ${iface} == usb0 ]]; then
       brctl addif br0 ${iface}
   fi
}


Obviously tailor the IP addresses to suit.

3. Configure the TCP/IP connecton on the Zaurus to make it part of the same subnet as your PC, e.g.
IP Address = 192.168.2.50
Subnet Mask = 255.255.255.0
Gateway = 192.168.2.1
First and Second DNS the same as your PC.

4. Test the configuration:

CODE
/etc/init.d/net.eth0 stop
/etc/init.d/net.br0 start


then plug in and switch on the PDA. Check that your PC and PDA have network access

5. Make the new configuration permanent:

CODE
rc-update del net.eth0
rc-update add net.br0 default
Headrush
QUOTE(NickNak @ Sep 14 2005, 11:56 AM)
Using an ethernet bridge to plug your Zaurus into your network seems to me preferable to routing a two-node subnet between your PC and the Z and then using NAT to give the Z access to your network/the internet. Details of how to do it are at the usbnet website. On Gentoo, this is particularly easy:

1. Create symlinks to /etc/init.d/net.lo called /etc/init.d/net.usb0 and /etc/init.d/net.br0
2. Put the following in /etc/conf.d/net:

CODE
bridge_br0="eth0"
# You need to configure eth0 and usb0 as null so that dhcp is not used,
# we don't want IP addresses etc for these interfaces.
config_eth0=( "null" )
config_usb0=( "null" )
# Could use config_br0=( "dhcp" )
config_br0=( "192.168.2.30" )
depend_br0() {
   need net.eth0
}
gateway="br0/192.168.2.1"
# when hotplug configures usb0, add it to the bridge.
postup() {
   local iface=${1}
   if [[ ${iface} == usb0 ]]; then
       brctl addif br0 ${iface}
   fi
}


Obviously tailor the IP addresses to suit.

3. Configure the TCP/IP connecton on the Zaurus to make it part of the same subnet as your PC, e.g.
IP Address = 192.168.2.50
Subnet Mask = 255.255.255.0
Gateway = 192.168.2.1
First and Second DNS the same as your PC.

4. Test the configuration:

CODE
/etc/init.d/net.eth0 stop
/etc/init.d/net.br0 start


then plug in and switch on the PDA.  Check that your PC and PDA have network access

5. Make the new configuration permanent:

CODE
rc-update del net.eth0
rc-update add net.br0 default

*

NickNak, great guide.

I do have a question though: how do eth0 and usb0 get their IP address.
I can manually create the bridge and add the 2 interfaces (eth0 and usb0) to the bridge, but then I have to use ifconfig to give each an IP address.

Is there a way to do this automatically and is it still possible if eth0 uses DHCP to receive it's IP address?
NickNak
Using this method, usb0 and eth0 do not need IP addresses. There are only two IP addresses involved: the one for the PC, which is assigned to interface br0 by the directive config_br0=( "192.168.2.30" ), and the one for the PDA which I configured using the Network settings GUI to "192.168.2.50". I think both of these could be assigned using dhcp but I haven't tried it. Using a bridge at the ethernet level means that the PDA "looks like" any other device on the same ethernet segment as the PC.
Headrush
I had this usbd connection working perfectly and then something has changed and I can't figure it out.

I am on Gentoo and set up bridging like NickNak suggested. The PC has address 192.168.13.100 and the Zaurus gets 192.168.13.113.
My PC goes to a router @ 192.168.13.1

This is the dmesg on PC when Zaurus inserted into cradle

CODE
usb 4-1: new full speed USB device using uhci_hcd and address 15
usb0: register 'zaurus' at usb-0000:00:10.3-1, Sharp Zaurus SL-5x00, 36:78:db:4c:f0:41
device usb0 entered promiscuous mode
br0: port 2(usb0) entering learning state
br0: topology change detected, propagating
br0: port 2(usb0) entering forwarding state

I can ping the PC, and router without issue. I can also ping any web address by name or IP address.

If I do a traceroute to any web address I can see the packets routed properly.

If I try any network program on the Zaurus, they do nothing. Includes, ipkg, wget, konq-embedded. All the sites are working

Any ideas or suggestions?
lardman
No, no, no, no, no - this is a thread giving details about how to get connections working, not to ask about how to get them working; start a new thread.
7_feet_up
Debian unstable Zaurus USB-network how-to:
Install the latest stock kernel for your machine class e.g.:
CODE
user@desktop:~# sudo apt-get install linux-image-2.6.14-2-686

Reboot.
Plug in the zaurus and see if it was recognized by your computer. By issueing the command 'tail /var/log/messages' you will see the last few lines of your system log. You should see that an usb device was connected, the 'zaurus' module was loaded and that your zaurus was recognized:
CODE
user@desktop:~# tail /var/log/messages
Dec 17 17:35:58 localhost kernel: usb 2-2: new full speed USB device using uhci_hcd and address 10
Dec 17 17:35:58 localhost kernel: usb0: register 'zaurus' at usb-0000:00:10.0-2, pseudo-MDLM (BLAN) device, 52:8c:8b:4f:e4:90

Find that the module was loaded:
CODE
user@desktop:~# lsmod | grep zaurus
usbnet                 17064  2 zaurus,cdc_ether

You'll probably have one or two more lines containing the word 'zaurus', but you definitely should have this line here. If not, something went wrong with loading the module.
An 'ifconfig -a' should give you a usb0 network interface, which isn't configured yet. There may be more network interfaces depending on your system, but usb0 should definitely be there.
CODE
user@desktop:~# ifconfig -a
usb0      Link encap:Ethernet  HWaddr 52:8C:8B:4F:E4:90
         BROADCAST MULTICAST  MTU:1500  Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Now we'll configure the network interface of the zaurus and your linux computer. We'll give your computer and your zaurus a static IP.
First your zaurus:

Start 'Network' in your Settings dir. Click on the interface 'usbd0' and click configure.

Fill in the Following:

(X) Automatically bring up
( ) DHCP

Static Ip Configuration
IP Address 192.168.129.201
Subnet Mask 255.255.255.0

Leave the rest empty for now.

On your linux computer type the following:
CODE
sudo ifconfig usb0 192.168.129.200 netmask 255.255.255.0 up

This should configure your USB network interface and bring it up. Now we'll try if we can reach the zaurus. We'll do this by pinging it's IP address (the command should be stopped by typing Ctrl-c or it will go on forever):
CODE
user@desktop:~# ping 192.168.129.201
PING 192.168.129.201 (192.168.129.201) 56(84) bytes of data.
64 bytes from 192.168.129.201: icmp_seq=1 ttl=64 time=0.108 ms
64 bytes from 192.168.129.201: icmp_seq=2 ttl=64 time=0.094 ms
64 bytes from 192.168.129.201: icmp_seq=3 ttl=64 time=0.090 ms
64 bytes from 192.168.129.201: icmp_seq=4 ttl=64 time=0.089 ms
64 bytes from 192.168.129.201: icmp_seq=5 ttl=64 time=0.093 ms

--- 192.168.129.201 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3998ms
rtt min/avg/max/mdev = 0.089/0.094/0.108/0.014 ms

Now we will make your configuration permanent. You don't want to type 'ifconfig usb0 192.168.129.200 netmask 255.255.255.0 up' to use your zaurus all the time, and you'll probably just want to stick it in to be able to use it. There are (at least) two ways to accomplish this task:
1. by adding an entry for the usb interface in the file /etc/network/interfaces, or
2. by writing a new udev rule that configures the usb interface

1. The first option is the easiest and, in my opinion, the cleanest. As root, add the following lines to the file /etc/network/interfaces:
CODE
allow-hotplug usb0
mapping hotplug
       script grep
       map usb0

iface usb0 inet static
address 192.168.129.200
netmask 255.255.255.0
pointopoint 192.168.129.201


2. The second option also works, but should be considered a hack. So you'd better skip this one. I will leave it in this post for historical purposes though, since untill I found out about the option printed above this was the only way I could bring up the usb interface automatically. It requires writing a new udev rule that configures the usb interface based on 2 keys: the kernel device name (e.g. usb0) and the driver used, that is 'zaurus'. You actually could omit this key, but then this rule would interfere with other devices with a usb* device name (probably usb networking devices), if you owned such a device. (It appeared that the hardware address used in a previous version of this post changes every other time you reboot your machine. Since the address isn't permanent, it isn't suitable as a key.)

So, as root, create the file /etc/udev/zaurus.rules and add the following line:
CODE
KERNEL=="usb[0-9]*", DRIVER="zaurus", NAME="%k", SYMLINK="zaurus", RUN+="/sbin/ifconfig %k 192.168.129.200 netmask 255.255.255.0 up"


and symlink it to the directory /etc/udev/rules.d:
CODE
$ cd /etc/udev/rules.d
user@desktop:~# sudo ln -s ../zaurus.rules 10_zaurus.rules


Now restart the udev daemon:
CODE
user@desktop:~# sudo /etc/init.d/udev restart

This will ensure that every time your zaurus hits the cradle the network connection will be started.

If your connection to the zaurus often hangs for no apparent reason, consider shrinking the MTU on the zaurus:
CODE
root@zaurus:~# ifconfig usb0 mtu 1000

To make the change permanent, even after rebooting, add the line "mtu 1000" to the section of the usbd0 network interface in the /etc/network/interfaces file.

Folkert van der Beek.


*edit: modified the udev rule, so it won't interfere with other usb networking devices.
*edit2: modified the udev rule to identify the zaurus based on the driver in stead of the hardware address, since the latter apparently changes after every reboot.
*edit3: added the option to modify /etc/network/interfaces, instead of writing an udev rule.
*edit4: added the option to shrink the MTU to prevent freezing connections.
microsoft/linux
what happens if the usbnet driver is built into my kernel. I custom build my kernel, the scripts should still work right?
7_feet_up
QUOTE(microsoft/linux @ Jan 23 2006, 06:49 AM)
what happens if the usbnet driver is built into my kernel. I custom build my kernel, the scripts should still work right?
*

It shouldn't make a difference.
Storm
QUOTE(7_feet_up @ Dec 17 2005, 01:08 PM)
Debian unstable Zaurus USB-network how-to:
Install the latest stock kernel for your machine class e.g.:
CODE
$ sudo apt-get install linux-image-2.6.14-2-686



Excellent howto, 7_feet_up. I have questions, since it does not seem to work for me. I'm running Debian stable on an HP laptop, with kernel 2.6.15 (I just upgraded from 2.6.12, where the problem existed as well). Everything works manually, but although I followed all of the steps to get it to come up automagically, it doesn't.

lsmod shows:

CODE
[riogrande ~]# lsmod | grep zaurus
zaurus                  4096  0
cdc_ether               4352  1 zaurus
usbnet                 11528  2 zaurus,cdc_ether


I also created /etc/udev/zaurus.rules and symlinked it to /etc/udev/rules.d/, and added usb0 to /etc/network/interfaces:

CODE
auto usb0
iface usb0 inet static
       address 192.168.129.1
       pointopoint 192.168.129.1
       netmask 255.255.255.255
       pre-up modprobe zaurus
       post-down rmmod zaurus


When I put the Zaurus in the dock, I get:

CODE
Jan 30 12:59:35 localhost kernel: usb 4-5.4: new full speed USB device using ehci_hcd and address 10
Jan 30 12:59:35 localhost kernel: usb0: register 'zaurus' at usb-0000:00:1d.7-5.4, Sharp Zaurus SL-5x00, 0a:95:46:a6:00:af


At this point, I can bring up usb0 and assign it an address, but it is by no means automatic.

One thing I noticed. The beginning of your /etc/udev/zaurus starts with KERNEL=="usb[0-9]*". Does this look for /dev/usb[0-9]? Because on my system, these devices do not appear. Is this a normal occurrence?

Once I get this up and working, I would like to append something like the following to bring up out-to-the-internet connectivity for the zaurus:

CODE
#!/bin/sh
# Determine external interface.
EXTIF="`/bin/netstat -rn | grep ^0.0.0.0 | awk '{ print $8}'`"
  echo 1 > /proc/sys/net/ipv4/ip_forward
  iptables -t filter -F FORWARD
  iptables -t filter -P FORWARD DROP
  iptables -t filter -A FORWARD -s 192.168.129.0/24 -j ACCEPT
  iptables -t filter -A FORWARD -d 192.168.129.0/24 -j ACCEPT
  iptables -t nat -F PREROUTING
  iptables -t nat -P PREROUTING ACCEPT
  iptables -t nat -F POSTROUTING
  iptables -t nat -P POSTROUTING ACCEPT
  iptables -t nat -F OUTPUT
  iptables -t nat -P OUTPUT ACCEPT
  iptables -t nat -A POSTROUTING -s 192.168.129.0/24 -o $EXTIF -j MASQUERADE


But one step at a time...

--Storm
jan
QUOTE(NickNak @ Sep 14 2005, 06:56 PM)
Using an ethernet bridge to plug your Zaurus into your network seems to me preferable to routing a two-node subnet between your PC and the Z and then using NAT to give the Z access to your network/the internet.
*

Hmm, looks good, but I do need NAT, IP MASQ on the PC because I my internet is via PPP. Can I do netfilter IP MASQ together with bridging?
7_feet_up
QUOTE(Storm @ Jan 30 2006, 11:24 PM)
<snip>
I have questions, since it does not seem to work for me.
<snip>

Sorry about the late reply. I don't regularly check this thread, so you could as well have solved the issue by now. Anyway, I updated the howto. Just delete the udev rule and add the lines to /etc/network/interfaces as described in the howto.
QUOTE(Storm @ Jan 30 2006, 11:24 PM)
Once I get this up and working, I would like to append something like the following to bring up out-to-the-internet connectivity for the zaurus:
<snip>
But one step at a time...

--Storm

To run commands after the interface has been brought up, use the 'up' command in /etc/network/interfaces, and the 'post-down' command after taking the interface down:
CODE
allow-hotplug usb0
mapping hotplug
      script grep
      map usb0

iface usb0 inet static
address 192.168.129.200
netmask 255.255.255.0
pointopoint 192.168.129.201

pre-up modprobe iptable_filter
pre-up modprobe iptable_nat
pre-up modprobe ip_nat_ftp
pre-up modprobe ip_conntrack_ftp
pre-up modprobe ip_conntrack_irc
pre-up modprobe ip_nat_irc
up echo "1" > /proc/sys/net/ipv4/ip_forward
up iptables -t filter -F FORWARD
up iptables -t filter -P FORWARD DROP
up iptables -t filter -A FORWARD -s 192.168.129.0/24 -j ACCEPT
up iptables -t filter -A FORWARD -d 192.168.129.0/24 -j ACCEPT
up iptables -t nat -F PREROUTING
up iptables -t nat -P PREROUTING ACCEPT
up iptables -t nat -F POSTROUTING
up iptables -t nat -P POSTROUTING ACCEPT
up iptables -t nat -F OUTPUT
up iptables -t nat -P OUTPUT ACCEPT
up iptables -t nat -A POSTROUTING -s 192.168.129.0/24 -o usb0 -j MASQUERADE
post-down echo "0" > /proc/sys/net/ipv4/ip_forward
post-down iptables -t nat -F

Folkert.
microsoft/linux
ok, I changed GUIs, after I updated to 3.5.4. Now I can't connect from my PC. I made the settings of usb0 on the Z the same as they were, to no avail. Suggestions?
pgas
PC: windows XP
Zaurus: 860 oz/gpe 3.5.4 2.6 kernel

Connect the zaurus to the pc via usb.

On the zaurus:
Menu -> settings -> usb settings :
Ethernet Networking ok

Menu -> settings -> Network setup
usb0 (NOT usbd0) I change the ip here to 192.168.128.202, in order not to have problems with my other subnets

Menu -> utilities -> Root shell
type in the console:
CODE
modprobe g_ether
ifup usb0

ignore the messages, now when typing `ifconfig' you should see usb0 with the ip set before and hopefully windows should have found a new device, time to set windows.

On the pc:
- save the attached file and rename it linux.inf
- follow the steps here:
http://www.gumstix.org/tikiwiki/tiki-index...ndows_XP_usbnet
( in fact I have included the location of linux.inf and windows did it all by itself)
- at the end right click on the local connection and choose properties
- click on tcpip and properties
- click on Use the following ip address and put 192.168.128.200 (or whatever you have set as a gateway on the zaurus, by default it should be 192.168.0.200)

Voila
GenericAnimeBoy
For those of us poor fools who have to internet connect the Z using the USB b/c we don't have a wifi CF card...

Zaurus:
SL-5500 - OZ 3.5.4 (I'm assuming Opie Image)

PC / Network:
- Windows XP
- Router (Optional?)

Drivers
- Load the original drivers either from the CD or by downloading them from...somewhere. I used the CD. tongue.gif (When the windows add hardware wizard asks for the drivers, just put the CD in and have the wiz look there.)

PC Side Changes
- In order for your Z to be able to see the rest of your network, you need to create a windows network bridge. Open up Network Connnections (with the Z in the cradle and turned on, and drivers installed). Select both the Z's connection and your PC's network connection (by control clicking). Right click, and choose "Create Network Bridge". IIRC, that's it.

Z Side Changes
- To bring up the network interface on the z, you may have to suspend/resume it in the cradle, or restart usbd0, or otherwise baby the device. If you have DHCP (read: your network has a router, as mine does) IP address should configure itself.
- If your only available internet connection for the Z is via USB cradle (not useful for all that much, other than installing packages) it may be in your best interests to install fbvncserver ASAP (as the cradle blocks keyboard). Hunt and peck into console using onscreen keyboard 'ipkg update' then 'ipkg -d <dest> install fbvncserver' then 'ipkg-link mount <dest/packages>'. Reboot (yes, reboot--groan), and launch fbvnc from the console. Connect to your Z's VNC server using a normal VNC client on your PC.
jerrybme
QUOTE(pgas @ Mar 21 2006, 01:42 AM)
PC: windows XP
Zaurus: 860 oz/gpe 3.5.4 2.6 kernel

Connect the zaurus to the pc via usb.

On the zaurus:
Menu -> settings -> usb settings  :
  Ethernet Networking ok

Menu -> settings -> Network setup
  usb0 (NOT usbd0) I change the ip here to 192.168.128.202, in order not to have problems with my other subnets

Menu -> utilities -> Root shell
type in the console:
CODE
modprobe g_ether
ifup usb0

ignore the messages, now when typing `ifconfig' you should see usb0 with the ip set before and hopefully windows should have found a new device, time to set windows.

On the pc:
- save the attached file and rename it linux.inf
- follow the steps here:
http://www.gumstix.org/tikiwiki/tiki-index...ndows_XP_usbnet
( in fact I have included the location of linux.inf and windows did it all by itself)
- at the end right click on the local connection and choose properties
- click on tcpip and properties
- click on Use the following ip address and put 192.168.128.200 (or whatever you have set as a gateway on the zaurus, by default it should be 192.168.0.200)

Voila
*

God I hate windoze, thanks pgas for the above info, it almost works for me except as the XP drivers are being installed the new device dialog locks and I lose my USB mouse. As soon as I disconnect my Z the mouse comes back, but the drivers never completely install. This may be related to the docking station I use at work.
papercrane
The Cxx00 doesn't talk to Windows correctly yet. Richard Purdie "has some hints" which should make it work but he hasn't had time to implement them yet. :-/
Tron
QUOTE(papercrane @ Mar 29 2006, 10:32 PM)
The Cxx00 doesn't talk to Windows correctly yet. Richard Purdie "has some hints" which should make it work but he hasn't had time to implement them yet. :-/

No wonder Windows does not like my borzoi. Ah well, linux works fine, though.

--
YT,
Tron
nick88
Hi,

I followed the shell scripts and can ping and ssh out of the Zaurus, but can't do a wget that ipkg needs using the Opie 3.5.4 images. Any suggestions?
telemetric_au
followed 7_feet_up's guide (thanks) and it would work as far as assigning the ip to usb0, but it seemed the pointopoint command wasnt working as i couldn't ping either way unless i executed the command:

CODE
route add -host 192.168.129.201 usb0


but i wanted this down automatically so i added it into /etc/network/interfaces like so:

CODE
iface usb0 inet static
address 192.168.1.105
netmask 255.255.255.0

post-up route add -host 192.168.1.201 usb0


* adjust your ip's to suit and enjoy ~1-3ms response times biggrin.gif

now onto ICS ...
telemetric_au
well after mucking aroun some i cant get my z to ping past my pc which is connected by ethernet to adsl/router and the interent ...

have put the iptables config commands as suggeste in the interfaces file and is executing but doesnt seem to work

i d like explained this code : specifically the choice of ip's that relevance...

CODE
up iptables -t filter -A FORWARD -s 192.168.129.0/24 -j ACCEPT
up iptables -t filter -A FORWARD -d 192.168.129.0/24 -j ACCEPT
up iptables -t nat -F PREROUTING
up iptables -t nat -P PREROUTING ACCEPT
up iptables -t nat -F POSTROUTING
up iptables -t nat -P POSTROUTING ACCEPT
up iptables -t nat -F OUTPUT
up iptables -t nat -P OUTPUT ACCEPT
up iptables -t nat -A POSTROUTING -s 192.168.129.0/24 -o usb0 -j MASQUERADE
telemetric_au
I GOT IT WORKING !!! --finally after trying every other tech...

(SL-5500 connected via usb cradle to DEBAIN SID connected via ethernet to ADSL router)

with another method briefly touched on in this and most threads.... "bridging"

here's the config: biggrin.gif

first: apt-get install bridge-utils
(this gives you the brctl command)

PC's : /etc/network/interfaces (note: 192.168.1.105 is simply a dummy address to bring usb0 up with and is then reset to 0.0.0.0)

CODE
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 0.0.0.0
netmask 0.0.0.0

auto br0
iface br0 inet dhcp
pre-up brctl addbr br0
pre-up brctl addif br0 eth0
post-down brctl delbr br0

allow-hotplug usb0
mapping hotplug
script grep
map usb0
iface usb0 inet static
address 192.168.1.105
netmask 255.255.255.0
post-up ifconfig usb0 0.0.0.0 up
post-up brctl addif br0 usb0
post-down brctl delif br0 usb0


exec # /etc/init.d/networking restart

alternatively br0 can be assigned manually rather than dhcp from a router etc...

Zaurus's Network Set-up GUI ;

configure usbd0:

CODE
check automatically bring-up
set ip address, subnet, gateway, dns's as needed (with gateway being your pc's assigned ip *(not router), be that for eth0 or what would now be br0)


now as i did a fair bit of mucking around first there may be some of the things prior to this method needed though i dont recon here they are:

on Z; edit /etc/resolv.conf to match your pc's ... and add def gateway commands etc as commonly done, but i think OPZ's GUI setup screen handles that...

cool.gif -can now ping www.google.com ... now onto package management ...

references:

http://www.gumstix.org/tikiwiki/tiki-index...page=Networking
http://www.stolk.org/debian/bluetooth.html
telemetric_au
Just to make life even more sweet, i just set the OPZ GUI network interefaces setup for usbd0 to DHCP,
took it out the cradle put it back in, waited a bit, closed and opened the config applet (to refresh) and it's now been assigned an ip from my router !! smile.gif

and just to check can still ping www.google.com wink.gif

-and the package manager has started working , just updated the package list and about to start checkin' the feed smile.gif
telemetric_au
i just added an updated bridging guide to the wiki:

http://www.oesf.org/index.php?title=Generi...and_Bridging%29
lardman
Please add stuff to the official OZ wiki: http://openzaurus.berlios.de/

Thanks smile.gif


Si
telemetric_au
trying to do it now, but the server is soooo slow...

would also like to be able to upoad images...
NickNak
I have run into problems with my bridging setup: I can log into my SL-5500 using ssh, ping hosts on the internet, download small files using wget, but if I try to download anything bigger than about 1k I get "no response from the server". I have noticed that usb0 on the desktop gets an MTU of 1494 whereas usbd0 at the other end on the Zaurus gets an MTU of 1500. I can't increase usb0 to 1500 on the desktop, but if I decrease usbd0 to 1494 on the Z ('ifconfig usbd0 mtu 1494') the problem is fixed. My question is: why doesn't this 'just work'? Why do usb0 and usbd0 get different MTUs? Is there a bug somewhere, or is there something wrong with my setup?
telemetric_au
sorry, but i have no experience with that problem ... i have seen mention of it elsewhere, either in the wiki or on the boards...
7_feet_up
QUOTE(NickNak @ May 1 2006, 09:17 PM)
I have run into problems with my bridging setup:  I can log into my SL-5500 using ssh, ping hosts on the internet, download small files using wget, but if I try to download anything bigger than about 1k I get "no response from the server".  I have noticed that usb0 on the desktop gets an MTU of 1494 whereas usbd0 at the other end on the Zaurus gets an MTU of 1500. I can't increase usb0 to 1500 on the desktop, but if I decrease usbd0 to 1494 on the Z ('ifconfig usbd0 mtu 1494') the problem is fixed.  My question is: why doesn't this 'just work'?  Why do usb0 and usbd0 get different MTUs? Is there a bug somewhere, or is there something wrong with my setup?
*

I don't know what causes the necessity to shrink the mtu, but the issue has been described before on the usbnet driver page and already has been reported on the kernel bugzilla. I certainly would consider it a bug, either on the zaurus side, or on the desktop side.
NickNak
The "USB Networking" howto submitted by telemetric_au seems to be Debian-specific, maybe the title should reflect that. I have just added a Gentoo-specific howto: http://openzaurus.berlios.de/HowTos/Bridging_with_Gentoo which includes a workaround for the MTU problem I mention above.
telemetric_au
QUOTE(NickNak @ May 5 2006, 08:54 AM)
The "USB Networking" howto submitted by telemetric_au seems to be Debian-specific, maybe the title should reflect that.  I have just added a Gentoo-specific howto: http://openzaurus.berlios.de/HowTos/Bridging_with_Gentoo which includes a workaround for the MTU problem I mention above.
*



would like to get a look at that, but the server wont even load the page...

i do mention what system its setup on...

will look into it more though when can load your page...

good to hear you got it worked smile.gif
telemetric_au
NickNak:

fixed up my title to debian rather than generic,

and gave a link to your page ...

nice guide, i didnt realise there was such difference between the systems...

thanks
benplaut
waiting for an arch tutorial, all you arch users hidden in the shadows wink.gif

anyway, if i figure it out, i'll post tongue.gif
lardman
If someone fancies tidying up the info in this thread and adding it to the OZ wiki (http://openzaurus.berlios.de/ or http://wiki.openzaurus.org/), that would be useful.


Si
speculatrix
I added some stuff which is somewhat 6000 specific, with particular comments about newer 2.6 kernels, to the wiki a while back. Needs proof-reading and/or fixing. HTH
lardman
I'll have a look through, thanks smile.gif


Si
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.