Blame view

Documentation/scsi/scsi-generic.rst 4.31 KB
d4d79340f   Mauro Carvalho Chehab   scsi: docs: conve...
1
2
3
4
5
  .. SPDX-License-Identifier: GPL-2.0
  
  =======================================
  Notes on Linux SCSI Generic (sg) driver
  =======================================
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
6
                                                          20020126
d4d79340f   Mauro Carvalho Chehab   scsi: docs: conve...
7

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  Introduction
  ============
  The SCSI Generic driver (sg) is one of the four "high level" SCSI device
  drivers along with sd, st and sr (disk, tape and CDROM respectively). Sg
  is more generalized (but lower level) than its siblings and tends to be
  used on SCSI devices that don't fit into the already serviced categories.
  Thus sg is used for scanners, CD writers and reading audio CDs digitally
  amongst other things.
  
  Rather than document the driver's interface here, version information
  is provided plus pointers (i.e. URLs) where to find documentation
  and examples.
  
  
  Major versions of the sg driver
  ===============================
  There are three major versions of sg found in the linux kernel (lk):
d4d79340f   Mauro Carvalho Chehab   scsi: docs: conve...
25
        - sg version 1 (original) from 1992 to early 1999 (lk 2.2.5) .
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
26
27
28
29
30
31
32
33
34
35
  	It is based in the sg_header interface structure.
        - sg version 2 from lk 2.2.6 in the 2.2 series. It is based on
  	an extended version of the sg_header interface structure.
        - sg version 3 found in the lk 2.4 series (and the lk 2.5 series).
  	It adds the sg_io_hdr interface structure.
  
  
  Sg driver documentation
  =======================
  The most recent documentation of the sg driver is kept at the Linux
d4d79340f   Mauro Carvalho Chehab   scsi: docs: conve...
36
37
38
  Documentation Project's (LDP) site:
  
  - http://www.tldp.org/HOWTO/SCSI-Generic-HOWTO
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
39
  This describes the sg version 3 driver found in the lk 2.4 series.
d4d79340f   Mauro Carvalho Chehab   scsi: docs: conve...
40

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
41
42
  The LDP renders documents in single and multiple page HTML, postscript
  and pdf. This document can also be found at:
d4d79340f   Mauro Carvalho Chehab   scsi: docs: conve...
43
44
  
  - http://sg.danny.cz/sg/p/sg_v3_ho.html
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
45
46
  
  Documentation for the version 2 sg driver found in the lk 2.2 series can
0ea6e6112   Justin P. Mattock   Documentation: up...
47
48
  be found at http://sg.danny.cz/sg/. A larger version
  is at: http://sg.danny.cz/sg/p/scsi-generic_long.txt.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
49
50
51
52
53
54
  
  The original documentation for the sg driver (prior to lk 2.2.6) can be
  found at http://www.torque.net/sg/p/original/SCSI-Programming-HOWTO.txt
  and in the LDP archives.
  
  A changelog with brief notes can be found in the
d4d79340f   Mauro Carvalho Chehab   scsi: docs: conve...
55
56
57
  /usr/src/linux/include/scsi/sg.h file. Note that the glibc maintainers copy
  and edit this file (removing its changelog for example) before placing it
  in /usr/include/scsi/sg.h . Driver debugging information and other notes
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
58
  can be found at the top of the /usr/src/linux/drivers/scsi/sg.c file.
d4d79340f   Mauro Carvalho Chehab   scsi: docs: conve...
59
  A more general description of the Linux SCSI subsystem of which sg is a
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
60
61
62
63
64
65
  part can be found at http://www.tldp.org/HOWTO/SCSI-2.4-HOWTO .
  
  
  Example code and utilities
  ==========================
  There are two packages of sg utilities:
d4d79340f   Mauro Carvalho Chehab   scsi: docs: conve...
66
67
68
69
  
      =========   ==========================================================
      sg3_utils   for the sg version 3 driver found in lk 2.4
      sg_utils    for the sg version 2 (and original) driver found in lk 2.2
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
70
                  and earlier
d4d79340f   Mauro Carvalho Chehab   scsi: docs: conve...
71
      =========   ==========================================================
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
72
  Both packages will work in the lk 2.4 series however sg3_utils offers more
d4d79340f   Mauro Carvalho Chehab   scsi: docs: conve...
73
  capabilities. They can be found at: http://sg.danny.cz/sg/sg3_utils.html and
1f8ee46b4   Masanari Iida   Documentation: Fi...
74
  freecode.com
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
75
76
77
78
79
80
81
82
83
  
  Another approach is to look at the applications that use the sg driver.
  These include cdrecord, cdparanoia, SANE and cdrdao.
  
  
  Mapping of Linux kernel versions to sg driver versions
  ======================================================
  Here is a list of linux kernels in the 2.4 series that had new version
  of the sg driver:
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
84

d4d79340f   Mauro Carvalho Chehab   scsi: docs: conve...
85
86
87
88
89
90
91
       - lk 2.4.0 : sg version 3.1.17
       - lk 2.4.7 : sg version 3.1.19
       - lk 2.4.10 : sg version 3.1.20 [#]_
       - lk 2.4.17 : sg version 3.1.22
  
  .. [#] There were 3 changes to sg version 3.1.20 by third parties in the
         next six linux kernel versions.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
92

d4d79340f   Mauro Carvalho Chehab   scsi: docs: conve...
93
  For reference here is a list of linux kernels in the 2.2 series that had
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
94
  new version of the sg driver:
d4d79340f   Mauro Carvalho Chehab   scsi: docs: conve...
95
96
97
98
99
100
101
102
103
  
       - lk 2.2.0 : original sg version [with no version number]
       - lk 2.2.6 : sg version 2.1.31
       - lk 2.2.8 : sg version 2.1.32
       - lk 2.2.10 : sg version 2.1.34 [SG_GET_VERSION_NUM ioctl first appeared]
       - lk 2.2.14 : sg version 2.1.36
       - lk 2.2.16 : sg version 2.1.38
       - lk 2.2.17 : sg version 2.1.39
       - lk 2.2.20 : sg version 2.1.40
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
104
105
106
  
  The lk 2.5 development series has recently commenced and it currently
  contains sg version 3.5.23 which is functionally equivalent to sg
d4d79340f   Mauro Carvalho Chehab   scsi: docs: conve...
107
  version 3.1.22 found in lk 2.4.17.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
108
109
110
  
  
  Douglas Gilbert
d4d79340f   Mauro Carvalho Chehab   scsi: docs: conve...
111

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
112
  26th January 2002
d4d79340f   Mauro Carvalho Chehab   scsi: docs: conve...
113

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
114
  dgilbert@interlog.com