[ale] Detetcting a DVD in the drive?
Brian Pitts
brian at polibyte.com
Mon Aug 24 23:10:22 EDT 2009
On 08/24/2009 06:28 PM, Robert L. Harris wrote:
>
> I am trying to write a script for a friend to automatically dump an
> ISO to a
> DVD, but I am looking for a way to detect a DVD in the drive. Anyone have
> a way to do this? "mt -f /dev/cdrom status" fails, unsurprisingly....
>
> Robert
>
Something like the following, assuming there's only one optical drive in
the system.
brian at triangle:~$ DRIVE=$(hal-find-by-capability --capability
"storage.cdrom")
brian at triangle:~$ echo $DRIVE
/org/freedesktop/Hal/devices/storage_model_DVD__RW_TS_L632D
brian at triangle:~$ MEDIA=$(hal-get-property --udi $DRIVE --key
storage.removable.media_available)
brian at triangle:~$ echo $MEDIA
true
brian at triangle:~$ eject
brian at triangle:~$ MEDIA=$(hal-get-property --udi $DRIVE --key
storage.removable.media_available)
brian at triangle:~$ echo $MEDIA
false
I thought that
hal-find-by-property --key "storage.removable.media_available" --string
"true"
would work, but apparently hal-find-by-property only works when the key
values are strings, and this key value is boolean? That's the best
explanation I could come up with.
--
All the best,
Brian Pitts
More information about the Ale
mailing list