hello,
i was wondering if any of you knew of a relatively inexpensive way to poll the cdrom drive. Is there a signal that could be caught, or is there another way to do this asychronously?
hello,
i was wondering if any of you knew of a relatively inexpensive way to poll the cdrom drive. Is there a signal that could be caught, or is there another way to do this asychronously?
Sorry for bumping, but i should probably clarify. I just need to know when a cd is inserted into the drive. If there is a way to do this without polling, i would sure like to know. I'm trying to learn about computers on my own so please be patient.
About the only way I can think of is to see if the CDROM device (usually /dev/cdrom) has a mounted filesystem on it. That information should be available in your /etc/mtab file.
starX
www.axisoftime.com
right, but wouldn't that effectively be the same as polling? I would have to keep searching that file for the same info, and that would waste CPU time. I was hoping the kernel would be so kind as to notify my process through a signal of some sort, but oh well.
This part of a larger project to encode audio cd's to .ogg files. The above code should run as a daemon, and when a cd is inserted, it should rip it, encode it, store it's info in a small database, store the album in its proper location, and then eject the cd. Since i want it to run as a daemon, CPU usage is key issue.
i guess i could look throught the source code for autorun.
there may be snmp traps for cdroms.
have a look and net-snmp.
Thanks i will. is there anything wrong with using select or poll. i've noticed that both of those calls block until the device "wakes up". That would work too wouldn't it? Any more guru input?