Skip to content

Instantly share code, notes, and snippets.

@un1versal
Created March 1, 2014 14:06
Show Gist options
  • Save un1versal/9290192 to your computer and use it in GitHub Desktop.
Save un1versal/9290192 to your computer and use it in GitHub Desktop.
usage: sudo wget https://gist.github.com/uNiversaI/9290192/raw -O /etc/udev/rules.d/60-cdrom_id.rules
ACTION=="remove", GOTO="cdrom_end"
SUBSYSTEM!="block", GOTO="cdrom_end"
KERNEL!="sr[0-9]*|xvd*", GOTO="cdrom_end"
ENV{DEVTYPE}!="disk", GOTO="cdrom_end"
# unconditionally tag device as CDROM
KERNEL=="sr[0-9]*", ENV{ID_CDROM}="1"
# media eject button pressed
ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $tempnode", GOTO="c$
# import device and media properties and lock tray to
# enable the receiving of media eject button events
IMPORT{program}="cdrom_id $tempnode"
LABEL="cdrom_end"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment