[GRLUG] detecting cd insertion

Kaminski, Dennis J Dennis.Kaminski at dematic.com
Tue Dec 12 15:15:16 EST 2006


Dave,
I'm guessing the best way would be to query the device, but I've never
done it with a cdrom. I remember querying a tape drive a long time ago.

On my system, which has a dvd/rw, the value in file
/proc/ide/ide0/hda/capacity changes depending what is in the drive.
Empty = 0
Blank CD = 4
Blank DVD = 4
Data CD = some large value like 864192 or 1299096 depending on data
volume
Audio CD = 938428 (only had 1 audio cd)


Dennis J Kaminski


-----Original Message-----
From: grlug-bounces at grlug.org [mailto:grlug-bounces at grlug.org] On Behalf
Of David Pembrook
Sent: Tuesday, December 12, 2006 2:22 PM
To: GRLUG general mailing list
Subject: [GRLUG] detecting cd insertion

I'm making a real basic media player with debian. Just to play music 
through the stereo in the living room. I've got the ripping all set and 
I can eject the cd when its done. The one thing I can't find an easy 
solution for is detecting when I put a new cd in. I've got an old slot 
load cdrom drive that would be perfect if I can figure this one out.

I've looked at ivman which looks like one way to do it. It won't compile

complaining about some xml lib. Its got an xml configuration I guess 
from what I saw.

Oh and this is destined to be a closet computer. No monitor, no 
keyboard, just a music player. X could be installed I guess, Kinda 
overkill though. If I go that far, I'll just put mythtv in for the 
pretty visuals on the tv while playing my music.

I'd like to keep it kiss, any thoughts?

Thanks,
Dave
_______________________________________________
grlug mailing list
grlug at grlug.org
http://shinobu.grlug.org/cgi-bin/mailman/listinfo/grlug


More information about the grlug mailing list