[SOLVED] How do I get information about an optical disk?
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
I'm unfamiliar with wodim, but I've run across it a few times during my (fruitless) google searching for methods to get that information. I'll download it and play around with it, thank you for the suggestion.
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.
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.
Yes it is a fork of cdrecord, so if you're using that there is no point in wodim - which may be Debian specific, don't know.
Here's some output I just tried:
Code:
wodim -vv -dummy ~/Iso/elive_2.0_Topaz_new-kernel_up002.iso
wodim: No write mode specified.
wodim: Asuming -tao mode.
wodim: Future versions of wodim may have different drive dependent defaults.
TOC Type: 1 = CD-ROM
wodim: Operation not permitted. Warning: Cannot raise RLIMIT_MEMLOCK limits.Device was not specified. Trying to find an appropriate drive...
Looking for a CD-R drive to store 690.27 MiB...
Detected CD-R drive: /dev/cdrw
Using /dev/cdrom of unknown capabilities
scsidev: '/dev/cdrom'
devname: '/dev/cdrom'
scsibus: -2 target: -2 lun: -2
Linux sg driver version: 3.5.27
Wodim version: 1.1.9
Using libusal version 'Cdrkit-1.1.9'.
Driveropts: 'burnfree'
SCSI buffer size: 64512
Device type : Removable CD-ROM
Version : 5
Response Format: 2
Capabilities :
Vendor_info : 'TSSTcorp'
Identification : 'CDDVDW TS-H653N '
Revision : '0208'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Current: 0x000A (CD-RW)
Profile: 0x0015 (DVD-R/DL sequential recording)
Profile: 0x0016 (DVD-R/DL layer jump recording)
Profile: 0x002B (DVD+R/DL)
Profile: 0x001B (DVD+R)
Profile: 0x001A (DVD+RW)
Profile: 0x0014 (DVD-RW sequential recording)
Profile: 0x0013 (DVD-RW restricted overwrite)
Profile: 0x0012 (DVD-RAM)
Profile: 0x0011 (DVD-R sequential recording)
Profile: 0x0010 (DVD-ROM)
Profile: 0x000A (CD-RW) (current)
Profile: 0x0009 (CD-R)
Profile: 0x0008 (CD-ROM)
Profile: 0x0002 (Removable disk)
Drive current speed: 4
Drive default speed: 4
Drive max speed : 4
Selected speed : 4
Using generic SCSI-3/mmc CD-R/CD-RW driver (mmc_cdr).
Driver flags : MMC-3 SWABAUDIO BURNFREE
Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R
Drive buf size : 1962752 = 1916 KB
Beginning DMA speed test. Set CDR_NODMATEST environment variable if device
communication breaks or freezes immediately after that.
FIFO size : 12582912 = 12288 KB
Track 01: data 690 MB
track: 1 start: 0 pregap: 150
Total size: 792 MB (78:32.24) = 353418 sectors
Lout start: 793 MB (78:34/18) = 353418 sectors
41 00 00 14 00 00 00 00
41 01 00 10 00 00 00 00
41 01 01 10 00 00 02 00
41 AA 01 14 00 4E 22 12
Track 1 start 0
Track 2 start 353418
Current Secsize: 2048
ATIP info from disk:
Indicated writing power: 6
Reference speed: 2
Is not unrestricted
Is erasable
ATIP start of lead in: -11078 (97:34/22)
ATIP start of lead out: 359849 (79:59/74)
1T speed low: 0 (reserved val 0) 1T speed high: 4
2T speed low: 0 (reserved val 5) 2T speed high: 0 (reserved val 12)
power mult factor: 3 5
recommended erase/write power: 3
A1 values: 02 3A B0
A2 values: 5C C6 26
Disk type: Phase change
Manuf. index: 11
Manufacturer: Mitsubishi Chemical Corporation
Trying to clear drive status.
Speed set to 706 KB/s
wodim: Drive needs to reload the media to return to proper status.
wodim: Cannot get next writable address for 'invisible' track.
wodim: This means that we are checking recorded media.
wodim: This media cannot be written in streaming mode anymore.
wodim: If you like to write to 'preformatted' RW media, try to blank the media first.
wodim: WARNING: Data may not fit on standard 74min disk.
Speed set to 706 KB/s
Starting to write CD/DVD at speed 4.0 in dummy TAO mode for single session.
Last chance to quit, starting dummy write in 0 seconds. Operation starts.
Waiting for reader process to fill input buffer ... input buffer ready.
Errno: 5 (Input/output error), read track info scsi sendcmd: no error
CDB: 52 01 00 00 00 FF 00 00 1C 00
status: 0x2 (CHECK CONDITION)
Sense Bytes: 70 00 05 00 00 00 00 0A 00 00 00 00 30 06 00 00
Sense Key: 0x5 Illegal Request, Segment 0
Sense Code: 0x30 Qual 0x06 (cannot format medium - incompatible medium) Fru 0x0
Sense flags: Blk 0 (not valid)
cmd finished after 0.000s timeout 240s
wodim: Cannot get next writable address for 'invisible' track.
wodim: This means that we are checking recorded media.
wodim: This media cannot be written in streaming mode anymore.
wodim: If you like to write to 'preformatted' RW media, try to blank the media first.
wodim: Cannot get next writable address.
Writing time: 0.025s
Average write speed 999.0x.
Fixating...
WARNING: Some drives don't like fixation in dummy mode.
Fixating time: 0.003s
BURN-Free was never needed.
wodim: fifo had 191 puts and 0 gets.
wodim: fifo was 0 times empty and 0 times full, min fill was 100%.
Last edited by lugoteehalt; 07-22-2010 at 04:56 PM.
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 ;-)
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 ;-)
Hi,
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.