Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
udevadm [2018/04/09 02:04] beandog |
udevadm [2018/04/09 02:07] (current) beandog |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== udevadm ====== | ====== udevadm ====== | ||
+ | |||
+ | * [[udev]] | ||
You can use udevadm to see the variables set by udev for a device. This is helpful if you want to get information about the device, based on whether it has a DVD or a CD in there, for example. | You can use udevadm to see the variables set by udev for a device. This is helpful if you want to get information about the device, based on whether it has a DVD or a CD in there, for example. | ||
Line 22: | Line 24: | ||
SUBSYSTEM=="block", ENV{ID_MODEL}=="ATAPI_iHOS104", ENV{ID_REVISION}=="WL0D", SYMLINK+="dvd", ENV{GENERATED}="1" | SUBSYSTEM=="block", ENV{ID_MODEL}=="ATAPI_iHOS104", ENV{ID_REVISION}=="WL0D", SYMLINK+="dvd", ENV{GENERATED}="1" | ||
SUBSYSTEM=="block", ENV{ID_MODEL}=="ATAPI_iHOS104", ENV{ID_CDROM_MEDIA_DVD}=="1", ENV{ID_CDROM_MEDIA_STATE}=="complete", RUN+="/usr/local/bin/onevent.trayclose" | SUBSYSTEM=="block", ENV{ID_MODEL}=="ATAPI_iHOS104", ENV{ID_CDROM_MEDIA_DVD}=="1", ENV{ID_CDROM_MEDIA_STATE}=="complete", RUN+="/usr/local/bin/onevent.trayclose" | ||
+ | </code> | ||
+ | |||
+ | For completion's sake, here's ''onevent.trayclose'': | ||
+ | |||
+ | <code> | ||
+ | #!/bin/bash | ||
+ | mount -o ro -t udf $DEVNAME &> /dev/null | ||
+ | if [[ -z "$ID_FS_LABEL" ]]; then ID_FS_LABEL=$(busybox volname $DEVNAME); fi | ||
+ | echo "/usr/bin/sudo -u steve /home/steve/Videos/Rip-o-Matic/spincycle $DEVNAME $ID_FS_LABEL" | at now | ||
</code> | </code> |