Tejun Heo wrote: > Quite some number of ODDs don't seem to like the way hald polls them. I > don't think other apps will be affected by this. I dunno much about > hald and don't have enough time to chase it down myself but feel free to > cc me when reporting this to hald people. I'll try to help as much as I > can. > > Thanks. > > -- > tejun > I've attached the test programs that I wrote about earlier. cdstatus.c causes a timeout after a few hours but cdstatus_working.c doesn't seem to get a timeout. The timeout always occurs during open. -- Matthew Stapleton
#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/ioctl.h> #include <stdio.h> #include <unistd.h> #include <linux/cdrom.h> int main(void) { int fd, capabilities, drive; char *cddrive = "/dev/cdrom"; while (1) { printf("Opening %s\n", cddrive); fd = open (cddrive, O_RDONLY | O_NONBLOCK); if (fd < 0) { printf("Error\n"); return 1; } printf("Sleeping\n"); sleep(1); printf("Closing %s\n", cddrive); close(fd); printf("Sleeping\n"); sleep(1); } return 0; }
#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/ioctl.h> #include <stdio.h> #include <unistd.h> #include <linux/cdrom.h> int main(void) { int fd, capabilities, drive; char *cddrive = "/dev/cdrom"; printf("Opening %s\n", cddrive); fd = open (cddrive, O_RDONLY | O_NONBLOCK); if (fd < 0) { printf("Error\n"); return 1; } while (1) { ioctl (fd, CDROM_SET_OPTIONS, CDO_USE_FFLAGS); capabilities = ioctl (fd, CDROM_GET_CAPABILITY, 0); drive = ioctl (fd, CDROM_DRIVE_STATUS, CDSL_CURRENT); printf("capabilities=0x%08X, drive=0x%08X\n", capabilities, drive); sleep(1); } close(fd); return 0; }