bug: cd-rom autoclose no longer works (fix attempt)
Hello.
CD-ROM autoclose stopped working in 2.6 kernels quite some time ago. Attached is the patch that fixes it for me.
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.
The cdrom.c change is here because rigth after the tray closed, drive_status() returns CDS_DISK_OK even when there is no disk, which probably only means that the tray was successfully closed. Calling drive_status() again gets the right status.
With this patch autoclose works again. Can someone please make any sense out of it?
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 +4 -6
@@ -2743,12 +2743,10 @@* any other way to detect this... */ if (sense.sense_key ==NOT_READY ) { -if (sense.asc ==0x3a ) { -if (sense.ascq ==0 || sense.ascq ==1 ) -return CDS_NO_DISC ; -else if (sense.ascq ==2 ) -return CDS_TRAY_OPEN ; - } +if (sense.asc ==0x3a && sense.ascq ==1 ) +return CDS_NO_DISC ; +else +return CDS_TRAY_OPEN ; }return CDS_DRIVE_NOT_READY ;