NetBSD Problem Report #7299

Received: (qmail 12254 invoked from network); 1 Apr 1999 19:00:22 -0000
Message-Id: <199904011843.TAA03247@aire.ncl.ac.uk>
Date: Thu, 1 Apr 1999 19:43:34 +0100 (BST)
From: j.d.coleman@ncl.ac.uk (Julian Coleman)
Reply-To: jdc@netbsd.org
To: gnats-bugs@gnats.netbsd.org
Subject: CDIOCPLAYTRACKS, etc. fail on CD players with 2 audio channels
X-Send-Pr-Version: 3.95

>Number:         7299
>Category:       kern
>Synopsis:       cd_scsi.c assumes four channel audio
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bouyer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 01 11:05:00 +0000 1999
>Closed-Date:    Sun Nov 03 21:24:59 +0000 2002
>Last-Modified:  Fri Dec 13 07:53:03 +0000 2002
>Originator:     Julian Coleman
>Release:        1.3 -> -current
>Organization:
Computing Service, University of Newcastle upon Tyne, UK
>Environment:
NetBSD/sparc /i386 & /atari

>Description:
The CDIOCPLAYTRACKS, etc. ioctls do not work on some CD players, or work
but generate errors of the form :

    cd0(ncrscsi0:6:0):  Check Condition on opcode 0x15
        SENSE KEY:  Illegal Request
         ASC/ASCQ:  Invalid Field In Parameter List
             SKSV:  Error in Parameters, Offset 25, bit 7

or :

    cd0(aic0:6:0):  Check Condition on CDB: 0x15 10 00 00 1c 00
        SENSE KEY:  Illegal Request
         ASC/ASCQ:  Invalid Field In Parameter List

The reason is that the audio commands assume that the CD player has four
channels.  All of the CD players I tested have 2 channels.  The error
occurs because cd_scsibus_setvol() in /usr/src/sys/dev/scsipi/cd_scsi.c
has :

	data.page.audio.port[2].volume = arg->vol[2];
	data.page.audio.port[3].volume = arg->vol[3];

and cd_scsibus_setvol() is called as a result of a CDIOCPLAYTRACKS ioctl.
(I see that cd_scsibus_setchan() also sets channels 2 and 3.)

Note : This probably also applies to ATAPI CD players as well, but I only
have access to SCSI ones.


>How-To-Repeat:

Try to play an audio CD using CDIOCPLAYTRACKS and friends.


>Fix:

The simple solution is just to comment out the code that refers to these
channels (see below).  However, the SCSI-2 spec mentions that the number of
audio channels is returned in control bit 3 of a READ SUB-CHANNEL call on
sub-channel Q.  Also, I see that struct scsi_cd_write_params_page{} in
scsi_cd.h has a reference to TRACK_MODE_4CHAN, but I don't see what this
is used for.

*** /usr/src/sys/dev/scsipi/cd_scsi.c.dist      Tue Sep  1 12:10:10 1998
--- /usr/src/sys/dev/scsipi/cd_scsi.c   Mon Mar 15 09:55:31 1999
***************
*** 237,244 ****
--- 237,246 ----
		return (error);
	data.page.audio.port[LEFT_PORT].channels = p0;
	data.page.audio.port[RIGHT_PORT].channels = p1;
+ /*
	data.page.audio.port[2].channels = p2;
	data.page.audio.port[3].channels = p3;
+ */
	return (cd_scsibus_set_mode(cd, &data, AUDIOPAGESIZE, flags));
  }

*************** 
*** 257,264 ****
--- 259,268 ----
		return (error);
	arg->vol[LEFT_PORT] = data.page.audio.port[LEFT_PORT].volume;
	arg->vol[RIGHT_PORT] = data.page.audio.port[RIGHT_PORT].volume;
+ /*
	arg->vol[2] = data.page.audio.port[2].volume;
	arg->vol[3] = data.page.audio.port[3].volume;
+ */
	return (0);
  }	     

***************
*** 278,285 ****
--- 282,291 ----
	data.page.audio.port[LEFT_PORT].volume = arg->vol[LEFT_PORT];
	data.page.audio.port[RIGHT_PORT].channels = CHANNEL_1;
	data.page.audio.port[RIGHT_PORT].volume = arg->vol[RIGHT_PORT];
+ /*
	data.page.audio.port[2].volume = arg->vol[2];
	data.page.audio.port[3].volume = arg->vol[3];
+ */
	return (cd_scsibus_set_mode(cd, &data, AUDIOPAGESIZE, flags));
  }
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: kern-bug-people->bouyer 
Responsible-Changed-By: fair 
Responsible-Changed-When: Wed Jan 16 04:15:18 PST 2002 
Responsible-Changed-Why:  
Manuel is one of our SCSI experts. 
State-Changed-From-To: open->closed 
State-Changed-By: jdc 
State-Changed-When: Sun Nov 3 13:22:49 PST 2002 
State-Changed-Why:  
Fixed by cd_scsi.c revision 1.27. 

From: Julian Coleman <jdc@netbsd.org>
To: gnats-bugs@gnats.netbsd.org
Cc:  
Subject: pr/7299 CVS commit: syssrc/sys/dev/scsipi
Date: Sun,  3 Nov 2002 23:14:29 +0200 (EET)

 Module Name:	syssrc
 Committed By:	jdc
 Date:		Sun Nov  3 21:14:28 UTC 2002

 Modified Files:
 	syssrc/sys/dev/scsipi: cd_scsi.c

 Log Message:
 Apply patch from Takeshi Nakayama on current-users which fixes problems
 when trying to play audio CD's on some drives.  The original message was :

 > In my analysis, rev 1.19 of cd_scsi.c used cd_scsibus_set_mode()
 > instead of scsipi_mode_select(). cd_scsibus_set_mode() had the code
 > which clear a data.header.data_length, but scsipi_mode_select()
 > does not have. So we need `data.header.data_length = 0;' before
 > calling scsipi_mode_select().

 Fixes PR 7299 and probably PR 15155 and PR 16883 too.


 To generate a diff of this commit:
 cvs rdiff -r1.26 -r1.27 syssrc/sys/dev/scsipi/cd_scsi.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.


From: James Chacon <jmc@netbsd.org>
To: gnats-bugs@gnats.netbsd.org
Cc:  
Subject: pr/7299 CVS commit: [netbsd-1-6] syssrc/sys/dev/scsipi
Date: Fri, 13 Dec 2002 09:52:00 +0200 (EET)

 Module Name:	syssrc
 Committed By:	jmc
 Date:		Fri Dec 13 07:51:59 UTC 2002

 Modified Files:
 	syssrc/sys/dev/scsipi [netbsd-1-6]: cd_scsi.c

 Log Message:
 Pull up revisions 1.26-1.27 (requested by jdc in ticket #969)
  Apply patch from Takeshi Nakayama on current-users which fixes problems
  when trying to play audio CD's on some drives.
  Fixes PR 7299 and probably PR 15155 and PR 16883 too.


 To generate a diff of this commit:
 cvs rdiff -r1.23 -r1.23.10.1 syssrc/sys/dev/scsipi/cd_scsi.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.