Skip to contentSkip to conversation

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

DISCUSSION Stas Sergeev 2 participants 3 messages Dec 30, 2004 1 message not in the archive Uniform cdrom driver

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hello.

Quoted 11 lines · Alexander Kern
Quoted 4 lines

The ide-cd.c change is as per 2.4.20
which works. For some reasons
sense.ascq == 0 for me when the tray
is opened.

ascq = 0 is legal.
According to mmc3r10g
asc 3a
ascq 0 is MEDIUM NOT PRESENT
ascq 1 is MEDIUM NOT PRESENT - TRAY CLOSED
ascq 2 is MEDIUM NOT PRESENT - TRAY OPEN
What in my eyes means, your drive is impossible to determine is tray open or closed.

I think so too, this is the problem most likely. However, my cd-roms are not that ancient, I expect there are millions of the like ones around. Breaking autoclose for all of them after it worked for ages, is no good IMO.

Quoted 1 line

Linux assumes if not known tray is closed. That is better default, it avoids infinate trying to close.

I don't think so. It is safe to assume the tray is opened, at least it worked in the past (or were there the real problems with this?) You can always try to close it only once, and if that still returns 0, then bail out. One extra closing attempt should not do any harm I suppose. That's exactly what my patch does (I hope). And that's most likely how it used to work before. I'll be disappointed if autoclose will remain broken - it was the very usefull feature, it will be missed. Unless there are the real technical reasons against the old behaviour, of course.

#2 lore raw

Am Donnerstag, 30. Dezember 2004 19:26 schrieb Stas Sergeev:

Quoted 1 line

Hello.

Hello,

Quoted 16 lines
Quoted 5 lines · Alexander Kern
Quoted 4 lines

The ide-cd.c change is as per 2.4.20
which works. For some reasons
sense.ascq == 0 for me when the tray
is opened.

Quoted 8 lines

ascq = 0 is legal.
According to mmc3r10g
asc 3a
ascq 0 is MEDIUM NOT PRESENT
ascq 1 is MEDIUM NOT PRESENT - TRAY CLOSED
ascq 2 is MEDIUM NOT PRESENT - TRAY OPEN
What in my eyes means, your drive is impossible to determine is tray open or closed.

Quoted 7 lines

I think so too, this is the problem most likely. However, my cd-roms are not that ancient, I expect there are millions of the like ones around. Breaking autoclose for all of them after it worked for ages, is no good IMO.

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.

Quoted 16 lines
Quoted 2 lines

Linux assumes if not known tray is closed. That is better default, it avoids infinate trying to close.

I don't think so. It is safe to assume the tray is opened, at least it worked in the past (or were there the real problems with this?) You can always try to close it only once, and if that still returns 0, then bail out. One extra closing attempt should not do any harm I suppose. That's exactly what my patch does (I hope). And that's most likely how it used to work before. I'll be disappointed if autoclose will remain broken - it was the very usefull feature, it will be missed. Unless there are the real technical reasons against the old behaviour, of course.

Old behaviour has another problems, and revert to 2.4.20 code base is a bad solution. I have nothing against changing the default.
The patch must be minimal...

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

Regards Alex

P.S. S Novym Godom!

#3 lore raw

Hello.

Quoted 1 line · Alexander Kern

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.

Quoted 1 line

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.

Quoted 2 lines

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?

Quoted 1 line

P.S. S Novym Godom!

OK, thanks, and to you too:)

drivers/cdrom/cdrom.c +2 -0
@@ -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;
drivers/ide/ide-cd.c +2 -2
@@ -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;
 		}
 	}