Capturing the USB event

Somdutt B. Patnaik somdutt at cs.columbia.edu
Tue Jan 10 15:56:42 PST 2006


Hello All,

I am currently working on a project that needs me to capture a USB 
device insertion event and copy a file from the usb device onto a 
locally mounted disk drive. To do this I added my own script as 
/sbin/myloader and added appropriate mount and copy commands to it. I 
created a symbolic link to this script from 
/etc/hal/decice.d/60-myloader.hal -> /sbin/myloader.

Obviously I need to run myloader after the fstab-sync operation. So I 
added it in the device.d folder after 50-fstab-sync.hal. Should this do 
my job? If yes, however, I am facing some problems. If I restart the 
daemon after inserting the USB device my script does its job and things 
are fine. However, once haldaemon is restarted and I umount, remove, and 
re-insert the USB device, things do not work. That is, my script is 
triggered only when I restart hald. Am I correct in my approach?...Any 
help would be great.

Thanks in advance,
~somdutt


More information about the hal mailing list