OESF Portables Forum

Everything Else => Zaurus Distro Support and Discussion => Distros, Development, and Model Specific Forums => Archived Forums => Angstrom & OpenZaurus => Topic started by: lardman on April 07, 2005, 10:03:30 am

Title: Usb Connection Howto
Post by: lardman on April 07, 2005, 10:03:30 am
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.
Title: Usb Connection Howto
Post by: lardman on April 07, 2005, 10:07:26 am
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.

https://www.oesf.org/forums/index.php?showt...indpost&p=73169 (https://www.oesf.org/forums/index.php?showtopic=11320&view=findpost&p=73169)


Si
Title: Usb Connection Howto
Post by: darac on April 13, 2005, 04:45:56 pm
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: [Select]
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: [Select]
#! /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: [Select]
# 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.
Title: Usb Connection Howto
Post by: gfdsa on April 14, 2005, 12:58:02 pm
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://ezaurus.com/bzsolution/download/SL6...SL6000Setup.exe)
http://www.gfdsa.org/~gfdsa/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
Title: Usb Connection Howto
Post by: jancici on April 17, 2005, 05:30:35 pm
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
Title: Usb Connection Howto
Post by: lardman on April 18, 2005, 04:10:33 am
Start a seperate thread please, this thread is just for reference purposes.

Si

P.S.

