[1557] in linux-scsi channel archive
CDROMCLOSETRAY for SCSI broken in 2.1.x
daemon@ATHENA.MIT.EDU (Paul Gortmaker)
Fri Mar 14 08:47:45 1997
From: Paul Gortmaker <paul@rasty.anu.edu.au>
To: linux-scsi@vger.rutgers.edu
Date: Sat, 15 Mar 1997 00:56:00 +1000 (EST)
Note that in the following, the program "close" is just a simple
wrapper around ioctl(fd, CDROMCLOSETRAY, NULL) - nothing complex.
Eject is the standard eject program from Red Hat v4.1.
------------------------ 2.0.29 ---------------------------------
ratbag:/home/paul# dmesg -c > /dev/null
ratbag:/home/paul# eject
ratbag:/home/paul# /tmp/close /dev/scd0
Tray for CD-ROM device "/dev/scd0" is now closed.
ratbag:/home/paul# dmesg
Disc change detected.
VFS: Disk change detected on device 0b:00
VFS: Disk change detected on device 0b:00
VFS: Disk change detected on device 0b:00
ratbag:/home/paul# uname -a
Linux ratbag.anu.edu.au 2.0.29 #53 Sat Feb 22 12:20:12 EST 1997 i486
ratbag:/home/paul#
----------------------------------------------------------------
but now things are borken in that if the drive is open, you can't get a
file descriptor to issue the CDROMCLOSETRAY ioctl() over, which is a
bit of a catch-22, as seen below.
---------------------------------------------------------------
ratbag:/home/paul# dmesg -c > /dev/null
ratbag:/home/paul# eject
ratbag:/home/paul# /tmp/close /dev/scd0
/dev/scd0: No such device or address
ratbag:/home/paul# dmesg
sr: use "Sony group" multisession code
VFS: Disk change detected on device 0b:00
Device not ready. Make sure there is a disc in the drive.
Device not ready. Make sure there is a disc in the drive.
ratbag:/home/paul# uname -a
Linux ratbag.anu.edu.au 2.1.28 #6 Fri Mar 7 21:46:05 EST 1997 i486
ratbag:/home/paul#
---------------------------------------------------------------
The close.c does a stat; open? perror: ioctl(); and as per strace:
stat(0xbffffdd8, {st_mode=S_IFBLK|0660, st_rdev=makedev(11, 0), ...}) = 0
open(0xbffffdd8, O_RDONLY) = -1 ENXIO (No such device or address)
Paul.