Ubuntu: Auto-run script when iPad plugged in



Question:

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

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: https://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

I have tried this:

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

and also this:

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

~/bin/jobdone2 is a script that plays an mp3 file. I have tested that it works (by using alt+f2 and then typing ~/bin/jobdone2).

So far, when I plug the iPad in, nothing happens.

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)  


Solution:1

Try changing ATTRS to ATTR for vendor and product


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »