https://launchpad.net/bugs/356631 reported that many people still have
the problem that after ejecting a CD, the CD-ROM tray automatically
closes again, causing the killing of fingers and CDs (or small pets :-) )
This problem came up a while ago already, and was solved with
introducing this into /lib/udev/rules.d/60-persistent-storage.rules:
# probe filesystem metadata of optical drives which have a media inserted
KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT}=="?*", IMPORT{program}="vol_id --export --skip-raid --offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode"
However, this rule (and the corresponding code in cdrom_id [1]) relies
on the track/session counts being zero if there is no CD in the drive.
However, at least with kernel 2.6.28.8 the affected people get
something like
In other words, if ID_CDROM_MEDIA_STATE=blank, the session/track
counts are not reliable.
Arguably this could/should be fixed in the kernel, to fix these values
to 0 if there is no CD in the drive, or it is blank. However, I
wondered if the udev rules should be more robust in that regard, and
not even ask for the number of tracks if there is no/empty CD.
Affected people verified that adding this rule before the one from
above makes things work:
Hello udev developers,
https:/ /launchpad. net/bugs/ 356631 reported that many people still have
the problem that after ejecting a CD, the CD-ROM tray automatically
closes again, causing the killing of fingers and CDs (or small pets :-) )
This problem came up a while ago already, and was solved with rules.d/ 60-persistent- storage. rules:
introducing this into /lib/udev/
# probe filesystem metadata of optical drives which have a media inserted CDROM_MEDIA_ TRACK_COUNT} =="?*", IMPORT{ program} ="vol_id --export --skip-raid --offset= $env{ID_ CDROM_MEDIA_ SESSION_ LAST_OFFSET} $tempnode"
KERNEL=="sr*", ENV{ID_
However, this rule (and the corresponding code in cdrom_id [1]) relies
on the track/session counts being zero if there is no CD in the drive.
However, at least with kernel 2.6.28.8 the affected people get
something like
ID_CDROM_ MEDIA_STATE= blank MEDIA_SESSION_ NEXT=2894 MEDIA_SESSION_ COUNT=19194 MEDIA_TRACK_ COUNT=47323
ID_CDROM_
ID_CDROM_
ID_CDROM_
In other words, if ID_CDROM_ MEDIA_STATE= blank, the session/track
counts are not reliable.
Arguably this could/should be fixed in the kernel, to fix these values
to 0 if there is no CD in the drive, or it is blank. However, I
wondered if the udev rules should be more robust in that regard, and
not even ask for the number of tracks if there is no/empty CD.
Affected people verified that adding this rule before the one from
above makes things work:
KERNEL=="sr*", ENV{ID_ CDROM_MEDIA_ STATE}= ="blank" , GOTO="persisten t_storage_ end"
Thanks,
Martin
[1] if (cd_media_ track_count > 0)
printf( "ID_CDROM_ MEDIA_TRACK_ COUNT=% d\n", cd_media_ track_count) ; www.piware. de
--
Martin Pitt | http://
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)