I use following simple script to connect to the net with my OvisLink AirLive 802.11b Wireless LAN CF card. It's because I am using more networks and there is not yet any support for a decent automatic wlan roaming. Playing with power saving will increase battery life from about 3 hours to at least 7 hours with wlan on. It does not solve restore on wakeup, so you have to fire it again then.
#!/bin/sh # Loading module not needed unles you force-unloaded it. modprobe hostap_cs # Upload firmware with WPA support. May vary for different card models. # Also primary firmware upload may have a meaning for power saving. prism2_srec -p -r rf010804.hex # Set my essid. I have one script per essid. iwconfig wlan0 essid UTX # Set nick. Cosmetical. iwconfig wlan0 nick Zaurus # wpa.conf contains encrypted passwords for all my WPA-enabled providers. wpa_supplicant -B -i wlan0 -c /etc/wpa.conf -D hostap # Start DHCP client udhcpc -i wlan0 # And turn old power saving: # Version for older systems: #iwconfig wlan0 power saving 999 #iwconfig wlan0 power period 3 #iwconfig wlan0 power timeout 300u # Version for latest system: iwconfig wlan0 power 300u
And this is the reversed version of the last script.
#!/bin/sh # Stop services. killall udhcpc # Turn power saving off before stopping the card to prevent possible errors. iwconfig wlan0 power off # Turn the card off. ifconfig wlan0 down # And do the rest. killall wpa_supplicant echo -n "Remove card and press enter." read DELAY rmmod hostap_cs
These scripts start a simple point-to-point networking over USB.
On Zaurus:
#!/bin/sh # Remove USB host modules. rmmod ohci-hcd 2>/dev/null # Remove also USB client modules. Without this, it sometimes fails to work after resume. ifconfig usb0 down rmmod g_ether 2>/dev/null rmmod pxa27x_udc 2>/dev/null sleep 1 # Load modules. modprobe pxa27x_udc modprobe g_ether # And set standard addresses. ifconfig usb0 192.168.129.201 netmask 255.255.255.255 up route add -host 192.168.129.1 usb0 route add default gw 192.168.129.1 cat >/etc/resolv.conf <<EOF search fill_your_domain_here nameserver fill_your_name_server_here EOF
On Linux host run after you plug the cable:
#!/bin/sh # This module should be loaded on plug-in, but is not if you have another usbnet device. modprobe zaurus sleep 1 # Fire the network. ifconfig usb1 192.168.129.1 netmask 255.255.255.255 up route add -host 192.168.129.201 usb1 # And enable masquerade to allow Zaurus to connect to Internet. iptables -t nat -A POSTROUTING -o eth1 -s 192.168.129.0/24 -d 0/0 -j MASQUERADE iptables -A FORWARD -s 192.168.129.0/24 -d 0/0 -j ACCEPT echo 1 >/proc/sys/net/ipv4/ip_forward
This script switches from USB client mode to USB master:
#!/bin/sh # Stop possible USB networking to release g_ether lock ifconfig usb0 down 2>/dev/null # Remove USB client modules rmmod g_file_storage g_ether pxa27x_udc 2>/dev/null # Load USB master module modprobe ohci-hcd
Ipkg has very rudimentary support for locales installation. Following command will try to install all available locale packages. Needs bash. You need to change name of your locale:
#!/bin/bash ipkg install $(ipkg list_installed | sed 's/ .*/-locale-cs/') >/dev/null
If you want to update your system often from scratch, you may want to install the same package set afterwards. Use following simple script instead of plain ipkg (saves list to the working directory and needs bash):
#!/bin/bash
for PKG in "$@" ; do
echo "$PKG" >>ipkginstall.lst
done
ipkg install $(<ipkginstall.lst)