Thread: ?polling? the cdrom drive.

  1. #1

    ?polling? the cdrom drive.


    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?

  2. #2
    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.

  3. #3
    Registered User
    Join Date
    Aug 2001
    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.


  4. #4
    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.

  5. #5
    Registered User
    Join Date
    Aug 2002
    there may be snmp traps for cdroms.

    have a look and net-snmp.

  6. #6
    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?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SATA HDD failure
    By PING in forum Tech Board
    Replies: 4
    Last Post: 12-23-2008, 12:25 AM
  2. Replies: 2
    Last Post: 07-06-2005, 07:11 PM
  3. Drive letter
    By opafire in forum C++ Programming
    Replies: 8
    Last Post: 04-22-2004, 08:02 PM
  4. Spin A Drive and such
    By Seph_31 in forum C Programming
    Replies: 15
    Last Post: 11-20-2003, 06:04 PM
  5. How to format my Pc?
    By CaseY in forum A Brief History of
    Replies: 7
    Last Post: 01-22-2002, 12:18 PM