"Tsphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget%/translations/zh_CN/scsi/scsi-genericmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget%/translations/zh_TW/scsi/scsi-genericmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget%/translations/it_IT/scsi/scsi-genericmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget%/translations/ja_JP/scsi/scsi-genericmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget%/translations/ko_KR/scsi/scsi-genericmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget%/translations/sp_SP/scsi/scsi-genericmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhh?/var/lib/git/docbuild/linux/Documentation/scsi/scsi-generic.rsthKubhsection)}(hhh](htitle)}(hSCSI Generic (sg) driverh]hSCSI Generic (sg) driver}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh block_quote)}(h 20020126 h]h paragraph)}(h20020126h]h20020126}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(h Introductionh]h Introduction}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhK ubh)}(hXThe SCSI Generic driver (sg) is one of the four "high level" SCSI device drivers along with sd, st and sr (disk, tape and CD-ROM 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.h]hXThe SCSI Generic driver (sg) is one of the four “high level” SCSI device drivers along with sd, st and sr (disk, tape and CD-ROM 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.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hRather than document the driver's interface here, version information is provided plus pointers (i.e. URLs) where to find documentation and examples.h]hRather than document the driver’s interface here, version information is provided plus pointers (i.e. URLs) where to find documentation and examples.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubeh}(h] introductionah ]h"] introductionah$]h&]uh1hhhhhhhhK ubh)}(hhh](h)}(hMajor versions of the sg driverh]hMajor versions of the sg driver}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubhdefinition_list)}(hhh]hdefinition_list_item)}(hXThere are three major versions of sg found in the Linux kernel (lk): - sg version 1 (original) from 1992 to early 1999 (lk 2.2.5) . 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. h](hterm)}(hDThere are three major versions of sg found in the Linux kernel (lk):h]hDThere are three major versions of sg found in the Linux kernel (lk):}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1j6hhhK hj2ubh definition)}(hhh]h bullet_list)}(hhh](h list_item)}(hnsg version 1 (original) from 1992 to early 1999 (lk 2.2.5) . It is based in the sg_header interface structure.h]h)}(hnsg version 1 (original) from 1992 to early 1999 (lk 2.2.5) . It is based in the sg_header interface structure.h]hnsg version 1 (original) from 1992 to early 1999 (lk 2.2.5) . It is based in the sg_header interface structure.}(hjVhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjRubah}(h]h ]h"]h$]h&]uh1jPhjMubjQ)}(hvsg 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.h]h)}(hvsg 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.h]hvsg 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.}(hjnhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjjubah}(h]h ]h"]h$]h&]uh1jPhjMubjQ)}(hmsg version 3 found in the lk 2.4 series (and the lk 2.5 series). It adds the sg_io_hdr interface structure. h]h)}(hksg version 3 found in the lk 2.4 series (and the lk 2.5 series). It adds the sg_io_hdr interface structure.h]hksg version 3 found in the lk 2.4 series (and the lk 2.5 series). It adds the sg_io_hdr interface structure.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jPhjMubeh}(h]h ]h"]h$]h&]bullet-uh1jKhhhKhjHubah}(h]h ]h"]h$]h&]uh1jFhj2ubeh}(h]h ]h"]h$]h&]uh1j0hhhK hj-ubah}(h]h ]h"]h$]h&]uh1j+hjhhhNhNubeh}(h]major-versions-of-the-sg-driverah ]h"]major versions of the sg driverah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hSg driver documentationh]hSg driver documentation}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK#ubh)}(h9The most recent documentation of the sg driver is kept ath]h9The most recent documentation of the sg driver is kept at}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK$hjhhubjL)}(hhh]jQ)}(hhttps://sg.danny.cz/sg/ h]h)}(hhttps://sg.danny.cz/sg/h]h reference)}(hjh]hhttps://sg.danny.cz/sg/}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jhjubah}(h]h ]h"]h$]h&]uh1hhhhK&hjubah}(h]h ]h"]h$]h&]uh1jPhjhhhhhNubah}(h]h ]h"]h$]h&]jjuh1jKhhhK&hjhhubh)}(hBThis describes the sg version 3 driver found in the lk 2.4 series.h]hBThis describes the sg version 3 driver found in the lk 2.4 series.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK(hjhhubh)}(hdDocumentation (large version) for the version 2 sg driver found in the lk 2.2 series can be found ath]hdDocumentation (large version) for the version 2 sg driver found in the lk 2.2 series can be found at}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK*hjhhubjL)}(hhh]jQ)}(h0https://sg.danny.cz/sg/p/scsi-generic_long.txt. h]h)}(h/https://sg.danny.cz/sg/p/scsi-generic_long.txt.h](j)}(h.https://sg.danny.cz/sg/p/scsi-generic_long.txth]h.https://sg.danny.cz/sg/p/scsi-generic_long.txt}(hj/hhhNhNubah}(h]h ]h"]h$]h&]refurij1uh1jhj+ubh.}(hj+hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK-hj'ubah}(h]h ]h"]h$]h&]uh1jPhj$hhhhhNubah}(h]h ]h"]h$]h&]jjuh1jKhhhK-hjhhubh)}(hdThe original documentation for the sg driver (prior to lk 2.2.6) can be found in the LDP archives ath]hdThe original documentation for the sg driver (prior to lk 2.2.6) can be found in the LDP archives at}(hjThhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK/hjhhubjL)}(hhh]jQ)}(hBhttps://tldp.org/HOWTO/archived/SCSI-Programming-HOWTO/index.html h]h)}(hAhttps://tldp.org/HOWTO/archived/SCSI-Programming-HOWTO/index.htmlh]j)}(hjkh]hAhttps://tldp.org/HOWTO/archived/SCSI-Programming-HOWTO/index.html}(hjmhhhNhNubah}(h]h ]h"]h$]h&]refurijkuh1jhjiubah}(h]h ]h"]h$]h&]uh1hhhhK2hjeubah}(h]h ]h"]h$]h&]uh1jPhjbhhhhhNubah}(h]h ]h"]h$]h&]jjuh1jKhhhK2hjhhubh)}(hA more general description of the Linux SCSI subsystem of which sg is a part can be found at https://www.tldp.org/HOWTO/SCSI-2.4-HOWTO .h](h]A more general description of the Linux SCSI subsystem of which sg is a part can be found at }(hjhhhNhNubj)}(h)https://www.tldp.org/HOWTO/SCSI-2.4-HOWTOh]h)https://www.tldp.org/HOWTO/SCSI-2.4-HOWTO}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jhjubh .}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK4hjhhubeh}(h]sg-driver-documentationah ]h"]sg driver documentationah$]h&]uh1hhhhhhhhK#ubh)}(hhh](h)}(hExample code and utilitiesh]hExample code and utilities}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK9ubh)}(h'There are two packages of sg utilities:h]h'There are two packages of sg utilities:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK:hjhhubh)}(hX%========= ========================================================== 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 and earlier ========= ========================================================== h]htable)}(hhh]htgroup)}(hhh](hcolspec)}(hhh]h}(h]h ]h"]h$]h&]colwidthK uh1jhjubj)}(hhh]h}(h]h ]h"]h$]h&]colwidthK:uh1jhjubhtbody)}(hhh](hrow)}(hhh](hentry)}(hhh]h)}(h sg3_utilsh]h sg3_utils}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK=hjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(h+for the sg version 3 driver found in lk 2.4h]h+for the sg version 3 driver found in lk 2.4}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK=hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh](j)}(hhh]h)}(hsg_utilsh]hsg_utils}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK>hj<ubah}(h]h ]h"]h$]h&]uh1jhj9ubj)}(hhh]h)}(hFfor the sg version 2 (and original) driver found in lk 2.2 and earlierh]hFfor the sg version 2 (and original) driver found in lk 2.2 and earlier}(hjVhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK>hjSubah}(h]h ]h"]h$]h&]uh1jhj9ubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]colsKuh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhhhK