All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stas Sergeev <stsp@aknet.ru>
To: Linux kernel <linux-kernel@vger.kernel.org>
Cc: Jens Axboe <axboe@suse.de>
Subject: bug: cd-rom autoclose no longer works (fix attempt)
Date: Wed, 29 Dec 2004 21:12:22 +0300	[thread overview]
Message-ID: <41D2F386.8060507@aknet.ru> (raw)

[-- Attachment #1: Type: text/plain, Size: 564 bytes --]

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?

[-- Attachment #2: cd_clo.diff --]
[-- Type: text/x-patch, Size: 942 bytes --]

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

             reply	other threads:[~2004-12-29 18:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-29 18:12 Stas Sergeev [this message]
     [not found] <200412301853.48677.alex.kern@gmx.de>
2004-12-30 18:26 ` bug: cd-rom autoclose no longer works (fix attempt) Stas Sergeev
2004-12-30 19:52   ` Alexander Kern
2004-12-30 20:35     ` Stas Sergeev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41D2F386.8060507@aknet.ru \
    --to=stsp@aknet.ru \
    --cc=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.