Unmounting and 'eject' press
Ikke
eikke at eikke.com
Thu Jun 3 05:45:00 PDT 2004
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) {
perror("open");
return 1;
}
if(ioctl(fd, CDROM_LOCKDOOR, 0) < 0)
perror("cdrom tray lock");
return 0;
}
gcc -o test test.c
mount /mnt/cdrom
./test
(press eject, cd ejects, I get error messages in syslog)
When running dbus-monitor --system while doing this test, Hal seems to send
a dbus message when the CD gets removed, so umounting should be possible :-)
Only need to implement some 'device is busy' test or something alike...
Maybe it's not the best solution, but well, I'll implement it temporarly in
ivman
Regards, Ikke
_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal
More information about the Hal
mailing list