CDROM_SELECT_SPEED interface problem

Erik Andersen (andersen@inconnect.com)
Wed, 18 Mar 1998 13:47:48 -0700 (MST)


I have been aware for a while that the CDROM_SELECT_SPEED ioctl has
a fundamental problem. I am bringing it up now because I (finally)
added CDROM_SELECT_SPEED support to ide-cd in 2.1.90. Here is the problem:

The current interface (as documented in Documentation/cdrom/cdrom-standard.tex)
states:

...The value of speed specifies the head-speed of the
drive, measured in units of standard cdrom speed (176 kB/sec raw data
or 150 kB/sec file system data). So to request that a cdrom drive
operate at 300 kB/sec you would call the CDROM_SELECT_SPEED ioctl
with speed=2. The special value `0' means `auto-selection'...

Ok, here is the problem. The ATAPI spec (and the SCSI spec) says that the
speed is specified in kbytes/second. It turns out that _most_ ATAPI cdrom
drives ( I don't know about SCSI) require the speed to be set to _certain_
values that are not even multiples of either 176 or 177 kbytes/second. In
fact, when I try to set the speed of one of my drives to 2 speed, it returns
an error because to change to double speed, it _requires_ that it be asked for
exactly 353 kbytes/second. The ATAPI standard is _very_ loose here on defining
drive behavior when they don't get what they want from SET SPEED, and my drives
return errors (which is a valid response).

I either need to build a table of magic values that can be used for each speed,
assuming these values are constant across _all_ ATAPI cdrom drives, or I need
to change the interface so that CDROM_SELECT_SPEED can be called with an
arbitrary speed in kbytes/second (let the drive and/or low-level cdrom driver
respond how it will).

I propose that the CDROM_SELECT_SPEED ioctl be modified as follows:

...The value of speed specifies the head-speed of the
drive, measured in units of kB/sec. So to request that a cdrom drive
operate at 706 kB/sec you would call the CDROM_SELECT_SPEED ioctl
with speed=706. The special value `0' means set the drive speed to
the maximum the drive supports. Additionally, all values below
100 (but greater then 0) shall be treated as requests to set the
speed based on units of standard cdrom speed (177 kB/sec*speed).
To request that a cdrom drive operate at 354 kB/sec you could call
the CDROM_SELECT_SPEED ioctl with speed=2. Note that this special
interface for speed less then 100 is depricated, and may go away
in some future kernel release.

How does this sound to everybody? Ok? Workable? Broken?

-Erik

ide-cd and Uniform cdrom maintainer

--
Erik B. Andersen   Web:    http://www.inconnect.com/~andersen/ 
                   email:  andersee@debian.org
--This message was written using 73% post-consumer electrons--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu