From owner-freebsd-questions Mon Dec 18 7:37:33 2000 From owner-freebsd-questions@FreeBSD.ORG Mon Dec 18 07:37:28 2000 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from peorth.iteration.net (peorth.iteration.net [208.190.180.178]) by hub.freebsd.org (Postfix) with ESMTP id 28D4837B400; Mon, 18 Dec 2000 07:37:28 -0800 (PST) Received: by peorth.iteration.net (Postfix, from userid 1001) id 1CC3F5747B; Mon, 18 Dec 2000 09:37:29 -0600 (CST) Date: Mon, 18 Dec 2000 09:37:28 -0600 From: "Michael C . Wu" To: Artem Koutchine Cc: questions@FreeBSD.ORG, hardware@FreeBSD.ORG Subject: Re: CD detection from a c program Message-ID: <20001218093728.B66439@peorth.iteration.net> Reply-To: "Michael C . Wu" References: <003e01c0683a$cfad3200$0c00a8c0@ipform.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <003e01c0683a$cfad3200$0c00a8c0@ipform.ru>; from matrix@ipform.ru on Sun, Dec 17, 2000 at 06:05:29PM +0300 X-PGP-Fingerprint: 5025 F691 F943 8128 48A8 5025 77CE 29C5 8FA1 2E20 X-PGP-Key-ID: 0x8FA12E20 Sender: keichii@peorth.iteration.net Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, Dec 17, 2000 at 06:05:29PM +0300, Artem Koutchine scribbled: | 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 Please see the cdcontrol(8) source, or the code in ports/audio/grip and the code in mount(8) -- +------------------------------------------------------------------+ | keichii@peorth.iteration.net | keichii@bsdconspiracy.net | | http://peorth.iteration.net/~keichii | Yes, BSD is a conspiracy. | +------------------------------------------------------------------+ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message