How do I get information about an optical disk?
I need information about the capabilities and state of the disk...specifically, if it's rewritable (capability) and if it's currently blank (state).
Currently, I'm using the output of hal-device to give me that information. The problem is, hald doesn't update the information in response to a burn event... this is a problem, because if a burn a blank disc, hal-device still lists it as blank...and if I blank a disk, hal still lists it as non-blank. Is there a method to force HAL to update a device, or is there a way to query the disk/drive directly to find out if the disk is blank and rewritable? Or even a method to determine if a disk is blank or not? Additionally, this is for a CD-burning application... so I'm intentionally trying to avoid anything hacky like ejecting the CD and reinserting it... anything of that nature. |
Err, might 'wodim' do it? Wodim sometimes ejects a disk and then sticks it in again, but that is automatic - you do not have to intervene. wodim -vv will make it very verbose.
|
Quote:
As for the "automatic" ejecting & reinsertion of the disk... that's true only in the case of drives with motorized trays. If you eject the disk on a laptop, for instance, the user would have to put the disk back in. But from what I read, wodim is a fork of cdrecord, which is currently what I'm using to burn disks, and also has the behavior of ejecting the disk... so I'd imagine it's the same code ejecting the disk in both cases. |
Quote:
Here's some output I just tried: Code:
wodim -vv -dummy ~/Iso/elive_2.0_Topaz_new-kernel_up002.iso |
Yeah, nothing in that report (or the one generated by cdrecord) really gives any information about the state of the disc in the drive.
I have since managed to cobble together some C code that'll directly query the drive for a "disc_information" struct, which tells me if the disc is erasable, and what state (blank, appendable, closed, unknown) the disc is in. But thank you for you help... I was hoping there'd be an easier way that SCSI interfacing ;-) |
Quote:
I have been facing the same issue reported by you ( libhal detects blank media as non-blank) with DVD/Blu-Ray rewritable discs. Can you please share the code to query the "disc_information", that you've written and mentioned above. Thanks. |
All times are GMT -5. The time now is 05:40 PM. |