Re: CDROM: Hardware tray movement detection

David A. van Leeuwen (davl@cistron.nl)
Wed, 27 Aug 1997 21:30:58 +0200


Gerd Knorr wrote:

> >Once auto media change detection is available, all sorts of things become
> >possible. I, for one, have a drive that closes the tray when polled, so
> >workman is constantly closing the drive while I'm change the CD -- not good.
>
> Probably is'nt the drive, but linux. Most drivers close the tray if you
> open the device. But I don't know how workman polls (could do with open
> or ioctl).

Well, if the driver is supporting the `new' interface layer in cdrom.c,
you can
turn that behaviour off using the user level program `setcd' i wrote.

setcd -c 0 /dev/cdrom

Also, workman should be changed to `open for ioctl()'. There are
patches for
text-mode based playes at ftp.gwdg.de in pub/linux/cdrom/drivers/cm206.

It is trivial. Just change any

open("/dev/cdrom", O_RDONLY);

in

open("/dev/cdrom", O_RDONLY | O_NONBLOCK);

For rationel, read
/usr/src/linux/Documentation/cdrom/cdrom-standard.tex.

Setcd is in source form somewhere on sunsite (try .../cdrom) and it is
in a
Debian package in
http://www.debian.org/Packages/unstable/utils/setcd.html

---david

-- 
David A. van Leeuwen			<david@ElseWare.cistron.nl>
					http://davl.op.het.net

Echt stijlvol sterven doe je / bij een ander op de mat Op de dag dat je bezorgd wordt / door het NRC Handelsblad ---Joop Visser