Subject: CDIOCPLAY... fails
To: NetBSD current-users mailing list <current-users@netbsd.org>
From: Julian Coleman <J.D.Coleman@newcastle.ac.uk>
List: current-users
Date: 03/14/1999 18:19:26
I've been looking to find the reason why CDIOCPLAYTRACKS, etc. fail to
work on some CD players (and cause a bus reset), and work but cause an
error on others. I think I know the reason but I don't have a solution yet.
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.)
The simple solution is just to comment out the code that refers to these
channels, but 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.
I must admit that this is the first time I've looked at the SCSI code and
spec in detail, so a few pointers would be helpful, e.g. some code calling
CDIOCREADSUBCHANNEL. I wonder if it would make sense to call this at attach
time, but I'm not sure what happens if you call READ SUB-CHANNEL without a
CD in the player or with a data only CD. Any insights appreciated.
Thanks,
J
--
NetBSD - the most widely ported operating system available