Say which machine you have - it'll help people.
Title: Usb Connection Howto
Post by: lardman on April 18, 2005, 05:13:08 am
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 (http://www.zaurususergroup.org/UpDownload+index-req-getit-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.
Title: Usb Connection Howto
Post by: obergix on May 18, 2005, 04:15:00 am
Quote
Add the following to /etc/network/interfaces:
Code: [Select]
# 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.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=75016\"][{POST_SNAPBACK}][/a][/div]

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
Title: Usb Connection Howto
Post by: dansawyer on May 26, 2005, 09:56:16 am
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
Title: Usb Connection Howto
Post by: niv on June 19, 2005, 09:48:48 pm
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
Title: Usb Connection Howto
Post by: charcler on August 04, 2005, 11:50:10 pm
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 !
Title: Usb Connection Howto
Post by: ajaygautam on August 11, 2005, 02:47:51 pm
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: [Select]
# 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
Title: Usb Connection Howto
Post by: NickNak on September 14, 2005, 12:56:39 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. Details of how to do it are at the usbnet website (http://www.linux-usb.org/usbnet/#bridge). 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: [Select]
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: [Select]
/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: [Select]
rc-update del net.eth0
 rc-update add net.br0 default
Title: Usb Connection Howto
Post by: Headrush on September 19, 2005, 06:11:22 pm
Quote
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 (http://www.linux-usb.org/usbnet/#bridge). 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: [Select]
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: [Select]
/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: [Select]
rc-update del net.eth0
 rc-update add net.br0 default
[div align=\"right\"][a href=\"index.php?act=findpost&pid=95837\"][{POST_SNAPBACK}][/a][/div]
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?
Title: Usb Connection Howto
Post by: NickNak on September 19, 2005, 06:31:31 pm
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.
Title: Usb Connection Howto
Post by: Headrush on December 04, 2005, 03:41:48 pm
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: [Select]
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?
Title: Usb Connection Howto
Post by: lardman on December 05, 2005, 06:32:48 am
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.
Title: Usb Connection Howto
Post by: 7_feet_up on December 17, 2005, 12:08:09 pm
[span style=\'font-size:14pt;line-height:100%\']Debian unstable Zaurus USB-network how-to:[/span]
Install the latest stock kernel for your machine class e.g.:
Code: [Select]
user@desktop:~# sudo apt-get install linux-image-2.6.14-2-686Reboot.
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: [Select]
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: [Select]
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: [Select]
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: [Select]
sudo ifconfig usb0 192.168.129.200 netmask 255.255.255.0 upThis 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: [Select]
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: [Select]
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: [Select]
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: [Select]
$ cd /etc/udev/rules.d
user@desktop:~# sudo ln -s ../zaurus.rules 10_zaurus.rules

Now restart the udev daemon:
Code: [Select]
user@desktop:~# sudo /etc/init.d/udev restartThis 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: [Select]
root@zaurus:~# ifconfig usb0 mtu 1000To 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.

[span style=\'font-size:8pt;line-height:100%\']
*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.
[/span]
Title: Usb Connection Howto
Post by: microsoft/linux on January 23, 2006, 12:49:50 am
what happens if the usbnet driver is built into my kernel. I custom build my kernel, the scripts should still work right?
Title: Usb Connection Howto
Post by: 7_feet_up on January 24, 2006, 06:00:13 am
Quote
what happens if the usbnet driver is built into my kernel. I custom build my kernel, the scripts should still work right?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=112017\"][{POST_SNAPBACK}][/a][/div]
It shouldn't make a difference.
Title: Usb Connection Howto
Post by: Storm on January 30, 2006, 05:24:42 pm
Quote
[span style=\'font-size:14pt;line-height:100%\']Debian unstable Zaurus USB-network how-to:[/span]
Install the latest stock kernel for your machine class e.g.:
Code: [Select]
$ 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: [Select]
[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: [Select]
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: [Select]
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: [Select]
#!/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
Title: Usb Connection Howto
Post by: jan on February 19, 2006, 03:51:18 pm
Quote
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.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=95837\"][{POST_SNAPBACK}][/a][/div]
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?
Title: Usb Connection Howto
Post by: 7_feet_up on March 20, 2006, 04:24:27 pm
Quote
<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
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: [Select]
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.
Title: Usb Connection Howto
Post by: microsoft/linux on March 21, 2006, 12:11:13 am
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?
Title: Usb Connection Howto
Post by: pgas on March 21, 2006, 02:42:21 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: [Select]
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 (http://www.gumstix.org/tikiwiki/tiki-index.php?page=Windows_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
Title: Usb Connection Howto
Post by: GenericAnimeBoy on March 22, 2006, 01:34:07 am
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.    (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.
Title: Usb Connection Howto
Post by: jerrybme on March 24, 2006, 10:05:11 am
Quote
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: [Select]
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 (http://www.gumstix.org/tikiwiki/tiki-index.php?page=Windows_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
[div align=\"right\"][a href=\"index.php?act=findpost&pid=119530\"][{POST_SNAPBACK}][/a][/div]
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.
Title: Usb Connection Howto
Post by: papercrane on March 29, 2006, 03:32:03 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. :-/
Title: Usb Connection Howto
Post by: Tron on April 04, 2006, 04:25:39 am
Quote
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
Title: Usb Connection Howto
Post by: nick88 on April 06, 2006, 09:20:28 pm
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?
Title: Usb Connection Howto
Post by: telemetric_au on April 17, 2006, 10:33:51 am
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: [Select]
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: [Select]
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  

now onto ICS ...
Title: Usb Connection Howto
Post by: telemetric_au on April 17, 2006, 11:11:25 am
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: [Select]
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
Title: Usb Connection Howto
Post by: telemetric_au on April 18, 2006, 08:17:43 am
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:  

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: [Select]
# 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: [Select]
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...

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

references:

http://www.gumstix.org/tikiwiki/tiki-index...page=Networking (http://www.gumstix.org/tikiwiki/tiki-index.php?page=Networking)
http://www.stolk.org/debian/bluetooth.html (http://www.stolk.org/debian/bluetooth.html)
Title: Usb Connection Howto
Post by: telemetric_au on April 18, 2006, 08:44:59 am
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 !!

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

-and the package manager has started working , just updated the package list and about to start checkin' the feed  
Title: Usb Connection Howto
Post by: telemetric_au on April 28, 2006, 07:25:18 pm
i just added an updated bridging guide to  the wiki:

https://www.oesf.org/index.php?title=Generi...and_Bridging%29 (https://www.oesf.org/index.php?title=Generic_%28USB_w/_DHCP_and_Bridging%29)
Title: Usb Connection Howto
Post by: lardman on April 29, 2006, 06:03:21 pm
Please add stuff to the official OZ wiki: http://openzaurus.berlios.de/ (http://openzaurus.berlios.de/)

Thanks


Si
Title: Usb Connection Howto
Post by: telemetric_au on April 29, 2006, 06:25:16 pm
trying to do it now, but the server is soooo slow...

would also like to be able to upoad images...
Title: Usb Connection Howto
Post by: NickNak on May 01, 2006, 04:17:42 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?
Title: Usb Connection Howto
Post by: telemetric_au on May 02, 2006, 07:09:19 pm
sorry, but i have no experience with that problem ... i have seen mention of it elsewhere, either in the wiki or on the boards...
Title: Usb Connection Howto
Post by: 7_feet_up on May 03, 2006, 06:32:57 am
Quote
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?
[div align=\"right\"][{POST_SNAPBACK}][/a][/div] (http://index.php?act=findpost&pid=125323\")
I don't know what causes the necessity to shrink the mtu, but the issue has been described before [a href=\"http://www.linux-usb.org/usbnet/]on the usbnet driver page[/url] and already has been reported on the kernel bugzilla (http://bugzilla.kernel.org/show_bug.cgi?id=5744). I certainly would consider it a bug, either on the zaurus side, or on the desktop side.
Title: Usb Connection Howto
Post by: NickNak on May 04, 2006, 05:54:42 pm
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 (http://openzaurus.berlios.de/HowTos/Bridging_with_Gentoo) which includes a workaround for the MTU problem I mention above.
Title: Usb Connection Howto
Post by: telemetric_au on May 04, 2006, 07:04:07 pm
Quote
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 (http://openzaurus.berlios.de/HowTos/Bridging_with_Gentoo) which includes a workaround for the MTU problem I mention above.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=125779\"][{POST_SNAPBACK}][/a][/div]


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
Title: Usb Connection Howto
Post by: telemetric_au on May 04, 2006, 07:20:20 pm
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
Title: Usb Connection Howto
Post by: benplaut on July 18, 2006, 10:51:52 pm
waiting for an arch tutorial, all you arch users hidden in the shadows

anyway, if i figure it out, i'll post
Title: Usb Connection Howto
Post by: lardman on July 19, 2006, 06:32:13 am
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/) (http://wiki.openzaurus.org/)), that would be useful.


Si
Title: Usb Connection Howto
Post by: speculatrix on October 10, 2006, 09:38:36 am
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
Title: Usb Connection Howto
Post by: lardman on October 10, 2006, 10:54:54 am
I'll have a look through, thanks


Si