Auto-run script when iPad plugged in

Posted by oldmankit on Ask Ubuntu See other posts from Ask Ubuntu or by oldmankit
Published on 2012-07-14T03:45:30Z Indexed on 2012/11/02 17:32 UTC
Read the original article Hit count: 270

Filed under:
|

The way that Ubuntu handles documents on the iPad is awesome (without any configuration required). It beats windows, even after you install iTunes.

I want to have the documents in certain iPad apps automatically synced into my Dropbox directory whenever the iPad is connected by USB. The syncing is easy; getting the script to run is not.

I have already read the information in various (very out-of-date) tutorials. The best I could find was here: http://askubuntu.com/a/25091/16157

I used lsusb, with the following results: Bus 002 Device 012: ID 05ac:12a2 Apple, Inc.

(Please note that when an iPad is connected, Ubuntu seems to mount it to two different mount points: one for "Documents" and one for the whole iPad filesystem. They are both mounted in ~/.gvfs)

I have created the following file /etc/udev/rules.d/96-ipad_sync.rules

ACTION=="add", ATTRS{idVendor}=="05ac", ATTRS{idProduct}=="12a2", RUN+="/home/kit/bin/jobdone2"

I want it to run a test script (which sleeps for five seconds then plays an mp3 file. The test script works, and I have typed the location correctly).

So far, when I plug the iPad in, nothing happens. Yes, I waited five seconds.

This is the output I get from typing udevadm monitor –env

KERNEL[29348.114010] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4 (usb)
KERNEL[29348.114844] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:1.0 (usb)
KERNEL[29348.129118] remove   /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:1.0 (usb)
KERNEL[29348.130699] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:4.0 (usb)
KERNEL[29348.130845] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:4.1 (usb)
KERNEL[29348.130909] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:4.2 (usb)
UDEV  [29348.163861] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4 (usb)
UDEV  [29348.170390] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:1.0 (usb)
UDEV  [29348.171521] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:4.1 (usb)
UDEV  [29348.172230] remove   /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:1.0 (usb)
UDEV  [29348.172890] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:4.2 (usb)
UDEV  [29348.175645] add      /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:4.0 (usb)

© Ask Ubuntu or respective owner

Related posts about udev

Related posts about iPad