Re: Changes to ide-cd for 2.4.1 are broken?

From: Enrico Scholz (
Date: Wed Oct 10 2001 - 16:03:43 EST

[ This is a very old thread; please see [1] for a complete list and [2] for
  technical details ] ("Michael Johnson") writes:

> So, the patch you are proposing will always consider the tray open,
> even if it is closed. Why do you need this behavior?

I need the behavior to close the tray when it is open. Currently it will
never by closed.

> Why is checking CDS_TRAY_OPEN, to see if the tray is open, broken?

CDS_TRAY_OPEN will never be returned; only CDS_NO_DISC.

> The code in cdrom.c looks fine to me.

The code there is fine. The code in ide-cd.c is broken:

| if (sense.asc == 0x3a && (!sense.ascq||sense.ascq == 1))
| return CDS_NO_DISC;
| else
| return CDS_TRAY_OPEN;

Assuming the tray is open. Then ATAPI IDE-CD drives will have an
unspecified ASCQ -- which is mostly zero (see ATAPI specification).
Therefore, it will be returned CDS_NO_DISC. This is wrong; the
correct result should be CDS_TRAY_OPEN because it is a more special
description of the state than CDS_NO_DISC and the layers above are
trusting in this value.

CDS_NO_DISC would lead to an immediate error in the open_for_data()
function in cdrom.c, but CDS_TRAY_OPEN makes it possible to close the
tray automatically.

This can be demonstrated by:

| [kernel <2.4.1; open tray]
| $ rmmod cdrom
| $ modprobe cdrom autoclose=1
| $ mount /cdrom
| ... tray will be closed and the CD mounted ...
| $
| [kernel >=2.4.1; open tray]
| $ rmmod cdrom
| $ modprobe cdrom autoclose=0
| $ mount /cdrom
| mount: No medium found
| $

As you can see, the current behavior makes the 'autoclose' option
effectless on "normal" IDE-CDROMs. Only special CDROMs following the
Mt Fuji standard can profit from the ASCQ test.

I suggest the patch already given in [3] and will append it again.

> > Hi all, this is an old thread. It was started because the return
> > value from cd info was changed in 2.4.1 in the case when the tray
> > might be open or there simply be no disc in the drive for an IDE
> > CD-ROM.
> > [...]
> > > > >Right, old ATAPI has 3a/02 as the only possible condition, so
> > > > >we can't really tell between no disc and tray open. I guess the
> > > > >safest is to just keep the old behaviour for !ascq and report
> > > > >open.
> > >
> > > > I don't understand why the current(2.4.1) behavior is a problem...
> >
> > Unfortunately changing the return code means that the generic cdrom.c
> > code is broekn, in particular [...] to close when attempted to be
> > mounted.





To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Mon Oct 15 2001 - 21:00:34 EST