linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* phantom empty cd
@ 2010-04-15  1:54 Mike Brudevold
  2010-04-15  7:10 ` Martin Pitt
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mike Brudevold @ 2010-04-15  1:54 UTC (permalink / raw)
  To: linux-hotplug

With regards to a problem with phantom empty cd's visible from
nautilus [1], I have a question about the following code (from
cdrom_id.c scsi_cmd_run):

if ((cmd->sg_io.info & SG_INFO_OK_MASK) != SG_INFO_OK) {
    errno = EIO;
    ret = -1;
    if (cmd->sg_io.masked_status & CHECK_CONDITION) {
        ret = ERRCODE(cmd->_sense.u);
        if (ret = 0)
            ret = -1;
    }
}

I do not have a copy of the spec, so I can only guess, but if
CHECK_CONDITION is set, the function can only return error (-1) if
cmd->_sense.u is zero (ERRCODE can never be negative).  I experience
the phantom empty cd problem, and when I return -1 from this function
rather than checking for CHECK_CONDITION, the phantom CD problem goes
away, as cdrom_id errors out trying to read the TOC and simply prints
the results.

Alternatively to the above potential solution, I notice that my cd-rw
drive will report that profile 0x02 is the current profile when there
is no cd in the drive.  If you query all the profiles, it will return
0x0a, 0x09, 0x08, and 0x02, but none of these profiles will have their
current bit set.  Would it be advisable to verify that the profile
reported as current in the header is actually current according to the
profile descriptor?  Seems to me that these two should be in sync.

Mike

[1] https://bugs.launchpad.net/ubuntu/+source/udev/+bug/562978

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-04-15 23:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-15  1:54 phantom empty cd Mike Brudevold
2010-04-15  7:10 ` Martin Pitt
2010-04-15 18:35 ` Kay Sievers
2010-04-15 23:34 ` Robby Workman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).