From owner-freebsd-hardware Sun Dec 17 7: 5:55 2000 From owner-freebsd-hardware@FreeBSD.ORG Sun Dec 17 07:05:51 2000 Return-Path: Delivered-To: freebsd-hardware@freebsd.org Received: from osiris.ipform.ru (osiris.ipform.ru [212.158.165.98]) by hub.freebsd.org (Postfix) with ESMTP id E9B1B37B400; Sun, 17 Dec 2000 07:05:47 -0800 (PST) Received: from wp2 (wp2 [192.168.0.12]) by osiris.ipform.ru (8.11.1/8.11.1) with SMTP id eBHF5V320402; Sun, 17 Dec 2000 18:05:36 +0300 (MSK) (envelope-from matrix@ipform.ru) Message-ID: <003e01c0683a$cfad3200$0c00a8c0@ipform.ru> From: "Artem Koutchine" To: Cc: Subject: CD detection from a c program Date: Sun, 17 Dec 2000 18:05:29 +0300 Organization: IP Form MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6600 X-Mimeole: Produced By Microsoft MimeOLE V5.00.2919.6600 Sender: owner-freebsd-hardware@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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-hardware" in the body of the message