[6098] in linux-scsi channel archive
small scsi CDROM mod
daemon@ATHENA.MIT.EDU (Corey J. Stotts)
Sun Mar 14 23:47:52 1999
Date: Mon, 15 Mar 1999 04:39:05 +0000
From: "Corey J. Stotts" <cstotts@blue.weeg.uiowa.edu>
To: "linux-scsi@vger.rutgers.edu" <linux-scsi@vger.rutgers.edu>
This is a multi-part message in MIME format.
--------------2CF831A89B6E3AAE5590262F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I just installed an _old_ sony SCSI-1 CCS cdrom on my system, and had a
rather unpleasant time. Because CDS_PLAY_AUDIO and CDS_MULTI_SESSION
aren't masked out in the cdrom_device_info struct (cdi.mask) during
sr_finish() in sr.c, the Uniform CDROM driver was calling audio ioctls
to try to read/count the tracks on the CD and what types they are.
Pre-SCSI-2 cdroms like this one (a CDU-8001) don't like these commands,
and can cause some _really_ bad problems. (The adaptec 1520 driver
didn't like the cdrom's response, and panicked).
I've attached a short patch that checks the scsi revision for every
cdrom drive and, if the drive is not SCSI-2, masks out the above
capability flags. I've also attached a one-line patch to the Uniform
CDROM Driver that makes sure it checks the cdi.mask in one spot.....this
patch has also been sent to Jens Axboe (axboe@image.dk), the Uniform
CDROM Driver maintainer.
If there's a better place to put this check than sr_finish(), please
tell me. I've haven't spent a great deal of time with the SCSI code. ;-)
However, I do think that this check is probably a good idea for safety
considerations. We shouldn't be telling other drivers that it's okay to
do audio ioctls on a device when the device at hand doesn't support
them.
Corey
--------------2CF831A89B6E3AAE5590262F
Content-Type: text/plain; charset=us-ascii;
name="sr.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="sr.patch"
--- linux-2.2.3/drivers/scsi/sr.c Fri Jan 15 16:41:04 1999
+++ linux/drivers/scsi/sr.c Sun Mar 14 16:05:51 1999
@@ -1083,6 +1083,13 @@
get_capabilities(i);
sr_vendor_init(i);
+ /* If it isn't SCSI-2, don't do audio */
+ if( scsi_CDs[i].device->scsi_level != SCSI_2 ) {
+ printk("sr%d: not SCSI-2, removing audio/xa support\n", i);
+ scsi_CDs[i].cdi.mask = scsi_CDs[i].cdi.mask | CDC_PLAY_AUDIO |
+ CDC_MULTI_SESSION;
+ }
+
sprintf(name, "sr%d", i);
strcpy(scsi_CDs[i].cdi.name, name);
register_cdrom(&scsi_CDs[i].cdi);
--------------2CF831A89B6E3AAE5590262F
Content-Type: text/plain; charset=us-ascii;
name="cdrom.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="cdrom.patch"
--- linux-2.2.3/drivers/cdrom/cdrom.c Mon Jan 18 19:33:01 1999
+++ linux/drivers/cdrom/cdrom.c Sun Mar 14 16:06:58 1999
@@ -588,7 +588,7 @@
tracks->xa=0;
tracks->error=0;
cdinfo(CD_COUNT_TRACKS, "entering cdrom_count_tracks\n");
- if (!(cdi->ops->capability & CDC_PLAY_AUDIO)) {
+ if (!(cdi->ops->capability & ~cdi->mask & CDC_PLAY_AUDIO)) {
tracks->error=CDS_NO_INFO;
return;
}
--------------2CF831A89B6E3AAE5590262F--
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.rutgers.edu