Re: cdrom problem(s)

Jens Axboe (axboe@image.dk)
Fri, 03 Sep 1999 10:08:52 +0200


BOSZORMENYI Zoltan wrote:
> Hi!
>
> One of my friends complained about when he played MP3s
> from a cd, the CD drive always spinned down. So when
> the mp3 player wanted another chunk from the disc the
> sound stopped until the drive spinned up again.
> No, I do not want to start the "streaming IO" thread again.
> :-)
>
> First, we tried to disable the spindown with hdparm
> but that did not worked, the command succeeded but
> the drive spinned down even after that.
>
> Next, we experimented with the drive capabilities
> whether the drive supports setting its speed.
> The program can be found here:
> ftp://ftp.externet.hu/pub/people/zboszor/cdprobe.c

It's not the speed setting you should be after, but
rather CDROMSETSPINDOWN (and the equivalent GETSPINDOWN).

> Here came the first problem: we tried several kernel
> versions and some IDE drives: (a RedHat 6.0 shipped)
> 2.2.5-15, a 2.2.12, 2.3.15 and 2.3.16 and a 16x Toshiba
> CD-ROM and a 8x <I do not know which vendor> one.
>
> With 2.2.x the capability mask was 0xfff and with 2.3.15
> it was 0x3ffff, which are definitely wrong.

What do you mean? I assume you just mean the capability
bits minus the mask.

> The CDC_SELECT_DISC bit should appear only on CD
> changers, right? And the CDC_SELECT_SPEED bit appears
> on the 8x CD-ROM which fails to set its speed. :-(
> (2.3.x was not tested on this drive, yet.)

I have fixed these up in 2.3.x mostly, 2.2 was awful
when it came to this. Basically just set all capabilities.

> And the drives are CD-ROMs, not CD-R, not CD-RW
> and not DVD, so 2.3.15 is plain wrong in reporting
> capabilities.

2.3.15 is not plain wrong in reporting capabilities,
but many drives are!

> With 2.3.16, we got 0x1fef on my drive, which seems
> to reflect the correct capabilities of the drive.

It is getting better.

> But with 2.3.16, we have another problem:
> it does not play audio CDs. Starting CD player
> applications fail with packet error on a vanilla
> 2.3.16 and other lines show up in dmesg or on the
> console:
>
> /dev/cdrom: Wrong medium type
> cdrom: pid X is buggy!
> cdrom: open failed.
>
> After applying the posted cdrom fix, we do not get
> the packet error but those lines do appear.

The second patch that followed had a correction to
that error message - it just wasn't very telling what
exactly was wrong. Basically, fix the cd playing
application to open the device O_NONBLOCK.

> We tried to recompile cdp against 2.3.16.
> At first the compilation failed because there is an
> #include <linux/types.h> line in include/linux/cdrom.h.
> One of the source files of cdp includes <linux/cdrom.h>
> and <sys/types.h> and these conflict. Using
>
> #ifdef __KERNEL__
> #include <linux/types.h>
> #endif
>
> in cdrom.h solves the compilation error but the
> audio CD playing problem remains.

That's a mistake, thanks! Add the O_NONBLOCK and you
should be fine.

-- 
*  Jens Axboe <axboe@image.dk>
*  Linux CD-ROM Maintainer
*  http://www.kernel.dk

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/