sane-scsi(5)
sane-scsi(5) โ SANE Scanner Access Now Easy โจ
okay bestie, this is the sane-scsi page from SANE Scanner Access Now Easy and it's literally your guide to not losing your entire mind over SCSI scanners ๐
๐ NAME ๐
sane-scsi โ SCSI adapter tips for scanners
๐ฆ DESCRIPTION ๐ฆ
This manual page is your little treasure chest of operating-system-specific tips and tricks on how to get scanners with a SCSI interface actually working. no cap, every OS is a different vibe and this page knows it ๐ญ
๐ธ GENERAL INFO ๐ธ
So for scanners with a SCSI interface, you might need to edit the appropriate backend configuration file before you use SANE for the very first time. For most systems, that config file should list the name of the generic SCSI device your scanner is connected to (like, under Linux, /dev/sg4 or /dev/sge is such a generic SCSI device). โจ
It's customary to create a symlink from /dev/scanner to the generic SCSI device your scanner is connected to. In that case, the configuration file just lists the line /dev/scanner and you're done. For a detailed description of each backend's configuration file, go read the relevant backend manual page (e.g., sane-epson(5) for Epson scanners, sane-hp(5) for HP scanners, etc.). iykyk ๐
For some operating systems (e.g. Linux and OS/2), there's an alternate way of specifying scanner devices. This alternate way lets you identify scanners by the SCSI vendor and model string and/or by the SCSI device address (which is made of bus number, channel number, id, and logical unit number). The syntax for specifying a scanner this way is:
scsi VENDOR MODEL TYPE BUS CHANNEL ID LUN
where:
VENDORis the SCSI vendor stringMODELis the SCSI model stringTYPEis the SCSI device type stringBUSis the SCSI bus number (named"host"in/proc/scsi/scsi)CHANNELis the SCSI channel numberIDis the SCSI idLUNis 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 โ for Linux, for example, by looking at the output of the command cat /proc/scsi/scsi. ๐ซถ
To simplify configuration, a field's value can be replaced with an asterisk symbol (*). 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. iconic behaviour honestly ๐
For example, the line
scsi MUSTEK MFS-06000CX Scanner 0 00 03 00
would attach the Mustek SCSI scanner with the following /proc/scsi/scsi entry:
Host: scsi0 Channel: 00 Id: 03 Lun: 00
Vendor: MUSTEK Model: MFS-06000CX Rev: 4.04
Type: Scanner ANSI SCSI revision: 0
Usually it's sufficient to use vendor and model strings only, or even only the vendor string. The following example
scsi MUSTEK * * * * * *
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. obsessed with the efficiency ๐
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:
scsi MUSTEK
On some platforms (e.g., OpenStep), SANE device names take a special form. This is explained below in the relevant platform-specific section. ๐
When using a SCSI scanner, please make sure the access permission for the generic SCSI device is set appropriately. We recommend adding a group "scanner" to /etc/group 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 /dev/sg0, then the following two commands would set the permission correctly:
$ chgrp scanner /dev/sg0
$ chmod 660 /dev/sg0
When your system uses the device filesystem (devfs), you have to edit /etc/devfs/perms. There you should search the line
REGISTER ^sg[^/]* PERMISSIONS root.root 0600
and add a new line (eg. for changing permissions of sg4):
REGISTER ^sg4 PERMISSIONS root.scanner 0660
๐ฆ tiny edits, huge slay ๐ฆ
๐ฅ FREEBSD INFO ๐ฅ
Auto-configuration using the "scsi *" lines in the config files only works if the user running the frontend has read/write access to /dev/xpt0. Instead, you can also set a link /dev/scanner to the appropriate /dev/uk device. ๐
- Adaptec AHA1542CF โ Reported to work fine under FreeBSD 2.2.2R with the
ahadriver. - Adaptec 2940 โ Reported to work fine under FreeBSD 2.2.2.
- Adaptec 1522 โ The scanner probes ok but any attempt to access it hangs 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
aicdriver. ๐ like, do not pass go - Adaptec 1505 โ Works on FreeBSD 2.2.5R and 3.0 using the
aicdriver, provided that Plug-and-Play support is disabled on the card. If there are noukdevices, just do ash MAKEDEV uk0in the/devdirectory. The scanner should then be accessible as/dev/uk0if it was probed during boot. โจ - Tekram DC390 โ Reported to work fine under FreeBSD 2.2.2R with the
amddriver.
okay bestie that's part 1, keep reading for the rest ๐
๐ง LINUX INFO ๐ง
Okay so first things first, bestie โ make sure your kernel actually has SCSI generic support turned on. In make xconfig it shows up under SCSI support->SCSI generic support. No support, no scanner, periodt.
To keep scanning times from being an absolute eternity, 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. sane-umax(5), sane-mustek(5), sane-sharp(5)) automatically request larger SCSI buffers. If a backend does not automatically request a larger SCSI buffer, set the environment variable SANE_SG_BUFFERSIZE 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 the Linux SG SCSI driver see: https://tldp.org/HOWTO/SCSI-Generic-HOWTO.
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 SG_BIG_BUFF in header file /usr/include/scsi/sg.h. 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. ๐
๐ซถ the classic "oops I booted with the scanner off" situation
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't be recognized by the kernel and SANE won't 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:
echo "scsi add-single-device 2 0 5 0" > /proc/scsi/scsi
and the kernel will probe and recognize your scanner (this needs to be done as root). It's also possible to dynamically remove a SCSI device by using the remove-single-device command. For details, please refer to the SCSI-2.4-HOWTO.
๐ฆ Scanners are known to work with the following SCSI adapters under Linux
This list isn't complete, usually any SCSI adapter supported by Linux should work. (iykyk, it's giving "vibes-based compatibility" but fr fr it works.)
- Acard/Advance SCSI adapters โ Some old versions of the kernel driver (
atp870u.c) cut the inquiry information. Therefore the scanner couldn't be detected correctly. Use a current kernel. - Adaptec AHA-1505/AHA-1542/AHA-2940 โ 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.
- ASUS SC200 โ Reported to work fine with Linux v2.0.
- BusLogic BT958 โ 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. ChooseSCSI Device Configuration. ChooseScan SCSI Bus. Choose whatever SCSI id that contains your scanner and then chooseView/Modify SCSI configuration. ChangeNegotiationtoasyncand changeDisconnecttooff. Press Esc, save, and Esc again until you are asked to reboot. - NCR/Symbios 53c400/53c400a or Domex DTC3181E/L/LE (DTCT436/436P) ISA SCSI card โ This card is supplied by Mustek (and other vendors). It's supported since Linux 2.2. The SCSI cards are supported by the module
g_NCR5380. It's necessary to tell the kernel the io port and type of card. Example for a 53c400a:modprobe g_NCR5380 ncr_addr=0x280 ncr_53c400a=1 .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 โ it has no interrupt line and therefore while a scan is in progress, the system becomes almost unusable. You may change the values of theUSLEEPmacros indrivers/scsi/g_NCR5380.c. Some documentation is in this file andNCR5380.c. - NCR/Symbios 810 โ For some scanners it may be necessary to disable disconnect/reconnect. To achieve this use the option
ncr53c8xx="disc:n". Some people reported that their scanner only worked with the53c7,8xxdriver, not thencr53c8xx. Try both if you have trouble. 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 formrestart (ncr dead ?)in your/var/log/messagesfile or on the system console, it's an indication that the timeout is too short. In this case, find the lineif (np->latetime>10)in filencr53c8xx.c(normally in directory/usr/src/linux/drivers/scsi) and change the constant10to, say,60(one minute). Then rebuild the kernel/module and try again. - Tekram DC315 โ The driver can be downloaded from
http://www.garloff.de/kurt/linux/dc395/. For some older scanners it may be necessary to disable all the more advanced features by using e.g.modprobe dc395x_trm dc395x_trm=7,5,1,32. - Tekram DC390 โ 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
AM53C974also seems to work fine and does not suffer from the timeout problems.
โ๏ธ SOLARIS, OPENSTEP AND NEXTSTEP INFO โ๏ธ
Under Solaris, OpenStep and NeXTStep, the generic SCSI device name refers to a SCSI bus, not to an individual device. Like, plot twist. For example, /dev/sg0 refers to the first SCSI bus. To tell SANE which device to use, append the character 'a'+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 /dev/sg0a, and the device with target-id 1 on that same bus would be called /dev/sg0b, and so on. ๐
โจ ENVIRONMENT โจ
SANE_DEBUG_SANEI_SCSIโ 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 of128requests all debug output to be printed by the backend. A value of255also prints kernel messages from the SCSI subsystem (where available). Smaller levels reduce verbosity.SANE_SCSICMD_TIMEOUTโ sets the timeout value for SCSI commands in seconds. Overriding the default value of120seconds should only be necessary for very slow scanners.
๐ SEE ALSO ๐
sane(7), sane-find-scanner(1), sane-"backendname"(5), sane-usb(5)
๐ AUTHOR ๐
David Mosberger
okay bestie that's the whole thing, you're officially a SCSI girlie now ๐
โจ this page is from sane-scsi(5), dated 14 Jul 2008 โ yes it's a little vintage, no cap, but she ate and she's still iconic. go forth and scan ๐ฆ๐ธ
๐ฆ where this page comes from
- alpine 3.24: sane-doc 1.4.0-r4 ยท GPL-2.0-or-later GPL-2.0-or-later-with-sane-exception Public-Domain
- arch rolling: sane 1.4.0-4 ยท GPL-2.0-or-later AND LicenseRef-GPL-2.0-or-later-with-linking-exception
- debian trixie: libsane-common 1.3.1-3 ยท GPL-2.0-or-later WITH sane exception
- fedora 43: sane-backends 1.4.0-4.fc43 ยท GPL-2.0-or-later WITH SANE-exception AND GPL-2.0-or-later AND GPL-2.0-only AND LGPL-2.0-or-later AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND IJG AND MIT
- fedora 44: sane-backends 1.4.0-6.fc44 ยท GPL-2.0-or-later WITH SANE-exception AND GPL-2.0-or-later AND GPL-2.0-only AND LGPL-2.0-or-later AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND IJG AND MIT
- nixos 26.05: sane-backends 1.4.0
- nixpkgs unstable: sane-backends 1.4.0
- opensuse-leap 16.0: sane-backends 1.3.0-bp160.1.14 ยท GPL-2.0-or-later AND SUSE-GPL-2.0+-with-sane-exception AND SUSE-Public-Domain
- opensuse-leap 16.0: sane-backends 1.3.0-bp160.1.14 ยท GPL-2.0-or-later AND SUSE-GPL-2.0+-with-sane-exception AND SUSE-Public-Domain
- opensuse-leap 16.0: sane-backends 1.3.0-bp160.1.14 ยท GPL-2.0-or-later AND SUSE-GPL-2.0+-with-sane-exception AND SUSE-Public-Domain
- opensuse-leap 16.0: sane-backends 1.3.0-bp160.1.14 ยท GPL-2.0-or-later AND SUSE-GPL-2.0+-with-sane-exception AND SUSE-Public-Domain
- ubuntu questing: libsane-common 1.3.1-4build1
- ubuntu resolute: libsane-common 1.4.0-1ubuntu1 ยท GPL-2.0-or-later WITH sane exception
- ubuntu stonking: libsane-common 1.4.0-1ubuntu2 ยท GPL-2.0-or-later WITH sane exception
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms