Date: Sun, 17 Dec 2000 18:05:29 +0300 From: "Artem Koutchine" <matrix@ipform.ru> To: <questions@FreeBSD.ORG> Cc: <hardware@FreeBSD.ORG> Subject: CD detection from a c program Message-ID: <003e01c0683a$cfad3200$0c00a8c0@ipform.ru>
next in thread | raw e-mail | index | archive | help
Hello! I need to write the following program (it might be a daemon as well): 1) Sit and wait for a CD to be inserted 2) If CD is an AUDIO cd then DO THING1 (play cd) 3) if a CD is a DATA cd then DO THING2 (scan for mp3s, run mp3 player) 4) is a CD is an OTHER cd type the DO THING3 (play video?, nuts..) 5) If CD is ejected then do THING4 I have no problems with the THINGS :) But i do have trouble with 1) Detecting the moment when a cd is inserted. Is there some kind of event? Or must I poll the drive every second? 2) Detecting the type of CD. I have no clue how to do it. 3) Detecting the moment when the user press the eject button But that is not all of it. For the item (3) i have to MOUNT the CD in order to read the files, but if i mount it, it will be locked, so the EJECT button will not be usable. So, there are two ways to avoid it: 1) Have an event when EJECT button pressed on the drive 2) Do not lock the drive when disk mounted (is it possible?) In case if you wonder why i need all of it I am building a home multimedia system. It is pentium mmx based, w/o monitor, all output goes to the LCD display on the from pannel (20x4), a little keyboard is attach on the from pannel (custom made but fully PS/2 compatible), also, IR control is available via IRDA port. No fans, very quite, one HDD which is powered down automatically after the boot and whenever not needed. One LM7001 bases ISA FM card. The hardware is ready and tested by now. Now I have to do the software. I think this will be the first time such thing is done using FreeBSD. Regards, Artem To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?003e01c0683a$cfad3200$0c00a8c0>