Usb Connection Howto, Windows & Linux - OE specific
Usb Connection Howto, Windows & Linux - OE specific
Apr 7 2005, 06:03 AM
Joined: 25-October 03
From: Bath, UK
Member No.: 464
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)
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.
Dec 17 2005, 09:08 AM
Joined: 19-April 05
Member No.: 6,917
Debian unstable Zaurus USB-network how-to:
Install the latest stock kernel for your machine class e.g.:
user@desktop:~# sudo apt-get install linux-image-2.6.14-2-686
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:
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:
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.
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
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:
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):
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:
iface usb0 inet static
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:
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:
$ cd /etc/udev/rules.d
user@desktop:~# sudo ln -s ../zaurus.rules 10_zaurus.rules
Now restart the udev daemon:
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:
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.
|Lo-Fi Version||Time is now: 28th March 2015 - 06:23 AM|