108 lines · plain
1.. SPDX-License-Identifier: GPL-2.02 3========================4SCSI Generic (sg) driver5========================6 7 200201268 9Introduction10============11The SCSI Generic driver (sg) is one of the four "high level" SCSI device12drivers along with sd, st and sr (disk, tape and CD-ROM respectively). Sg13is more generalized (but lower level) than its siblings and tends to be14used on SCSI devices that don't fit into the already serviced categories.15Thus sg is used for scanners, CD writers and reading audio CDs digitally16amongst other things.17 18Rather than document the driver's interface here, version information19is provided plus pointers (i.e. URLs) where to find documentation20and examples.21 22 23Major versions of the sg driver24===============================25There are three major versions of sg found in the Linux kernel (lk):26 - sg version 1 (original) from 1992 to early 1999 (lk 2.2.5) .27 It is based in the sg_header interface structure.28 - sg version 2 from lk 2.2.6 in the 2.2 series. It is based on29 an extended version of the sg_header interface structure.30 - sg version 3 found in the lk 2.4 series (and the lk 2.5 series).31 It adds the sg_io_hdr interface structure.32 33 34Sg driver documentation35=======================36The most recent documentation of the sg driver is kept at37 38- https://sg.danny.cz/sg/39 40This describes the sg version 3 driver found in the lk 2.4 series.41 42Documentation (large version) for the version 2 sg driver found in the43lk 2.2 series can be found at44 45- https://sg.danny.cz/sg/p/scsi-generic_long.txt.46 47The original documentation for the sg driver (prior to lk 2.2.6) can be48found in the LDP archives at49 50- https://tldp.org/HOWTO/archived/SCSI-Programming-HOWTO/index.html51 52A more general description of the Linux SCSI subsystem of which sg is a53part can be found at https://www.tldp.org/HOWTO/SCSI-2.4-HOWTO .54 55 56Example code and utilities57==========================58There are two packages of sg utilities:59 60 ========= ==========================================================61 sg3_utils for the sg version 3 driver found in lk 2.462 sg_utils for the sg version 2 (and original) driver found in lk 2.263 and earlier64 ========= ==========================================================65 66Both packages will work in the lk 2.4 series. However, sg3_utils offers more67capabilities. They can be found at: https://sg.danny.cz/sg/sg3_utils.html and68freecode.com69 70Another approach is to look at the applications that use the sg driver.71These include cdrecord, cdparanoia, SANE and cdrdao.72 73 74Mapping of Linux kernel versions to sg driver versions75======================================================76Here is a list of Linux kernels in the 2.4 series that had the new version77of the sg driver:78 79 - lk 2.4.0 : sg version 3.1.1780 - lk 2.4.7 : sg version 3.1.1981 - lk 2.4.10 : sg version 3.1.20 [#]_82 - lk 2.4.17 : sg version 3.1.2283 84.. [#] There were 3 changes to sg version 3.1.20 by third parties in the85 next six Linux kernel versions.86 87For reference here is a list of Linux kernels in the 2.2 series that had88the new version of the sg driver:89 90 - lk 2.2.0 : original sg version [with no version number]91 - lk 2.2.6 : sg version 2.1.3192 - lk 2.2.8 : sg version 2.1.3293 - lk 2.2.10 : sg version 2.1.34 [SG_GET_VERSION_NUM ioctl first appeared]94 - lk 2.2.14 : sg version 2.1.3695 - lk 2.2.16 : sg version 2.1.3896 - lk 2.2.17 : sg version 2.1.3997 - lk 2.2.20 : sg version 2.1.4098 99The lk 2.5 development series currently contains sg version 3.5.23100which is functionally equivalent to sg version 3.1.22 found in lk 2.4.17.101 102 103Douglas Gilbert104 10526th January 2002106 107dgilbert@interlog.com108