Specifically, this part:
@@ -2324,11 +2309,17 @@
sense.ascq == 0x04)
return CDS_DISC_OK;
+
+ /*
+ * If not using Mt Fuji extended media tray reports,
+ * just return TRAY_OPEN since ATAPI doesn't provide
+ * any other way to detect this...
+ */
if (sense.sense_key == NOT_READY) {
- /* ATAPI doesn't have anything that can help
- us decide whether the drive is really
- emtpy or the tray is just open. irk. */
- return CDS_TRAY_OPEN;
+ if (sense.asc == 0x3a && (!sense.ascq||sense.ascq == 1))
+ return CDS_NO_DISC;
+ else
+ return CDS_TRAY_OPEN;
}
My tray is open as I type, and it is misreported as CDS_NO_DISC. In
2.4.0 it worked fine.
# strace cdd
execve("/trusted/bin/cdd", ["cdd"], [/* 35 vars */]) = 0
open("/dev/cdrom", O_RDONLY|O_NONBLOCK) = 5
ioctl(5, CDROM_DRIVE_STATUS, 0) = 1
write(1, "No disc in drive\n", 17No disc in drive
) = 17
_exit(0) = ?
>From linux/include/linux/cdrom.h:
#define CDS_NO_INFO 0 /* if not implemented */
#define CDS_NO_DISC 1
#define CDS_TRAY_OPEN 2
#define CDS_DRIVE_NOT_READY 3
#define CDS_DISC_OK 4
(The usual plug: download my beautifully minimalistic but featureful
hand coded assembly cd player from
http://john.snoop.dk/programs/linux/asm-toys).
Some miscellaneous hardware details from dmesg:
Uniform Multi-Platform E-IDE driver Revision: 6.31
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
ALI15X3: IDE controller on PCI bus 00 dev 78
PCI: Hardcoded IRQ 14 for device 00:0f.0
ALI15X3: chipset revision 32
ALI15X3: not 100% native mode: will probe irqs later
ide0: BM-DMA at 0xffa0-0xffa7, BIOS settings: hda:DMA, hdb:pio
ide1: BM-DMA at 0xffa8-0xffaf, BIOS settings: hdc:DMA, hdd:pio
hda: SAMSUNG VG36483A (6.48GB), ATA DISK drive
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
hdc: IBM-DTLA-305020, ATA DISK drive
hdd: TOSHIBA DVD-ROM SD-M1102, ATAPI CD/DVD-ROM drive
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
ide1 at 0x170-0x177,0x376 on irq 15
hda: 12685680 sectors (6495 MB) w/494KiB Cache, CHS=789/255/63, (U)DMA
hdc: 40188960 sectors (20577 MB) w/380KiB Cache, CHS=39870/16/63, (U)DMA
hdd: ATAPI 24X DVD-ROM drive, 256kB Cache
Uniform CD-ROM driver Revision: 3.12
--
http://www.penguinpowered.com/~vii
On Sat, Feb 17 2001, John Fremlin wrote:
> Specifically, this part:
>
> @@ -2324,11 +2309,17 @@
> sense.ascq == 0x04)
> return CDS_DISC_OK;
>
> +
> + /*
> + * If not using Mt Fuji extended media tray reports,
> + * just return TRAY_OPEN since ATAPI doesn't provide
> + * any other way to detect this...
> + */
> if (sense.sense_key == NOT_READY) {
> - /* ATAPI doesn't have anything that can help
> - us decide whether the drive is really
> - emtpy or the tray is just open. irk. */
> - return CDS_TRAY_OPEN;
> + if (sense.asc == 0x3a && (!sense.ascq||sense.ascq == 1))
> + return CDS_NO_DISC;
> + else
> + return CDS_TRAY_OPEN;
> }
>
> My tray is open as I type, and it is misreported as CDS_NO_DISC. In
> 2.4.0 it worked fine.
Your drive is broken, the only other valid combination is 0x3a/0x02 which means
no media and tray open. You could try and dump the asc and ascq to see what
your drive reports for the different states.
--
Jens Axboe
From: Jens Axboe <[email protected]>
On Sat, Feb 17 2001, John Fremlin wrote:
> Specifically, this part:
>
> @@ -2324,11 +2309,17 @@
> sense.ascq == 0x04)
> return CDS_DISC_OK;
>
> +
> + /*
> + * If not using Mt Fuji extended media tray reports,
> + * just return TRAY_OPEN since ATAPI doesn't provide
> + * any other way to detect this...
> + */
> if (sense.sense_key == NOT_READY) {
> - /* ATAPI doesn't have anything that can help
> - us decide whether the drive is really
> - emtpy or the tray is just open. irk. */
> - return CDS_TRAY_OPEN;
> + if (sense.asc == 0x3a && (!sense.ascq||sense.ascq == 1))
> + return CDS_NO_DISC;
> + else
> + return CDS_TRAY_OPEN;
> }
>
> My tray is open as I type, and it is misreported as CDS_NO_DISC. In
> 2.4.0 it worked fine.
Your drive is broken, the only other valid combination is 0x3a/0x02
which means no media and tray open. You could try and dump the asc
and ascq to see what your drive reports for the different states.
Ha Jens - must we disagree twice on one evening?
You know all about this stuff, so probably I am mistaken.
However, my copy of SFF8020-r2.6 everywhere has
"Sense 02 ASC 3A: Medium not present" without giving
subcodes to distinguish Tray Open from No Disc.
So, it seems to me that drives built to this spec will not have
nonzero ASCQ.
Andries
On Sun, Feb 18 2001, [email protected] wrote:
> > + /*
> > + * If not using Mt Fuji extended media tray reports,
> > + * just return TRAY_OPEN since ATAPI doesn't provide
> > + * any other way to detect this...
> > + */
> > if (sense.sense_key == NOT_READY) {
> > - /* ATAPI doesn't have anything that can help
> > - us decide whether the drive is really
> > - emtpy or the tray is just open. irk. */
> > - return CDS_TRAY_OPEN;
> > + if (sense.asc == 0x3a && (!sense.ascq||sense.ascq == 1))
> > + return CDS_NO_DISC;
> > + else
> > + return CDS_TRAY_OPEN;
> > }
> >
> > My tray is open as I type, and it is misreported as CDS_NO_DISC. In
> > 2.4.0 it worked fine.
>
> Your drive is broken, the only other valid combination is 0x3a/0x02
> which means no media and tray open. You could try and dump the asc
> and ascq to see what your drive reports for the different states.
>
> Ha Jens - must we disagree twice on one evening?
:-)
> You know all about this stuff, so probably I am mistaken.
> However, my copy of SFF8020-r2.6 everywhere has
> "Sense 02 ASC 3A: Medium not present" without giving
> subcodes to distinguish Tray Open from No Disc.
> So, it seems to me that drives built to this spec will not have
> nonzero ASCQ.
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.
--
Jens Axboe
Jens Axboe <[email protected]> writes:
[...]
> > You know all about this stuff, so probably I am mistaken.
> > However, my copy of SFF8020-r2.6 everywhere has
> > "Sense 02 ASC 3A: Medium not present" without giving
> > subcodes to distinguish Tray Open from No Disc.
> > So, it seems to me that drives built to this spec will not have
> > nonzero ASCQ.
>
> 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.
Jens, you are maintainer? Could you ask Linus or Alan to revert the
change below?
diff -u --recursive --new-file v2.4.0/linux/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
--- v2.4.0/linux/drivers/ide/ide-cd.c Tue Jan 2 16:59:17 2001
+++ linux/drivers/ide/ide-cd.c Sun Jan 28 13:37:50 2001
@@ -2324,11 +2309,17 @@
sense.ascq == 0x04)
return CDS_DISC_OK;
+
+ /*
+ * If not using Mt Fuji extended media tray reports,
+ * just return TRAY_OPEN since ATAPI doesn't provide
+ * any other way to detect this...
+ */
if (sense.sense_key == NOT_READY) {
- /* ATAPI doesn't have anything that can help
- us decide whether the drive is really
- emtpy or the tray is just open. irk. */
- return CDS_TRAY_OPEN;
+ if (sense.asc == 0x3a && (!sense.ascq||sense.ascq == 1))+ return CDS_NO_DISC;
+ else
+ return CDS_TRAY_OPEN;
}
--
http://www.penguinpowered.com/~vii
"Michael Johnson" <[email protected]> writes:
> >> You know all about this stuff, so probably I am mistaken.
> >> However, my copy of SFF8020-r2.6 everywhere has
> >> "Sense 02 ASC 3A: Medium not present" without giving
> >> subcodes to distinguish Tray Open from No Disc.
> >> So, it seems to me that drives built to this spec will not have
> >> nonzero ASCQ.
> >
> >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...
It isn't a problem, it just changed in the middle of a stable release.
[...]
--
http://www.penguinpowered.com/~vii
[email protected] (Enrico Scholz) writes:
> | [kernel >=2.4.1; open tray]
> | $ rmmod cdrom
> | $ modprobe cdrom autoclose=0
^ oops, should be a '1' obviously
Enrico