Unmounting and 'eject' press

Paul Ionescu paul at acorp.ro
Sun Jun 13 18:18:40 PDT 2004

Hi Ikke,

Also a  
echo 0 >  /proc/sys/dev/cdrom/lock 
will do the same trick.

        Ok, I did the testings.
        To unlock the tray: very simple
        #include <stdio.h>
        #include <fcntl.h>
        #include <sys/ioctl.h>
        #include <linux/cdrom.h>
        int main()
                int fd;
                fd = open("/dev/hdc", O_RDONLY | O_NONBLOCK);
                if (fd == -1) {
                        return 1;
                if(ioctl(fd, CDROM_LOCKDOOR, 0) < 0)
                         perror("cdrom tray lock");
                return 0;
        gcc -o test test.c
        mount /mnt/cdrom
        (press eject, cd ejects, I get error messages in syslog)

hal mailing list
hal at freedesktop.org

More information about the Hal mailing list