Carl Lowenstein wrote:
> When I put a blank CD-R in the drive, after several seconds an icon
> labeled "Blank CD-R Disc" appears on the desktop.  Is there some
> command-line way to recognize this?
> 
> I am trying to make my CD-burning shell script more foolproof.  If I
> start the script too soon, the call to /usr/bin/cdrecord bombs out
> with a message about "non-writeable disc".  I think this really means
> that the system hasn't gotten around to noticing the presence of the
> blank.  If I wait until the icon is visible, then there is no problem.
> 

I have absolutely no reason to believe this is the right thing to do,
but a couple of 'messin-around' experiments shows that

  dd if=/dev/cdrom bs=512 count=1 of=/dev/null
  mount /dev/cdrom /mnt
both contain "No medium found" if the drive is empty (no disc present)
  file -s /dev/sr0
reports /dev/sr0: writable, no read permission

With a blank writable disc,
  dd reports Input/Output error
  mount reports a different error
 /dev/sr0: reports empty

All of them first close the tray if it is open.

There _must_ be something in /proc or /sys to look at but I'll be darned
if I can find it. Maybe Gus knows.

Regards,
..jim


-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to