#!/bin/sh # # pilot-xfer-bt: start pilot-xfer over Bluetooth # Paul Walmsley 20071220 # Fix for filenames with spaces by Carl Witty 20080610 # # To use, first change the RFCOMM path below if necessary - this script # requires pilot-xfer 3.23 or greater to work reliably. Then use # this script as you would use pilot-xfer. For example, to sync your Palm, # run ./pilot-xfer-bt -s # To install a PRC on your Palm, run ./pilot-xfer-bt -i # # For this to work at all, your Palm and your Linux/BSD/whatever box must be # paired via Bluetooth. You also need to be running sdpd; on my machine this # is started by /etc/init.d/bluetooth at boot. # # For this to work reliably, you *need* to be using the rfcomm binary from # bluez-utils 3.23 or greater. Anything less will flake sporadically as # rfcomm was too impatient to wait for the device to be created. To find # out what rfcomm version you're running, run 'rfcomm --help'. At the moment, # most people will probably need /usr/local/bin/rfcomm below. # RFCOMM_PATH=rfcomm # ############################# # # Items you are unlikely to need to change # # Bluetooth interface device name - run 'hciconfig' to find this BT_IF=hci0 # # Change this line if your RFCOMM devices show up in some nonstandard # directory. RFCOMM_DEVPATH=/dev # # Change this line if you are already using rfcomm22 RFCOMM_DEV=rfcomm22 # # This seems to be the default HotSync channel. DEFAULT_HOTSYNC_RFCOMM_CHANNEL=22 # # Change this line if you use a custom pilot-xfer PILOT_XFER_PATH=pilot-xfer # ############################## # # First, check the rfcomm ver and make sure it's recent enough RFCOMM_VER=`$RFCOMM_PATH --help | head -1 | cut -f5 -d' ' | sed 's/\.//'` if [ $RFCOMM_VER -lt 323 ]; then echo This script requires RFCOMM 3.23 or greater to work. Update echo your bluez-utils package or download and compile the version at echo http://www.bluez.org/download.html exit 254 fi # hciconfig $BT_IF auth encrypt secure # # Add a HotSync record to the local SDP service, or use the existing one. OUR_SDP_REC=0 CURR_HOTSYNC_RFCOMM_CHANNEL=`sdptool search --bdaddr local HotSync | grep Channel | cut -f2 -d:` if [ -z $CURR_HOTSYNC_RFCOMM_SDP_CHANNEL ]; then sdptool add --channel $DEFAULT_HOTSYNC_RFCOMM_CHANNEL hotsync CURR_HOTSYNC_RFCOMM_CHANNEL=$DEFAULT_HOTSYNC_RFCOMM_CHANNEL SDP_REC_EXISTED=1 fi # # Start pilot-xfer when the Palm device connects. $RFCOMM_PATH listen $RFCOMM_DEV $CURR_HOTSYNC_RFCOMM_CHANNEL $PILOT_XFER_PATH -p $RFCOMM_DEVPATH/$RFCOMM_DEV "$@" # # Remove the HotSync service record from sdpd now that we are done with it # if [ $OUR_SDP_REC ]; then RECHANDLE=`sdptool search --bdaddr local HotSync | grep RecHandle | cut -d: -f2` sdptool del $RECHANDLE fi