patch to sr.c (scsi cdrom)

Corey J. Stotts (cstotts@blue.weeg.uiowa.edu)
Tue, 16 Mar 1999 04:25:58 +0000


This is a multi-part message in MIME format.
--------------AFA2EFD93F6B6443CE7973F3
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I've already posted this patch to linux-scsi, but I thought people here
might be interested. It is a patch to the scsi cdrom driver to disable
audio/multisession capabilities for SCSI-1/SCSI-1 CCS cdrom drives. It
checks the scsi revision of the cdrom drive, and will mask out cdrom
capability flags that indicate audio/multisession capabilities for the
drive if the drive isn't SCSI-2. Otherwise the uniform cdrom driver &
scsi multisession code will think the drive is capable of audio ioctls,
and the scsi commands associated with the audio ioctls are not SCSI-1
friendly.

This is a problem even if no attempt to play an audio cd is ever made
with such a drive. The uniform cdrom driver tries to read a cd's TOC
when the device is opened, in order to determine what types of tracks a
disc contains (audio, data, etc). This operation is an audio ioctl. The
associated scsi commands are not recognized by older cdrom drives that
aren't SCSI-2 compatible. However, the driver won't make such an attempt
if it knows that the drive in question is not audio-capable.

I've also made a one-line patch to the uniform cdrom driver to fix a
small omission in the check of a drive's audio capabilites before trying
to read the disc TOC. It's already been submitted to the Uniform CDROM
Driver maintainer, but I've included it here as well.

Corey

--------------AFA2EFD93F6B6443CE7973F3
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);

--------------AFA2EFD93F6B6443CE7973F3
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;
}

--------------AFA2EFD93F6B6443CE7973F3--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/