Last week I was faced with a problem, which had its origin in the good old world of optical media. I’m running a XMBC desktop environment, fully equipped, even with a DVD drive. But since last week there was no need for that drive. Then my girlfriend had the idea to organize an girls evening, DVD watching included. I gave it a try…
Current situation
XMBCbuntu version 13.0 running on a Fujitsu-Siemens low energy desktop system
Problem description
Every time a optical media is inserted into the drive, it starts to spin the CD/DVD at maximum speed. It doesn’t slow down the whole time.
Workaround
Running the command
$ eject -x 4 /dev/sr0
in the terminal slows down the speed to 4x immediately. sr0 is what the devices cdrom and dvd are symlinked to on my machine. But since every time the drive is opened/closed the drive will be spinning with maximum speed again, you have to dig deeper into the matter. As you can see it is necessary to identify if the drive was opened/closed. Therefore edit the following udev rule:
vi /etc/udev/rules.d/70-persistent-cd.rules
Find the corresponding drive and add an ACTION property as well as a RUN property like this:
# HL-DT-STDVD-ROM_DH10N (pci-0000:00:1f.2-scsi-0:0:0:0) SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.2-scsi-0:0:0:0", SYMLINK+="dvd", ENV{GENERATED}="1", ACTION=="change", RUN+="/usr/local/bin/slow_down_od.sh"
Then create the script that was just mentioned in the udev rule to be executed every time a disc is inserted.
$ vi /usr/local/bin/slow_down_od.sh
Content:
#!/bin/bash eject -x 4 /dev/sr0
Make it executable:
$ chmod +x /usr/local/bin/slow_down_od.sh