lkml.org 
[lkml]   [2004]   [Dec]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] SCSI not showing tray status correctly
Date
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)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:09    [W:0.051 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site