summaryrefslogtreecommitdiff
path: root/extras/cdrom_id
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2011-04-04 11:47:54 +0200
committerMartin Pitt <martin.pitt@ubuntu.com>2011-04-04 11:47:54 +0200
commit55eb500cc5465babf1fd773dbcceeb90eeefd997 (patch)
tree49b19dd6b031a1ad19a8d84f37d3fdfbe0d78dd2 /extras/cdrom_id
parent9bb54267a1483e8f3b2de352c7be433f625e5606 (diff)
Avoid spinning up CD on pressing eject button
When the CD tray door is locked and the hardware eject button is pressed, newer kernels (2.6.38+) will send out a change event with a DISK_EJECT_REQUEST==1 property. Do not run cdrom_id and blkid in this case, as the media state and contents does not change, and this only needlessly spins up the drive again right before ejection.
Diffstat (limited to 'extras/cdrom_id')
-rw-r--r--extras/cdrom_id/60-cdrom_id.rules3
1 files changed, 3 insertions, 0 deletions
diff --git a/extras/cdrom_id/60-cdrom_id.rules b/extras/cdrom_id/60-cdrom_id.rules
index b3109f1d01..aedf6f0558 100644
--- a/extras/cdrom_id/60-cdrom_id.rules
+++ b/extras/cdrom_id/60-cdrom_id.rules
@@ -5,6 +5,9 @@ SUBSYSTEM!="block", GOTO="cdrom_end"
KERNEL!="sr[0-9]*|xvd*", GOTO="cdrom_end"
ENV{DEVTYPE}!="disk", GOTO="cdrom_end"
+# this is only a button press event
+ENV{DISK_EJECT_REQUEST}=="?*", GOTO="cdrom_end"
+
KERNEL=="sr[0-9]*", ENV{ID_CDROM}="1"
IMPORT{program}="cdrom_id --export $tempnode"