1sane-scsi(5) SANE Scanner Access Now Easy sane-scsi(5)
2
3
4
6 sane-scsi - SCSI adapter tips for scanners
7
9 This manual page contains various operating-system specific tips and
10 tricks on how to get scanners with a SCSI interface working.
11
13 For scanners with a SCSI interface, it may be necessary to edit the
14 appropriate backend configuration file before using SANE for the first
15 time. For most systems, the configuration file should list the name of
16 the generic SCSI device that the scanner is connected to (e.g., under
17 Linux, /dev/sg4 or /dev/sge is such a generic SCSI device). It is cus‐
18 tomary to create a symlink from /dev/scanner to the generic SCSI device
19 that the scanner is connected to. In this case, the configuration file
20 simply lists the line /dev/scanner. For a detailed description of each
21 backend's configuration file, please refer to the relevant backend man‐
22 ual page (e.g., sane-epson(5) for Epson scanners, sane-hp(5) for HP
23 scanners, etc.).
24
25 For some operating systems (e.g. Linux and OS/2), there is an alternate
26 way of specifying scanner devices. This alternate way allows one to
27 identify scanners by the SCSI vendor and model string and/or by the
28 SCSI device address (consisting of bus number, channel number, id, and
29 logical unit number). The syntax for specifying a scanner in this way
30 is:
31
32 scsi VENDOR MODEL TYPE BUS CHANNEL ID LUN
33
34 where VENDOR is the SCSI vendor string, MODEL is the SCSI model string,
35 TYPE is type SCSI device type string, BUS is the SCSI bus number (named
36 "host" in /proc/scsi/scsi), CHANNEL is the SCSI channel number, ID is
37 the SCSI id, and LUN is the logical unit number of the scanner device.
38 The first two fields are strings which must be enclosed in double-
39 quotes if they contain any whitespace. The remaining four fields are
40 non-negative integer numbers. The correct values for these fields can
41 be found by using operating system specific tools, e.g. for Linux by
42 looking at the output of the command cat /proc/scsi/scsi. To simplify
43 configuration, a field's value can be replaced with an asterisk symbol
44 (``*''). An asterisk has the effect that any value is allowed for that
45 particular field. This can have the effect that a single scsi-line
46 matches multiple devices. When this happens, each matching device will
47 be probed by the backend one by one and registered if the backend
48 thinks it is a compatible device. For example, the line
49
50 scsi MUSTEK MFS-06000CX Scanner 0 00 03 00
51
52 would attach the Mustek SCSI scanner with the following /proc/scsi/scsi
53 entry:
54
55 Host: scsi0 Channel: 00 Id: 03 Lun: 00
56 Vendor: MUSTEK Model: MFS-06000CX Rev: 4.04
57 Type: Scanner ANSI SCSI revision: 0
58
59 Usually it's sufficient to use vendor and model strings only or even
60 only the vendor string. The following example
61
62 scsi MUSTEK * * * * * *
63
64 would have the effect that all SCSI devices in the system with a vendor
65 string of MUSTEK would be probed and recognized by the backend.
66
67 If the remainder of a scsi-string consists of asterisks only, the
68 asterisks can be omitted. For example, the following line is equiva‐
69 lent to the one specified previously:
70
71 scsi MUSTEK
72
73 On some platforms (e.g., OpenStep), SANE device names take a special
74 form. This is explained below in the relevant platform-specific sec‐
75 tion.
76
77 When using a SCSI scanner, ensure that the access permission for the
78 generic SCSI device is set appropriately. We recommend to add a group
79 "scanner" to /etc/group which contains all users that should have
80 access to the scanner. The permission of the device should then be set
81 to allow group read and write access. For example, if the scanner is
82 at generic SCSI device /dev/sg0, then the following two commands would
83 set the permission correctly:
84
85 $ chgrp scanner /dev/sg0
86 $ chmod 660 /dev/sg0
87
88 When your system uses the device filesystem (devfs), you have to edit
89 There you should search the line
90
91 REGISTER ^sg[^/]* PERMISSIONS root.root 0600
92
93 and add a new line (eg. for changing permissions of sg4):
94
95 REGISTER ^sg4 PERMISSIONS root.scanner 0660
96
98 Auto-configuration using the "scsi *" lines in the config files only
99 works if the user running the frontend has read/write access to
100 /dev/xpt0. Instead, you can also set a link /dev/scanner to the appro‐
101 priate /dev/uk device.
102
103 Adaptec AHA1542CF
104 Reported to work fine under FreeBSD 2.2.2R with the aha
105 driver.
106
107 Adaptec 2940
108 Reported to work fine under FreeBSD 2.2.2.
109
110 Adaptec 1522
111 The scanner probes ok but any attempt to access it hangs
112 the entire system. It looks like something is disabling
113 interrupts and then not re-enabling them, so it looks
114 like a bug in the FreeBSD aic driver.
115
116 Adaptec 1505
117 Works on FreeBSD 2.2.5R and 3.0 using the aic driver,
118 provided that Plug-and-Play support is disabled on the
119 card. If there are no uk devices, just do a sh MAKEDEV
120 uk0 in the directory. The scanner should then be accessi‐
121 ble as /dev/uk0 if it was probed during boot.
122
123 Tekram DC390
124 Reported to work fine under FreeBSD 2.2.2R with the amd
125 driver.
126
127
129 First, make sure your kernel has SCSI generic support enabled. In make
130 xconfig, this shows up under ``SCSI support->SCSI generic support''.
131
132 To keep scanning times to a minimum, it is strongly recommended to use
133 a large buffer size for the generic SCSI driver. From SG driver version
134 2.0 on, the maximum buffer size can be changed at program run time, and
135 there is no restriction in size. This driver version is part of the
136 Linux kernels from version 2.2.7 on. If the new SG driver is available
137 some backends (e.g. sane-umax(5), sane-mustek(5), sane-sharp(5)) auto‐
138 matically request larger SCSI buffers. If a backend does not automati‐
139 cally request a larger SCSI buffer, set the environment variable
140 SANE_SG_BUFFERSIZE to the desired buffer size in bytes. It is not rec‐
141 ommended to use more than 1 MB, because for large values the probabil‐
142 ity increases that the SG driver cannot allocate the necessary buf‐
143 fer(s). For ISA cards, even 1 MB might be a too large value. For a
144 detailed discussion of memory issues of the SG driver, see
145 http://www.torque.net/sg.
146
147 For Linux kernels before version 2.2.7 the size of the buffer is only
148 32KB. This works, but for many cheaper scanners this causes scanning
149 to be slower by about a factor of four than when using a size of 127KB.
150 Linux defines the size of this buffer by macro SG_BIG_BUFF in header
151 file /usr/include/scsi/sg.h. Unless a system is seriously short on
152 memory, it is recommended to increase this value to the maximum legal
153 value of 128*1024-512=130560 bytes. After changing this value, it is
154 necessary to recompile both the kernel (or the SCSI generic module) and
155 the SCSI backends. Keep in mind that this is only necessary with older
156 Linux kernels.
157
158
159 A common issue with SCSI scanners is what to do when you booted the
160 system while the scanner was turned off. In such a case, the scanner
161 won't be recognized by the kernel and SANE won't be able to access it.
162 Fortunately, Linux provides a simple mechanism to probe a SCSI device
163 on demand. Suppose you have a scanner connected to SCSI bus 2 and the
164 scanner has a SCSI id of 5. When the system is up and running and the
165 scanner is turned on, you can issue the command:
166
167 echo "scsi add-single-device 2 0 5 0" > /proc/scsi/scsi
168
169 and the kernel will probe and recognize your scanner (this needs to be
170 done as root). It's also possible to dynamically remove a SCSI device
171 by using the ``remove-single-device'' command. For details, please
172 refer to to the SCSI-2.4-HOWTO.
173
174 Scanners are known to work with the following SCSI adapters under
175 Linux. This list isn't complete, usually any SCSI adapter supported by
176 Linux should work.
177
178 Acard/Advance SCSI adapters
179 Some old versions of the kernel driver (atp870u.c) cut
180 the inquiry information. Therefore the scanner couldn't
181 be detected correctly. Use a current kernel.
182
183 Adaptec AHA-1505/AHA-1542/AHA-2940
184 Reported to work fine with Linux since v2.0. If you
185 encounter kernel freezes or other unexpected behaviour
186 get the latest Linux kernel (2.2.17 seems to work) or
187 reduce SCSI buffer size to 32 kB.
188
189 ASUS SC200
190 Reported to work fine with Linux v2.0.
191
192 BusLogic BT958
193 To configure the BusLogic card, you may need to follow
194 these instructions (contributed by Jeremy
195 <jeremy@xxedgexx.com>): During boot, when your BusLogic
196 adapter is being initialized, press Ctrl-B to enter your
197 BusLogic adapter setup. Choose the address which your
198 BusLogic containing your scanner is located. Choose
199 ``SCSI Device Configuration''. Choose ``Scan SCSI Bus''.
200 Choose whatever SCSI id that contains your scanner and
201 then choose ``View/Modify SCSI configuration''. Change
202 ``Negotiation'' to ``async'' and change ``Disconnect'' to
203 ``off''. Press Esc, save, and Esc again until you are
204 asked to reboot.
205
206 NCR/Symbios 53c400/53c400a or Domex DTC3181E/L/LE (DTCT436/436P)
207 ISA SCSI card
208 This card is supplied by Mustek (and other vendors). It's
209 supported since Linux 2.2. The SCSI cards are supported
210 by the module g_NCR5380. It's necessary to tell the ker‐
211 nel the io port and type of card. Example for a 53c400a:
212 modprobe g_NCR5380 ncr_addr=0x280 ncr_53c400a=1 . Once
213 the kernel detects the card, it should work all right.
214 However, while it should work, do not expect good perfor‐
215 mance out of this card---it has no interrupt line and
216 therefore while a scan is in progress, the system becomes
217 almost unusable. You may change the values of the USLEEP
218 macros in drivers/scsi/g_NCR5380.c. Some documentation
219 is in this file and NCR5380.c.
220
221 NCR/Symbios 810
222 For some scanners it may be necessary to disable discon‐
223 nect/reconnect. To achieve this use the option
224 ncr53c8xx="disc:n". Some people reported that their scan‐
225 ner only worked with the 53c7,8xx driver, not the
226 ncr53c8xx. Try both if you have trouble.
227 For Linux kernels before 2.0.33 it may be necessary to
228 increase the SCSI timeout. The default timeout for the
229 Linux kernels before 2.0.33 is 10 seconds, which is way
230 too low when scanning large area. If you get messages of
231 the form ``restart (ncr dead ?)'' in your /var/log/mes‐
232 sages file or on the system console, it's an indication
233 that the timeout is too short. In this case, find the
234 line ``if (np->latetime>10)'' in file ncr53c8xx. (nor‐
235 mally in directory /usr/src/linux/drivers/scsi) and
236 change the constant 10 to, say, 60 (one minute). Then
237 rebuild the kernel/module and try again.
238
239 Tekram DC315
240 The driver can be downloaded from
241 http://www.garloff.de/kurt/linux/dc395/. For some older
242 scanners it may be necessary to disable all the more
243 advanced features by using e.g. modprobe dc395x_trm
244 dc395x_trm=7,5,1,32.
245
246 Tekram DC390
247 Version 1.11 of the Tekram driver seems to work fine
248 mostly, except that the scan does not terminate properly
249 (it causes a SCSI timeout after 10 minutes). The generic
250 AM53C974 also seems to work fine and does not suffer from
251 the timeout problems.
252
253
255 Under Solaris, OpenStep and NeXTStep, the generic SCSI device name
256 refers to a SCSI bus, not to an individual device. For example,
257 /dev/sg0 refers to the first SCSI bus. To tell SANE which device to
258 use, append the character 'a'+target-id to the special device name.
259 For example, the SCSI device connected to the first SCSI controller and
260 with target-id 0 would be called /dev/sg0a, and the device with target-
261 id 1 on that same bus would be called /dev/sg0b, and so on.
262
263
265 SANE_DEBUG_SANEI_SCSI
266 If the library was compiled with debug support enabled, this
267 environment variable controls the debug level for the generic
268 SCSI I/O subsystem. E.g., a value of 128 requests all debug
269 output to be printed by the backend. A value of 255 also prints
270 kernel messages from the SCSI subsystem (where available).
271 Smaller levels reduce verbosity.
272
273 SANE_SCSICMD_TIMEOUT
274 sets the timeout value for SCSI commands in seconds. Overriding
275 the default value of 120 seconds should only be necessary for
276 very slow scanners.
277
278
280 sane(7), sane-find-scanner(1), sane-"backendname"[22m(5), sane-usb(5)
281
282
284 David Mosberger
285
286
287
288 14 Jul 2008 sane-scsi(5)