Commit b2abed6a authored by Stas Sergeev's avatar Stas Sergeev Committed by Linus Torvalds

[PATCH] fix cdrom autoclose

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.
Signed-off-by: default avatarStas Sergeev <stsp@aknet.ru>
Acked-by: default avatarAlexander Kern <alex.kern@gmx.de>
Acked-by: default avatarJens Axboe <axboe@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 25620d2c
......@@ -1076,6 +1076,8 @@ int open_for_data(struct cdrom_device_info * cdi)
}
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;
......
......@@ -2688,9 +2688,9 @@ int ide_cdrom_drive_status (struct cdrom_device_info *cdi, int slot_nr)
*/
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;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment