{"id":4676,"date":"2022-12-20T18:36:45","date_gmt":"2022-12-20T21:36:45","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/sanescsi-man5\/"},"modified":"2022-12-20T18:36:45","modified_gmt":"2022-12-20T21:36:45","slug":"sanescsi-man5","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/sanescsi-man5\/","title":{"rendered":"sane&minus;scsi (man5)"},"content":{"rendered":"<h1 align=\"center\">sane\u2212scsi<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#GENERAL INFO\">GENERAL INFO<\/a><br \/> <a href=\"#FREEBSD INFO\">FREEBSD INFO<\/a><br \/> <a href=\"#LINUX INFO\">LINUX INFO<\/a><br \/> <a href=\"#SOLARIS, OPENSTEP AND NEXTSTEP INFO\">SOLARIS, OPENSTEP AND NEXTSTEP INFO<\/a><br \/> <a href=\"#ENVIRONMENT\">ENVIRONMENT<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#AUTHOR\">AUTHOR<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">sane\u2212scsi \u2212 SCSI adapter tips for scanners<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This manual page contains various operating-system specific tips and tricks on how to get scanners with a SCSI interface working.<\/p>\n<h2>GENERAL INFO <a name=\"GENERAL INFO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">For scanners with a SCSI interface, it may be necessary to edit the appropriate backend configuration file before using SANE for the first time. For most systems, the configuration file should list the name of the generic SCSI device that the scanner is connected to (e.g., under Linux, <i>\/dev\/sg4<\/i> or <i>\/dev\/sge<\/i> is such a generic SCSI device). It is customary to create a symlink from <i>\/dev\/scanner<\/i> to the generic SCSI device that the scanner is connected to. In this case, the configuration file simply lists the line <i>\/dev\/scanner<\/i>. For a detailed description of each backend\u2019s configuration file, please refer to the relevant backend manual page (e.g., <b>sane\u2212epson<\/b>(5) for Epson scanners, <b>sane\u2212hp<\/b>(5) for HP scanners, etc.).<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">For some operating systems (e.g. Linux and OS\/2), there is an alternate way of specifying scanner devices. This alternate way allows one to identify scanners by the SCSI vendor and model string and\/or by the SCSI device address (consisting of bus number, channel number, id, and logical unit number). The syntax for specifying a scanner in this way is:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">scsi <i>VENDOR MODEL TYPE BUS CHANNEL ID LUN<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">where <i>VENDOR<\/i> is the SCSI vendor string, <i>MODEL<\/i> is the SCSI model string, <i>TYPE<\/i> is type SCSI device type string, <i>BUS<\/i> is the SCSI bus number (named &#8220;host&#8221; in <i>\/proc\/scsi\/scsi<\/i>), <i>CHANNEL<\/i> is the SCSI channel number, <i>ID<\/i> is the SCSI id, and <i>LUN<\/i> is the logical unit number of the scanner device. The first two fields are strings which must be enclosed in double-quotes if they contain any whitespace. The remaining four fields are non-negative integer numbers. The correct values for these fields can be found by using operating system specific tools, e.g. for Linux by looking at the output of the command <i>cat \/proc\/scsi\/scsi<\/i>. To simplify configuration, a field\u2019s value can be replaced with an asterisk symbol (\u2018\u2018*\u2019\u2019). An asterisk has the effect that any value is allowed for that particular field. This can have the effect that a single scsi-line matches multiple devices. When this happens, each matching device will be probed by the backend one by one and registered if the backend thinks it is a compatible device. For example, the line<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">scsi MUSTEK MFS\u221206000CX Scanner 0 00 03 00<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">would attach the Mustek SCSI scanner with the following \/proc\/scsi\/scsi entry:<\/p>\n<p style=\"margin-left:14%; margin-top: 1em\">Host: scsi0 Channel: 00 Id: 03 Lun: 00 <br \/> Vendor: MUSTEK Model: MFS\u221206000CX Rev: 4.04 <br \/> Type: Scanner ANSI SCSI revision: 0<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Usually it\u2019s sufficient to use vendor and model strings only or even only the vendor string. The following example<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">scsi MUSTEK bodies manpages.csv script_extrae_body.sh script.sh usr bodies manpages.csv script_extrae_body.sh script.sh usr bodies manpages.csv script_extrae_body.sh script.sh usr bodies manpages.csv script_extrae_body.sh script.sh usr bodies manpages.csv script_extrae_body.sh script.sh usr *<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">would have the effect that all SCSI devices in the system with a vendor string of MUSTEK would be probed and recognized by the backend.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">If the remainder of a scsi-string consists of asterisks only, the asterisks can be omitted. For example, the following line is equivalent to the one specified previously:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">scsi MUSTEK<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">On some platforms (e.g., OpenStep), SANE device names take a special form. This is explained below in the relevant platform-specific section.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">When using a SCSI scanner, ensure that the access permission for the generic SCSI device is set appropriately. We recommend to add a group &#8220;scanner&#8221; to <i>\/etc\/group<\/i> which contains all users that should have access to the scanner. The permission of the device should then be set to allow group read and write access. For example, if the scanner is at generic SCSI device <i>\/dev\/sg0<\/i>, then the following two commands would set the permission correctly:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">$ chgrp scanner \/dev\/sg0 <br \/> $ chmod 660 \/dev\/sg0<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">When your system uses the device filesystem (devfs), you have to edit <i>\/etc\/devfs\/perms.<\/i> There you should search the line<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">REGISTER ^sg[^\/]* PERMISSIONS root.root 0600<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">and add a new line (eg. for changing permissions of sg4):<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">REGISTER ^sg4 PERMISSIONS root.scanner 0660<\/p>\n<h2>FREEBSD INFO <a name=\"FREEBSD INFO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Auto-configuration using the &#8220;scsi *&#8221; lines in the config files only works if the user running the frontend has read\/write access to <i>\/dev\/xpt0<\/i>. Instead, you can also set a link <i>\/dev\/scanner<\/i> to the appropriate <i>\/dev\/uk<\/i> device.<\/p>\n<p style=\"margin-left:22%;\">Adaptec AHA1542CF<\/p>\n<p style=\"margin-left:32%;\">Reported to work fine under FreeBSD 2.2.2R with the <b>aha<\/b> driver.<\/p>\n<p style=\"margin-left:22%;\">Adaptec 2940<\/p>\n<p style=\"margin-left:32%;\">Reported to work fine under FreeBSD 2.2.2.<\/p>\n<p style=\"margin-left:22%;\">Adaptec 1522<\/p>\n<p style=\"margin-left:32%;\">The scanner probes ok but any attempt to access it <i>hangs<\/i> the entire system. It looks like something is disabling interrupts and then not re-enabling them, so it looks like a bug in the FreeBSD <b>aic<\/b> driver.<\/p>\n<p style=\"margin-left:22%;\">Adaptec 1505<\/p>\n<p style=\"margin-left:32%;\">Works on FreeBSD 2.2.5R and 3.0 using the <b>aic<\/b> driver, provided that Plug-and-Play support is disabled on the card. If there are no <i>uk<\/i> devices, just do a <i>sh MAKEDEV uk0<\/i> in the <i>\/dev<\/i> directory. The scanner should then be accessible as <i>\/dev\/uk0<\/i> if it was probed during boot.<\/p>\n<p style=\"margin-left:22%;\">Tekram DC390<\/p>\n<p style=\"margin-left:32%;\">Reported to work fine under FreeBSD 2.2.2R with the <b>amd<\/b> driver.<\/p>\n<h2>LINUX INFO <a name=\"LINUX INFO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">First, make sure your kernel has SCSI generic support enabled. In <i>make xconfig<\/i>, this shows up under \u2018\u2018SCSI support->SCSI generic support\u2019\u2019.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">To keep scanning times to a minimum, it is strongly recommended to use a large buffer size for the generic SCSI driver. From SG driver version 2.0 on, the maximum buffer size can be changed at program run time, and there is no restriction in size. This driver version is part of the Linux kernels from version 2.2.7 on. If the new SG driver is available some backends (e.g. <b>sane\u2212umax<\/b>(5), <b>sane\u2212mustek<\/b>(5)<b>, sane\u2212sharp<\/b>(5)) automatically request larger SCSI buffers. If a backend does not automatically request a larger SCSI buffer, set the environment variable <b>SANE_SG_BUFFERSIZE<\/b> to the desired buffer size in bytes. It is not recommended to use more than 1 MB, because for large values the probability increases that the SG driver cannot allocate the necessary buffer(s). For ISA cards, even 1 MB might be a too large value. For a detailed discussion of memory issues of the SG driver, see <i>http:\/\/www.torque.net\/sg.<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">For Linux kernels before version 2.2.7 the size of the buffer is only 32KB. This works, but for many cheaper scanners this causes scanning to be slower by about a factor of four than when using a size of 127KB. Linux defines the size of this buffer by macro <b>SG_BIG_BUFF<\/b> in header file <i>\/usr\/include\/scsi\/sg.h<\/i>. Unless a system is seriously short on memory, it is recommended to increase this value to the maximum legal value of 128*1024-512=130560 bytes. After changing this value, it is necessary to recompile both the kernel (or the SCSI generic module) and the SCSI backends. Keep in mind that this is only necessary with older Linux kernels.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">A common issue with SCSI scanners is what to do when you booted the system while the scanner was turned off. In such a case, the scanner won\u2019t be recognized by the kernel and SANE won\u2019t be able to access it. Fortunately, Linux provides a simple mechanism to probe a SCSI device on demand. Suppose you have a scanner connected to SCSI bus 2 and the scanner has a SCSI id of 5. When the system is up and running and the scanner is turned on, you can issue the command:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">echo &#8220;scsi add\u2212single\u2212device 2 0 5 0&#8221; > \/proc\/scsi\/scsi<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">and the kernel will probe and recognize your scanner (this needs to be done as root). It\u2019s also possible to dynamically remove a SCSI device by using the \u2018\u2018remove\u2212single\u2212device\u2019\u2019 command. For details, please refer to to the SCSI-2.4-HOWTO.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Scanners are known to work with the following SCSI adapters under Linux. This list isn\u2019t complete, usually any SCSI adapter supported by Linux should work.<\/p>\n<p style=\"margin-left:22%;\">Acard\/Advance SCSI adapters<\/p>\n<p style=\"margin-left:32%;\">Some old versions of the kernel driver (<i>atp870u.c<\/i>) cut the inquiry information. Therefore the scanner couldn\u2019t be detected correctly. Use a current kernel.<\/p>\n<p style=\"margin-left:22%;\">Adaptec AHA-1505\/AHA-1542\/AHA-2940<\/p>\n<p style=\"margin-left:32%;\">Reported to work fine with Linux since v2.0. If you encounter kernel freezes or other unexpected behaviour get the latest Linux kernel (2.2.17 seems to work) or reduce SCSI buffer size to 32 kB.<\/p>\n<p style=\"margin-left:22%;\">ASUS SC200<\/p>\n<p style=\"margin-left:32%;\">Reported to work fine with Linux v2.0.<\/p>\n<p style=\"margin-left:22%;\">BusLogic BT958<\/p>\n<p style=\"margin-left:32%;\">To configure the BusLogic card, you may need to follow these instructions (contributed by Jeremy <jeremy@xxedgexx.com>): During boot, when your BusLogic adapter is being initialized, press Ctrl-B to enter your BusLogic adapter setup. Choose the address which your BusLogic containing your scanner is located. Choose \u2018\u2018SCSI Device Configuration\u2019\u2019. Choose \u2018\u2018Scan SCSI Bus\u2019\u2019. Choose whatever SCSI id that contains your scanner and then choose \u2018\u2018View\/Modify SCSI configuration\u2019\u2019. Change \u2018\u2018Negotiation\u2019\u2019 to \u2018\u2018async\u2019\u2019 and change \u2018\u2018Disconnect\u2019\u2019 to \u2018\u2018off\u2019\u2019. Press Esc, save, and Esc again until you are asked to reboot.<\/p>\n<p style=\"margin-left:22%;\">NCR\/Symbios 53c400\/53c400a or Domex DTC3181E\/L\/LE (DTCT436\/436P) <br \/> ISA SCSI card<\/p>\n<p style=\"margin-left:32%;\">This card is supplied by Mustek (and other vendors). It\u2019s supported since Linux 2.2. The SCSI cards are supported by the module g_NCR5380. It\u2019s necessary to tell the kernel the io port and type of card. Example for a 53c400a: <i>modprobe g_NCR5380 ncr_addr=0x280 ncr_53c400a=1 .<\/i> Once the kernel detects the card, it should work all right. However, while it should work, do not expect good performance out of this card&#8212;it has no interrupt line and therefore while a scan is in progress, the system becomes almost unusable. You may change the values of the USLEEP macros in <i>drivers\/scsi\/g_NCR5380.c<\/i>. Some documentation is in this file and <i>NCR5380.c<\/i>.<\/p>\n<p style=\"margin-left:22%;\">NCR\/Symbios 810<\/p>\n<p style=\"margin-left:32%;\">For some scanners it may be necessary to disable disconnect\/reconnect. To achieve this use the option ncr53c8xx=&#8221;disc:n&#8221;. Some people reported that their scanner only worked with the 53c7,8xx driver, not the ncr53c8xx. Try both if you have trouble. <br \/> For Linux kernels before 2.0.33 it may be necessary to increase the SCSI timeout. The default timeout for the Linux kernels before 2.0.33 is 10 seconds, which is way too low when scanning large area. If you get messages of the form \u2018\u2018restart (ncr dead ?)\u2019\u2019 in your <i>\/var\/log\/messages<\/i> file or on the system console, it\u2019s an indication that the timeout is too short. In this case, find the line \u2018\u2018if (np->latetime>10)\u2019\u2019 in file <i>ncr53c8xx.<\/i> (normally in directory <i>\/usr\/src\/linux\/drivers\/scsi<\/i>) and change the constant 10 to, say, 60 (one minute). Then rebuild the kernel\/module and try again.<\/p>\n<p style=\"margin-left:22%;\">Tekram DC315<\/p>\n<p style=\"margin-left:32%;\">The driver can be downloaded from <i>http:\/\/www.garloff.de\/kurt\/linux\/dc395\/<\/i>. For some older scanners it may be necessary to disable all the more advanced features by using e.g. <i>modprobe dc395x_trm dc395x_trm=7,5,1,32<\/i>.<\/p>\n<p style=\"margin-left:22%;\">Tekram DC390<\/p>\n<p style=\"margin-left:32%;\">Version 1.11 of the Tekram driver seems to work fine mostly, except that the scan does not terminate properly (it causes a SCSI timeout after 10 minutes). The generic AM53C974 also seems to work fine and does not suffer from the timeout problems.<\/p>\n<h2>SOLARIS, OPENSTEP AND NEXTSTEP INFO <a name=\"SOLARIS, OPENSTEP AND NEXTSTEP INFO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Under Solaris, OpenStep and NeXTStep, the generic SCSI device name refers to a SCSI bus, not to an individual device. For example, <i>\/dev\/sg0<\/i> refers to the first SCSI bus. To tell SANE which device to use, append the character \u2019a\u2019+target-id to the special device name. For example, the SCSI device connected to the first SCSI controller and with target-id 0 would be called <i>\/dev\/sg0a<\/i>, and the device with target-id 1 on that same bus would be called <i>\/dev\/sg0b,<\/i> and so on.<\/p>\n<h2>ENVIRONMENT <a name=\"ENVIRONMENT\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>SANE_DEBUG_SANEI_SCSI<\/b><\/p>\n<p style=\"margin-left:22%;\">If the library was compiled with debug support enabled, this environment variable controls the debug level for the generic SCSI I\/O subsystem. E.g., a value of 128 requests all debug output to be printed by the backend. A value of 255 also prints kernel messages from the SCSI subsystem (where available). Smaller levels reduce verbosity.<\/p>\n<p style=\"margin-left:11%;\"><b>SANE_SCSICMD_TIMEOUT<\/b><\/p>\n<p style=\"margin-left:22%;\">sets the timeout value for SCSI commands in seconds. Overriding the default value of 120 seconds should only be necessary for very slow scanners.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>sane<\/b>(7), <b>sane\u2212find\u2212scanner<\/b>(1), <b>sane\u2212&#8221;backendname&#8221;<\/b>(5), <b>sane\u2212usb<\/b>(5)<\/p>\n<h2>AUTHOR <a name=\"AUTHOR\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">David Mosberger<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  sane\u2212scsi \u2212 SCSI adapter tips for scanners <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[959],"tags":[961,1291,1606],"class_list":["post-4676","post","type-post","status-publish","format-standard","hentry","category-5-formatos-de-ficheros","tag-961","tag-man5","tag-sane-scsi"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4676","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=4676"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4676\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=4676"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=4676"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=4676"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}