| Never Sync your PDA Again! | |
|---|---|
| Description: You'll always have access to all your Linux iPAQ apps and data while never seeing a hotsync again, with the tips in this tutorial. | |
|
|
| HowTo manage your iPAQ from the desktop | |
As a Palm Pilot and Clie user I was always satisfied with the J-Pilot Desktop Organizer, a Unix alternative to the Palm Desktop software. However, I was also a little ill-at-ease using J-Pilot or other "desktop" versions of PDA management and data entry software. Using this arrangement meant having two distinct programs for every application (e.g. the desktop calendaring system and the actual PDA calendar program) and required a distinct conduit to synchronize data in both directions (changes on the desktop must be merged with, possibly conflicting, changes on the PDA). This is a major downside: some applications simply don't have a conduit or appropriate plug-in meaning that, while they can be backed up along with the rest of the system, they simply can not be managed from the desktop. Having recently purchased an iPAQ and upgraded the OS from Wince(tm) to Familiar Linux, all these issues have vanished. Thanks to the power of Linux, SSH tunnels and X, it is possible to avoid ever needing to "sync" your PDA--instead, you always run your apps remotely, directly on the iPAQ, and display them using your local desktop's X server. The image above is a screenshot of my desktop displaying various apps running on the ipaq (click it for a close-up). From left to right you can see:
This is but a sample -- using this setup, anything that can be run on your iPAQ can be used from the comfort of your desktop's keyboard and mouse. In the following, we'll cover:
RequirementsYou'll need the following to get started:
SSH SetupIn order to use X apps running on the iPAQ from your desktop system through SSH, you need to ensure that SSH is setup correctly. A quick test you can perform is connecting from your desktop (while running X) to another Linux system with X installed and attempting to run an app. Simply login to the remote system: $ ssh myuser@remotehostand then run a graphical application, e.g. xcalc If, after a few moments, a calculator appears on your screen, then all is well and you can move on to the next section. If, on the other hand, the system hangs for a while and produces an error message or just exits silently without any output, you may have an issue forwarding X connections. You can start by checking your SSH configuration. The ssh_config file controls the behavior of your ssh client (often found in /etc/ssh/ssh_config). Check man 5 ssh_config for full details of the config file format. You can start by trying to set: ForwardX11 yes ForwardX11Trusted yes ForwardAgent yesin your ssh_config file. Make this change, log in to the remote host and perform the test above. If it works--hurray!--move on to the next section. If you still can't get the calculator (or whatever) displayed on your local host, try:
If nothing works, you're stuck here: it will be impossible to run apps from the iPAQ until you get this working. Contact your local guru or newsgroup for help. USB Net setupNow we can perform the steps required to log into the iPAQ over the USB port. Start by ensuring your system has the usbnet module. A quick "locate usbnet" should reveal the presence of the module on your system (it's there by default, at least with Fedora). Configure your system to bring up the usb device. On Fedora/RedHat type systems, this involves creating a /etc/sysconfig/network-scripts/ifcg-usb0 file with the following contents: # USB configuration for IPAQ DEVICE=usb0 BOOTPROTO=static IPADDR=192.168.0.200 NETMASK=255.255.255.0 NETWORK=192.168.0.0 BROADCAST=192.168.0.255 ONBOOT=yes MII_NOT_SUPPORTED=no For Debian, you'd instead add a similar section to /etc/interfaces, something like: iface usb0 inet static address 192.168.0.200 netmask 255.255.255.0 broadcast 192.168.0.255should do the trick. The values set for the IP address above actually depend on your settings on the iPAQ. You can verify and change these through the "Settings -> Network Setup -> usbf" interface. Just make sure these settings match those configured on your desktop. The desktop and iPAQ must be on the same subnet (as specified by the Address and Netmask settings on the iPAQ) and the iPAQ's Gateway setting should be the IP you've assigned to the usb0 interface on the desktop. Turn the iPAQ on and stick it in its cradle. I can usually hear some harddrive activity at this point, telling me the USB device has been detected. Issuing an "lsusb" should confirm this. Now bring the device up, by doing a ifup usb0If all goes well, there won't be any error output and control will be returned to the terminal after a short delay. If instead you have a message to the effect that Device usb0 does not seem to be present, delaying initialization.then leave the iPAQ in the craddle and try doing: # rmmod uhci_hcd # modprobe uhci_hcd # ifup usb0 One final setup step that makes life more enjoyable is editing your desktop's /etc/hosts file to add an entry for the iPAQ, thereby avoiding the need to type the I.P. address all the time. Just add a 192.168.0.202 usbipaqline to the file and save. It's now time to actually SSH into your iPAQ. All you need now is to issue: ssh myipaquser@usbipaqreplacing the username and iPAQ hostname as appropriate. After a few seconds (sometimes more), you should see a password prompt. Enter it, and you're in! Running AppsFrom here, you can perform all the usual console-goodness. In addition, you'll be able to run all those PIM applications that make the Linux iPAQ so useful. From the command line, you won't have access to your graphical menu so you need to know the names of the applications you want to run. A few useful PIM related apps installed by default are:
Run these in the background from the shell, and they'll display on your desktop. E.g. $ gpe-calendar & If you are running console-based applications on the iPAQ in your terminal through SSH, such as vi or mec (microEMACS), the screen sometimes gets messed up. A quick fix for this is usually just to resize the window (maximize it and then return it to its original size). Connecting to the Outside WorldWhether it is to install new packages, organize your dillo bookmarks or something else, you'll eventually want to connect to your local LAN or to the Internet from your iPAQ. Doing this while SSHed into the craddle-bound handheld is efficient and easy. Since you can SSH into your iPAQ, it is already part of a small two-node network formed by your desktop and the PDA. Additionally, your iPAQ is already configured to use the desktop as its gateway, meaning that any request from the iPAQ for an IP other than the desktop is handed to the desktop anyway. At this point, your desktop system probably just drops those packets on the floor, dashing your poor iPAQ's hopes of making new network friends. This is easily resolved thanks to the power of root and IP masquerading. We are going to configure the desktop system such that any packets it receives from the iPAQ that are bound for another system, are forwarded to its own gateway, after proper massaging. To the outside world, these packets will look like any other that come from your system, which can be very useful. For instance, when connected through usbnet, your iPAQ will be able to mount any NFS share that your desktop has permission to mount. All we need to do is instruct the desktop system allow packet forwarding and masquerade those packets from the iPAQ. This involves issuing the following commands, as root: # echo 1 > /proc/sys/net/ipv4/ip_forward # iptables -t nat -A POSTROUTING -p tcp -o eth0 -s 192.168.0.202/32 -j MASQUERADE # iptables -t nat -A POSTROUTING -p udp -o eth0 -s 192.168.0.202/32 -j MASQUERADEReplacing eth0 with the desktop's outbound interface. Performing PDA BackupsThere are numerous advantages to using your iPAQ directly and avoiding the need to sync with an external program: all your applications are available and there is absolutely no danger of synchronization issues since there is a single, authoritative, source of data and that is the iPAQ itself. There is, however, a downside to this: a lack of redundancy. In effect, since all the data is held on the PDA there is The remedy is making regular backups. On a daily basis, you'll use remote apps over SSH to manage your device from the desktop but you need to make backups in order to ensure the integrity of your information.
The backups we will create here are exact duplicates of the PDA flash memory. There are therefore always the same size (16M for an h3600, 32M for a h3765 device, etc.). Under certain circumstances, these images may be used to restore the device completely, however they may always be used to retrieve files from backups. The easiest method I've used is to perform the backup over NFS, to a remote drive. This same technique may be used to save the image to a compact flash or other device. If you have access to an NFS partition, or you configure your desktop to export a partition through NFS that may be mounted by your USB-connected iPAQ, a script as simple as this will suffice: #!/bin/sh MOUNTPOINT=/mnt/backups mount remotehostname:/path/to/remote/part /mnt/backups -t nfs dd if=/dev/mtdblock/1 of=$MOUNTPOINT/ipaq-backup.jffs2 For more info on performing iPAQ backups, retrieving files and restoring from these backups please see the (upcoming, sorry!) iPAQ backup tutorial. |
|
| Level: | Article |
| Additional Article Data | |
| Level: | Tutorial |
| Comments |
|---|
|
|
|
The comments are owned by the poster. We aren't responsible for their content.
|
| Jump to section |
|---|


