Some notes on the Linux SCSI implementation:

When using cdrecord with the Linux SCSI generic driver, you should note that cdrecord uses a hack, that tries to emulate the functionality of the scg driver.
The scg driver is a driver that I write in 1986 for SunOS 3.0 Unfortunately, the sg driver on Linux has several severe design bugs:
  • It cannot see if a SCSI command could not be sent at all.
  • It cannot get the SCSI status byte. .B Cdrecord for that reason cannot report failing SCSI commands in some situations.
    The developers of the SANE project have been irritated when realising
    on Solaris that a scanner often return BUSY status on some commands.
    This is invisible on Linux.
  • It cannot get real DMA count of transfer. Cdrecord cannot tell you if there is an DMA residual count.
    This makes it impossible to use Linux to develop SCSI applications.
    If a developer cannot see if his new program interacts the right way with the drive,
    and if the drive really transfers the assumed number of bytes for a command,
    it is possible that the new application will not work correctly.
  • It cannot get number of bytes valid in auto sense data. Cdrecord cannot tell you if device transfers no sense data at all.
  • It fetches to few data in auto request sense (CCS/SCSI-2/SCSI-3 needs >= 18).
    SCSI-2 compliant and newer drives often include a pointer to the exact position
    of an illegal bit in the SCSI command. On Linux you cannot see this hint.
  • It cannot send SCSI commands with vendor unique lengths.

    In April 1998, Heiko Eißfeldt and I created a new programming interface for the sg driver. This new interface is implemented and published in cdrecord since August 1998. At this time, it was not possible to convince any of the persons listed in the Linux kernel documentation for a need for a better sg programming interface and Heiko and I became some sort of dejected.

    The new interface includes new fields in the sg header structure that allows to fix all current problems except the fact that sg only transfers 16 bytes of sense data. The new fields are introduced in a way that keeps source and binary compatibility. However, for most of the new fields, the SCSI mid-level code of Linux must be enhanced too to allow the user of the enhanded libscg interface to actually use the new features. Unfortunately neither Alan Cox nor Douglas Gilbert seem to understand that this enhanced programming interface is really needed besides the fact that there is a need for better DMA support in the sg driver. Douglas Gilbert started working on the sg driver in January 1999 and modified the sg programming interface in a way that will not allow me to get access to the needed information in future.

    As Douglas Gilbert's current interface will not help me with my needs, I will not implement support for the current version of the modified interface from Douglas Gilbert and rather wait for an sg driver that will again adopt to my interface that gives me similar information to the interface that has been proved for 13 years in my scg driver. You may read Douglas Gilbert's ideas at this place and my discussion of all three driver interfaces and decide by your own. A sg driver that implements my programming interface and Douglas Gilbert's DMA enhancements can be found here. It allows you to run more than one cdrecord simultaneously.

    Please don't use Douglas Gilbert's "patches" to my file scsi-linux-sg.c it does not properly report all bits in the SCSI status byte. Cdrecord-1.8a21 and newer will give you better error handling if you use an sg driver that implements Heiko's and my new sgdriver interface. Such an driver for Linus-2.2.x can be found here and a driver enhancement for Linux-2.0.x and 2.1.x can be found in in this patch.

    If you have problems with the Linux SCSI user level interface, that might be related to the changes by Douglas Gilbert, don't send mail to me, but ask Douglas Gilbert or Alan Cox. Note, that Douglas Gilbert's changes seem to be integrated in Linux-2.2.6, so please ask Alan Cox, why he break his promise to hold any changes back until we could find a solution that is accepted by all people.


    GMD GMD Homepage GMD FOKUS FOKUS Homepage Schily Schily's Homepage Schily Cdrecord VED powered