Cdrom tray status
Hi,
Is there anyway I can check status on weather the tray is open or close on my cd-rom drive in bash? The CD shouldn't be mounted once inserted. Only knowledge of that a CD is in the drive is sufficient. Thanks Indy |
One possible way would be to use hal.
If there's a disk in the drive then lshal should show it. If you run "lshal -m" (monitor mode) as you insert the disk, it will show you what entries get added. Then you can use "lshal |grep [one of those lines]" to determine when a disk is present. I believe it can display when a device is mounted as well. Note that I'm not a hal expert though, so there are probably better ways to go about it. |
Hi david,
I only have hal-get-property. But I'm having some trouble using it. I also have to assume that system doen't have lshal utility. Is it still possible? Indy |
Hi.
If you've got cdrecord installed (you probably do), you can use: $ cdrecord -V --inq dev=DEVICE 2>&1 | grep "medium not present" replace DEVICE with /dev/whatever for the drive. If the grep returns a line (and exits with 0), there's nothing in the drive. Dave |
ilikejam,
that works. Thanks. It's a shame that there is no simpler check... But one has to be thankfull for whatever one get... Indy |
All times are GMT -5. The time now is 04:41 PM. |