Subj : Re: How to detect cdrom tray status (open or closed) To : comp.os.linux From : Mihai Osian Date : Wed Oct 06 2004 05:42 pm Sybren Stuvel wrote: >Sybren Stuvel enlightened us with: > > >>Minderbinder enlightened us with: >> >> >>>Try looking for the source code of the "eject" utility >>> >>> >>I will. >> >> > >Unfortunately, my suspicions were correct. 'eject' doesn't do any >detection of the tray status. It just sends a CDROMEJECT ioctl when >you invoke it, and a CDROMCLOSETRAY when you pass it the '-t' option. > >I want to send CDROMCLOSETRAY only when it's open, and CDROMEJECT only >when it's closed. > >Sybren > > There is a CDROM_DRIVE_STATUS ioctl defined in /usr/include/linux/cdrom.h. Perhaps it can help you. Mihai .