Skip to contentSkip to conversation

fix cdrom autoclose

PATCH New Stas Sergeev 1 participant 1 message Jan 5, 2005 Uniform cdrom driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix cdrom autoclose

Hi Andrew.

The attached patch fixes the CD-ROM autoclose. It is broken in recent kernels for CD-ROMs that do not properly report that the tray is opened.
Now on such a drives the kernel will do one close attempt and check for the disc again. This is how it used to work in the past.

Can this please be applied?

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