LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 07-21-2010, 03:43 PM   #1
captfoss
LQ Newbie
 
Registered: Jul 2010
Posts: 3

Rep: Reputation: 0
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.
 
Old 07-21-2010, 09:22 PM   #2
lugoteehalt
Senior Member
 
Registered: Sep 2003
Location: UK
Distribution: Debian
Posts: 1,215
Blog Entries: 2

Rep: Reputation: 49
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.
 
Old 07-22-2010, 10:20 AM   #3
captfoss
LQ Newbie
 
Registered: Jul 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by lugoteehalt View Post
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.
 
Old 07-22-2010, 03:48 PM   #4
lugoteehalt
Senior Member
 
Registered: Sep 2003
Location: UK
Distribution: Debian
Posts: 1,215
Blog Entries: 2

Rep: Reputation: 49
Quote:
Originally Posted by captfoss View Post
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.
 
Old 07-22-2010, 04:02 PM   #5
captfoss
LQ Newbie
 
Registered: Jul 2010
Posts: 3

Original Poster
Rep: Reputation: 0
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 ;-)
 
Old 01-14-2011, 03:17 AM   #6
dbhat76
LQ Newbie
 
Registered: Jan 2011
Posts: 2

Rep: Reputation: 0
Quote:
Originally Posted by captfoss View Post
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.

Thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
optical drive and hard disk partition scheme forusword Linux - Hardware 6 05-09-2010 07:46 AM
Need a script to check optical disk volume or content TheOne...More Programming 27 06-12-2008 12:05 AM
Optical Disk Drive: no risk of damage when on the move? hanzj Linux - Laptop and Netbook 3 03-23-2005 12:57 AM
Magneto-Optical Disk Media judge_neo Linux - Hardware 1 10-30-2004 12:55 PM
what could you do with an optical disk library? Brain Drop General 1 05-29-2003 01:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 06:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration