Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Dec 1995 18:21:01 -0800
From:      Stu Phillips <stu@solaris.com>
To:        freebsd-bugs@freefall.freebsd.org
Cc:        jkh@time.cdrom.com
Subject:   Re: xcdplayer and SCSI Problem with Sony CDU-76S
Message-ID:  <199512280221.SAA00201@solaris.cisco.com>

next in thread | raw e-mail | index | archive | help
I recently installed a quad speed CDROM under FreeBSD 2.1 release - it worked
fine *except* that xcdplayer kept generating:

    cd0(bt0:4:0): ILLEGAL REQUEST asc:26,0 Invalid field in parameter list

messages whenever it was used.

The archives on freebsd.org suggested that this was due to SONY not following
the SCSI-II specs for CDROM audio - must confess, I found this hard to 
accept especially since a generic SCSI CD player under Windows played CDs
just fine.

After a fair bit of SCSI hacking I found the problem;  Here is the addition
I made to /sys/scsi/cd.c in the routine cd_set_mode:

errval
cd_set_mode(unit, data)
        u_int32 unit;
        struct cd_mode_data *data;
{
        struct scsi_mode_select scsi_cmd;

        bzero(&scsi_cmd, sizeof(scsi_cmd));
        scsi_cmd.op_code = MODE_SELECT;
        scsi_cmd.byte2 |= SMS_PF;
        scsi_cmd.length = sizeof(*data) & 0xff;
        scsi_cmd.length = 0;
        data->header.data_length = 0;
/********************* The following line added ***********************/
        data->header.medium_type = 0;
        return (scsi_scsi_cmd(SCSI_LINK(&cd_switch, unit),
                (struct scsi_generic *) &scsi_cmd,
                sizeof(scsi_cmd),
                (u_char *) data,
                sizeof(*data),
                CDRETRIES,
                2000,           /* should be immed */
                NULL,
                SCSI_DATA_OUT));
}


According to the SCSI-II spec (BTW, there is a great on-line copy of this
spec available at URL: http://abekas.com:8080/SCSI2/), in section 8.3.3, it
says that the medium field of the mode parameter header *may* be RESERVED
by some device types.

The SONY CDU-076S returns this field as 0x03 on a MODE_SENSE but complains
if it is set to anything other than 0x00 on a MODE_SELECT.  

xcdplayer caused the above error to be generated when issuing an ioctl
for CDIOCCPLAYMSF to start the device playing - in cd_ioctl, it was the
cd_set_mode call that was failing rather than the actual PLAYMSF command.

I haven't got any other CDROMs to test this patch against (sorry it isn't
in context diff form but it is just a one liner); however, setting the
medium field to 0x00 is the default value so I suspect its unlikely to cause
any problems with other CDROM drives other than SONY's.


Due to the limited testing, I'm sending this to the bug list rather than
submitting as a candidate bug fix.  If anyone cares to try this with other
drives, let me know and I'll collect the feedback.

Happily listening to CDs on my SONY CDU-76S.... (< $150 at NCA here in the
Bay Area - special sale - maybe I now know why ;-)....

Stu



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199512280221.SAA00201>