I've set up everything on my Mandriva box so that when I plug in my A780, the whole combo goes off to make telnet possible, and automatically mount the phone's samba shares.
Just in case anyone's interested, here are the files required :
/etc/hosts
Code:
--(other stuff)--
192.168.1.2 a780 A780 phone
/etc/hotplug/usb/acm
Code:
#!/bin/bash
cd /etc/hotplug
. hotplug.functions
# env > /tmp/usb-phone-env.log
if [ $PRODUCT = 22b8/3802/0 -a $ACTION = add ] ; then
if ! ps -e | grep sync-phone.sh; then
/usr/local/bin/sync-phone.sh < /dev/null &> /tmp/sync-phone.log &
fi
fi
/usr/local/bin/sync-phone.sh
Code:
#! /bin/sh
echo "$0 is starting..."
# Try to prevent multiple instances of this script...
# 1. by using a lockfile
LOCKFILE=/var/lock/sync-phone.lock
[ -f $LOCKFILE ] && exit 0
trap "rm -f $LOCKFILE" EXIT
touch $LOCKFILE
# 2. by killing newborn duplicates
PCOUNT=`ps -e -C $(basename "$0") | wc -l`
if [ $PCOUNT -gt 1 ]; then
for PID in `ps -C $(basename "$0") -o "%p" | sed -e "1,+1d"`
do
echo "killing newborn duplicate script $PID"
kill $PID
done
fi
# Wait for device to appear
DEVICE=/dev/usb/acm/0
i=1
while [ $i -lt 10 ] ; do
if [ -e $DEVICE ] ; then
i=10
else
echo "Waiting for device $DEVICE to appear..."
sleep 1
i=$(($i + 1))
fi
done
if [ ! -e $DEVICE ] ; then
exit 1
fi
echo "device $DEVICE found"
if fuser -v /dev/dsp; then play /usr/share/sounds/pop.wav; fi
# 1. minicom -> AT+MODE=99, killall minicom
#/usr/bin/runscript /usr/local/share/A780/minicom.script
echo "Starting minicom for phone initialization"
/usr/bin/screen -d -m /usr/local/bin/minicom-usblan.sh
sleep 6
echo "Killing minicom"
killall -9 minicom
# 2. insmod usblan.o vendor_id=0x22b8 product_id=0x600c
echo "Installing usblan kernel module"
/sbin/insmod /usr/local/share/A780/usblan/usblan.o vendor_id=0x22b8 product_id=0x600c
# 3. ifconfig usb0 192.168.1.1
# useless thanks to /etc/sysconfig/network-scripts/ifcfg-usb0
#/sbin/ifconfig usb0 172.16.0.1
# 4. telnet 192.168.1.2 as root AND DO STUFF
# 5. samba shares
echo "Mounting the phone's samba shares"
# try to umount everything, just to make sure
while sleep 1 && umount -lf /mnt/phone/*; do echo "umounting"; done
/bin/mount -o guest,gid=mnt,rw,users,dmask=770 //phone/home /mnt/phone/home
/bin/mount -o guest,gid=mnt,rw,users,dmask=770 //phone/system /mnt/phone/system
if fuser -v /dev/dsp; then play /usr/share/sounds/pop.wav; fi
echo "Starting the umounter watch script"
nohup /usr/local/bin/umount-phone.sh &
/usr/local/bin/umount-phone.sh
Code:
#!/bin/sh
if ! mount | grep /mnt/phone;
then
echo "nothing to do"
exit
fi
while ls /mnt/phone/home >/dev/null
do
# echo "waiting for phone to be unplugged"
sleep 2
done
while sleep 1 && umount -lf /mnt/phone/*; do echo "umounting"; done
if fuser -v /dev/dsp; then play /usr/share/sounds/pop.wav; fi
/usr/local/bin/minicom-usblan.sh
Code:
#!/bin/sh
/usr/bin/minicom usblan
/etc/minirc.usblan
Code:
# Machine-generated file - use "minicom -s" to change parameters.
pr port /dev/ttyACM0
pu baudrate 4800
pu minit ~^M~AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0^MAT+MODE=99^M
(notice the AT+MODE=99 at the end of the init string)
/etc/sysconfig/network-scripts/ifcfg-usb0
Code:
DEVICE=usb0
BOOTPROTO=static
IPADDR=192.168.1.10
NETMASK=255.255.255.0
NETWORK=192.168.1.0
BROADCAST=192.168.1.255
ONBOOT=no
Here you are, this is my basic setup. I hope that'll help.
As soon as possible, I'll add automatic backup / synchronization to this stuff. But first I have to locate where on the phone are stored the SMS, contact and agenda... If you have any suggestions, let me know.