[Debburn-devel] Problems about wodim --devices with SATA or ide-scsi

scdbackup at gmx.net scdbackup at gmx.net
Tue Feb 27 20:52:07 CET 2007


Hi,

while trying to learn about the pitfalls of Eduard Martinescu's
SATA drive, i wondered why wodim --devices did not issue addresses
like /dev/sg1 .
In  wodim/scsi_scan.c i read:
  snprintf(devname, sizeof (devname), "/dev/sg%c", 'a'+i-26-256);

Shouldn't that rather be :
                                 ..., "/dev/sg%d", i-26-256);
After all we want /dev/sg[0-9] and not /dev/sg[a-z].

-----

I experienced another problem with cdrkit-1.1.2 when running
option --devices on my oldfashioned kernel 2.4 system
which has its burners under ide-scsi:

  $ wodim --devices
  Beginning native device scan. This may take a while if devices are busy...
  wodim: Invalid argument. Cannot set SG_SET_TIMEOUT.
  $

The abort happens when inquiring /dev/hde which is under
ide-scsi control. 
  brw-rw-rw-  1 root  disk   33,   0 Sep 23  2003 /dev/hde
It also happens with /dev/sr0 ( = /dev/hdc which offers no
rw permissions to the test user).
On kernel 2.4 both device families are unusable for Linux
SG_* ioctls.

The exit is done in  librols/comerr.c  line 238 from inside
the device scan loop. 
  #0  0x0807ac84 in comexit ()
  #1  0x0807ac76 in _comerr ()
  #2  0x0807ab26 in comerr ()
  #3  0x08079d77 in sg_settimeout ()
  #4  0x080791a7 in sg_initdev ()
  #5  0x08079114 in sg_setup ()
  #6  0x08078cab in usalo_open ()
  #7  0x0807271f in usal__open ()
  #8  0x080720da in usal_open ()
  #9  0x08086dfe in scan_devices ()
  #10 0x0804d62b in main ()

comerr() seems to fixely imply exit().
So in sg_settimeout() one would need a less harsh reaction
on a device file which is just not suitable.

It looks not uncomplicated to equip above function
stack with the ability to handle a SCSI transport problem
gracefully and to return to scan_devices().


After disabling "/dev/hd%c" and "/dev/sr%d" and after
changing "/dev/sg%c" to "/dev/sg%d", i get:
  $ wodim --devices
  Beginning native device scan. This may take a while if devices are busy...
  wodim: Overview of accessible drives (2 found) :
  ----------------------------------------------------------------------
  0    dev='/dev/sg0'   rwrwrw :  '_NEC'  'DVD_RW ND-4570A'
  1    dev='/dev/sg1'   rwrwrw :  'HL-DT-ST'  'DVDRAM GSA-4082B'
  ----------------------------------------------------------------------

So if it is possible to detect kernel 2.4 at runtime then a
simple solution would be to only iterate over "/dev/sg%d".

Andy Polyakov's dvd+rw-tools use the following gesture for a
similar decision.  dvd+rw-tools-7.0/transport.hxx :
    USE_SG_IO() { struct utsname buf;
                    uname (&buf);
                    // was CDROM_SEND_PACKET declared dead in 2.5?
                    yes_or_no=(strcmp(buf.release,"2.5.43")>=0);
                }


Btw: i wonder why wodim iterates over /dev/sr* which is
supposed to cover a subset of /dev/sg* devices. Did i miss
a new convention about Linux SCSI ?


Have a nice day :)

Thomas




More information about the Debburn-devel mailing list