CDROM: Hardware tray movement detection

Tim P. Gerla (timg@means.net)
Tue, 26 Aug 1997 11:18:51 -0500 (CDT)


Erik and the rest of the linux-kernel peoples:

Hi. I've been hacking the cdrom driver to make it detect disk changes a
bit more reliably. For example, if I am playing an audio CD, and I exit
the player, press the eject button on my drive, put a new CD in, and press
the eject button once again to close the drive, there is no 'hdX: media
changed' message. Thus, my player won't update the toc entries on the
CD...

Everything works fine as-is if you use software tray movement ioctls.

My question:

Is there any way to detect *hardware* tray movement, and afterward, detect
a disk change?

I've been looking in /usr/src/linux/drivers/cdrom/cdrom.c, but I can't
find anything there. It could be a more model-specific thing, but ide-cd.c
doesn't seem to have anything either. The closest routine I have seen in
ide-cd.c is ide_cdrom_tray_move(). I added a
ide_cdrom_check_media_change() call to that function, but ...tray_move is
only called when software tray movement is detected. :(

Please let me know if I'm going in the right direction. This is my first
real kernel hack. :)

Thanks!

-Tim

--
Tim P. Gerla | timg@means.net | http://www.cjnetworks.com/~coryb/timg/
OS: Linux 2.1.51. Machine: AMD 486/120, 36MB, 4.3gig.