[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[coldsync-hackers] HotSync on pressing HotSync button on Visor



Hi there,

Yesterday I hacked sth. togethert, which might be useful to some
of you.

Linux (as of 2.4.x) has support for hotplugging in general and
hotplug usb devices in particular.

I abused the fact, that the Visor cradle becomes visible on the
USB bus only, if you press the hotsync button.

So I use this script (as /sbin/hotplug replacement ):

#!/bin/bash
CS_USER=ioe
CS_PATH=/usr/local/bin

function handle_usb_actions() {
   case $ACTION in
      add)
         case $PRODUCT in
            # Visor cradle USB vendor and device ids are us!
            82d/100/*)
               logger "Starting ColdSync for visor of $CS_USER..."
               su $CS_USER - -c "$CS_PATH/coldsync -l /home/$CS_USER/cslog"
               logger "done synching visor of $CS_USER"
            ;;
            *)
            logger "unknown usb product added \"$PRODUCT\""
         esac
      ;;
      remove)
      ;;
      *)
      logger "unknown hotplug action \"$ACTION\""
   esac 
}

case $1 in
   usb)
      handle_usb_actions
   ;;
   *)
      logger "unknown hotplug bus \"$1\""
esac

I would like to generalize this for more than one user, but I
found no way to select the right local user (and su to him and
chdir into his home directory) using a visor and coldsync, so I
harcoded these into the script.

Regards

Ingo Oeser
-- 
Use ReiserFS to get a faster fsck and Ext2 to fsck slowly and gently.
This message was sent through the coldsync-hackers mailing list.  To remove
yourself from this mailing list, send a message to majordomo@thedotin.net
with the words "unsubscribe coldsync-hackers" in the message body.  For more
information on Coldsync, send mail to coldsync-hackers-owner@thedotin.net.