cdu31a broken on CDROMPLAYTRKIND

David E. Smith (dave@bureau42.ml.org)
Thu, 14 May 1998 15:38:16 +0000 (GMT)


Somewhere between 2.0.33 and 2.1.101 - sorry for the vagueness - the
cdu31a driver seems to have picked up a small glitch.

I recently decided that 2.1.x was probably worth a try, since I finally
got it to build :-) Anyway, playing audio CDs now tends to fail,
depositing these messages on the screen and in syslog:

Params: 3 13 21 37 79 16 10
Sony CDROM error illegal parameter (CDROMPLAYTRKIND)

These params are: the constant 0x03, and the M/S/F of the start and stop
points respectively. (For the interminably curious, this came from using
my lousy cli CD player, dcd, on Fleetwood Mac's "The Dance," starting at
track 4. And yes, I checked, `79 16 10' is indeed the correct address of
the last frame of the last track of the disk.)

This error only manifests when I try a CDROMPLAYTRKIND that involves
the end of the disc. Everything else appears to work. (I checked it with
several discs, in case it was some odd overflow-thingie; even 20-minute
discs choke. I don't have any shorter than that, sorry.)

Here's the relevant snippo from my code, sans ugly #ifdef's ...

u_char play_track (u_char trknum) {
struct cdrom_ti trkidx;
if (lflag>0)
return play_one_track(trknum);
/* coughHACK!cough for looping behaviour */

memset (&trkidx, 0, sizeof(struct cdrom_ti));
trkidx.cdti_trk0 = trknum;
trkidx.cdti_trk1 = trackz;
ioctl(cdrive, CDROMSTOP); /* has to be stopped to reset, dunno why */
ioctl(cdrive, CDROMPLAYTRKIND, &trkidx);
playing = 1;
return trknum;
} /* play_track */

trackz is initialized thusly, which (as stolen from other CD players)
seems to be the right way to do it...

/* initialize hardware */
ioctl(cdrive, CDROMREADTOCHDR, &tochdr);
tracka = tochdr.cdth_trk0;
trackz = tochdr.cdth_trk1;

(For the hecklers: yes, I did check with other CD players too, for once
it's not my code that's broken. :)

The linux/drivers/cdrom/cdu31a.c driver _looks_like_ it catches this error
condition, but this doesn't seem to be the case. To my untrained,
barely-awake eye, it looks like the problem lies somewhere in the juggling
of res_size and/or res_reg.

Further, and much to the credit of kernel hackers everywhere, this seems
to be the only bug. As long as I don't use the value of the last track (or
CDROM_LEADOUT) things work just fine. Other CD-ROM operations work as
well; it's just CDROMPLAYTRKIND when trk1 >= the last track number on the
disc.

Anyway, the real point of this mail: How exactly does one get friendly
with the kernel source? I'm an amateur C coder at best, and a 3600-line
driver isn't exactly the place I was hoping to start. :)

...dave

----- David E. Smith, P O Box 324, Cape Girardeau MO 63702
http://bureau42.base.org/people/dave/ dave@bureau42.ml.org

New Microsoft motto: Gehirnwasche die Kinder, wenn sie jung sind. In
ihrem Erwachsensein sind sie Ihre bereiten Sklaven. (Brainwash the
children when they're young. As adults, they'll be your willing slaves.)
-- Bascule, with Harka on vocals

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