I've attached an external CD/DVD drive to my (headless) RPi and I want to rip an audio CD (using the excellent abcde) every time one is inserted. Ideally, I'd like to do the same with HandBrake on DVDs, but one step at a time.
I did the standard web bashing and could not find a good recipe for this. There seem to be several competing tools of various ages, including halevt and udev. I can't make much sense of the documentation for either and I also find worrying signs of hacky workarounds for basic missing functionality, see the constantly-polling Perl script on this thread:
http://ubuntuforums.org/archive/index.php/t-778250.html
Does anybody know how to use a RPi to launch a shell command on CD insert?
Peter
Re: Action on audio CD insert
I've always thought that udev was current best practice. Not used halevt but have recently played around with udev albeit not on a Raspberry.
Seemed quite straight forward; these URLs were of the most use:
http://www.reactivated.net/writing_udev_rules.html
http://ubuntuforums.org/showthread.php?t=168221
Of particular use is the udevadm tool, referenced in the above links, with command like
The last is useful to emulate the insert of the device. The earlier commands, along with lsusb and the out of /var/log/messages, help to determine the characteristics of the device you are plugging. These are critical to getting the trigger event you require; in my case a USB UART with an XBee module.
I triggered a simply bash script, starting with x+ugo permissions just to get up and running.
Hope this is helpful
Seemed quite straight forward; these URLs were of the most use:
http://www.reactivated.net/writing_udev_rules.html
http://ubuntuforums.org/showthread.php?t=168221
Of particular use is the udevadm tool, referenced in the above links, with command like
Code: Select all
udevadm info -q path -n /dev/ttyUSB0
udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)
udevadm monitor –env
udevadm trigger
I triggered a simply bash script, starting with x+ugo permissions just to get up and running.
Hope this is helpful