Sunday, October 4, 2009

udev rules for firing up a phone manager on Debian

I just got udev rules working for adding and removal of my Sony Eriksson W760i on Debian Linux. It was a real swine to get working : primarily because of the lack of info about X issues when calling scripts from the udev process. Anyway here is how its done:

1) Create a local udev script file:


ACTION=="add",KERNEL=="ttyACM0",SUBSYSTEM=="tty",ATTRS{product}=="Sony Ericsson W760",ATTRS{serial}=="3570670210310730",RUN+="/home/shamrock/bin/phonelaunch",SYMLINK+="w760i"

2) Script to lauch Wammu

export HOME = /home/shamrock
set -x
xhost local:shamrock
export DISPLAY=:0.0
cd /home/shamrock
su shamrock -c "/usr/bin/wammu &"

3) Script to clean up on removal

su shamrock -c "pkill wammu"

The details for the udev rules came from running:

sudo udevadm info --name=/dev/ttyACM0 --query=all --attribute-walk


No comments:

Post a Comment