Date: Thu, 9 Nov 2000 12:26:26 -0700 From: "Kenneth D. Merry" <ken@kdm.org> To: Graham Guttocks <graham_guttocks@yahoo.co.nz> Cc: freebsd-hardware@FreeBSD.ORG, freebsd-scsi@FreeBSD.ORG Subject: Re: query CD-ROM status from within a program? Message-ID: <20001109122625.A32056@panzer.kdm.org> In-Reply-To: <20001109050905.87034.qmail@web10307.mail.yahoo.com>; from graham_guttocks@yahoo.co.nz on Thu, Nov 09, 2000 at 06:09:05PM %2B1300 References: <20001109050905.87034.qmail@web10307.mail.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Nov 09, 2000 at 18:09:05 +1300, Graham Guttocks wrote: > Greetings, > > I'm looking for a way to manipulate a CD-ROM drive from within a shell > script (ksh, perl, python, whatever). I need to be able to eject the > tray, and also query whether the tray contains a disc or is empty from > within the program. The first is easily accomplished with a utility like > "eject", but how about the latter? Is there an easy way to tell whether > a FreeBSD system's CD-ROM drive contains a disk or not? You can eject the CD with camcontrol: camcontrol eject cd0 Or with cdcontrol: cdcontrol -f /dev/cd0c eject You can determine whether the drive is ready with camcontrol: camcontrol tur cd0 -v -C 2 -E Or with cdcontrol: cdcontrol -f /dev/cd0c status It might be easier to use camcontrol in a script, since it will exit with a non-zero status if the drive isn't ready. Ken -- Kenneth Merry ken@kdm.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-scsi" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001109122625.A32056>