All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Pitt <martin.pitt@ubuntu.com>
To: linux-hotplug@vger.kernel.org
Subject: CD-ROM tray closes automatically after eject due to random
Date: Tue, 21 Apr 2009 07:25:09 +0000	[thread overview]
Message-ID: <20090421072509.GF3973@piware.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 1821 bytes --]

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
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

  ID_CDROM_MEDIA_STATE=blank
  ID_CDROM_MEDIA_SESSION_NEXT=2894
  ID_CDROM_MEDIA_SESSION_COUNT=19194
  ID_CDROM_MEDIA_TRACK_COUNT=47323

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="persistent_storage_end"

Thanks,

Martin

[1]         if (cd_media_track_count > 0)
                printf("ID_CDROM_MEDIA_TRACK_COUNT=%d\n", cd_media_track_count);
-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

             reply	other threads:[~2009-04-21  7:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-21  7:25 Martin Pitt [this message]
2009-04-21  8:52 ` CD-ROM tray closes automatically after eject due to random Kay Sievers
2009-04-21  9:14 ` Martin Pitt
2009-04-22 13:34 ` Martin Pitt
2009-04-22 22:16 ` Kay Sievers
2009-04-23  7:35 ` Martin Pitt
2009-04-23 13:19 ` Kay Sievers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090421072509.GF3973@piware.de \
    --to=martin.pitt@ubuntu.com \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.