Re: bug: cd-rom autoclose no longer works (fix attempt)

From: Stas Sergeev
Date: Thu Dec 30 2004 - 15:37:16 EST


Hello.

Alexander Kern wrote:
Can agree with you, but a modern cdrom should be able to konwn, is it open or not. This patch change basic behaviour for all cdroms.
But I think those modern cdroms will
return 1 or 2 but not 0, in which case
my patch should not affect them. This
is of course something I can't say for
sure, just assuming.

Old behaviour has another problems, and revert to 2.4.20 code base is a bad solution.
Very probably. My patch was only "what
I did to get it to work again" kind of
thing.

The patch must be minimal...
if (sense.sense_key == NOT_READY) {
OK, but the cdrom.c change is still needed
either. So attached is the new one. Does it
get us any closer to having this fixed?

P.S. S Novym Godom!
OK, thanks, and to you too:)

--- linux/drivers/cdrom/cdrom.c 2004-12-28 14:49:56.000000000 +0300
+++ linux/drivers/cdrom/cdrom.c 2004-12-28 14:55:09.228038640 +0300
@@ -1076,6 +1076,8 @@
}
cdinfo(CD_OPEN, "the tray is now closed.\n");
}
+ /* the door should be closed now, check for the disc */
+ ret = cdo->drive_status(cdi, CDSL_CURRENT);
if (ret!=CDS_DISC_OK) {
ret = -ENOMEDIUM;
goto clean_up_and_return;
--- linux/drivers/ide/ide-cd.c 2004-12-28 09:15:40.000000000 +0300
+++ linux/drivers/ide/ide-cd.c 2004-12-28 14:46:44.119826760 +0300
@@ -2744,9 +2744,9 @@
*/
if (sense.sense_key == NOT_READY) {
if (sense.asc == 0x3a) {
- if (sense.ascq == 0 || sense.ascq == 1)
+ if (sense.ascq == 1)
return CDS_NO_DISC;
- else if (sense.ascq == 2)
+ else if (sense.ascq == 0 || sense.ascq == 2)
return CDS_TRAY_OPEN;
}
}