mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Martin <tasio@tasio.net>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] SCSI not showing tray status correctly
Date: Mon, 27 Dec 2004 06:26:32 +0100	[thread overview]
Message-ID: <200412270626.32643.tasio@tasio.net> (raw)

When trying to get the drive status via ioctl CDROM_DRIVE_STATUS, with no disk 
it gives CDS_TRAY_OPEN even if the tray is closed.

ioctl works as expected with ide-cd driver. Here is the patch to get the same 
behaviour on SCSI drives for kernel 2.6.10. 2.4 branch have same problem.



--- linux-2.6.10-orig/drivers/scsi/sr_ioctl.c        2004-12-27 
04:47:22.000000000 +0100
+++ linux-2.6.10/drivers/scsi/sr_ioctl.c     2004-12-27 05:54:08.000000000 
+0100
@@ -216,14 +216,20 @@

 int sr_drive_status(struct cdrom_device_info *cdi, int slot)
 {
+       struct media_event_desc med;
+
        if (CDSL_CURRENT != slot) {
                /* we have no changer support */
                return -EINVAL;
        }
+
        if (0 == test_unit_ready(cdi->handle))
                return CDS_DISC_OK;

-       return CDS_TRAY_OPEN;
+       if (!cdrom_get_media_event(cdi, &med) && med.door_open)
+               return CDS_TRAY_OPEN;
+
+       return CDS_NO_DISC;
 }

 int sr_disk_status(struct cdrom_device_info *cdi)

                 reply	other threads:[~2004-12-27  5:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200412270626.32643.tasio@tasio.net \
    --to=tasio@tasio.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome