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 sim‐
43 plify configuration, a field's value can be replaced with an asterisk
44 symbol (``*''). An asterisk has the effect that any value is allowed
45 for that particular field. This can have the effect that a single
46 scsi-line matches multiple devices. When this happens, each matching
47 device will be probed by the backend one by one and registered if the
48 backend 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 /etc/devfs/perms. 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 /dev directory. The scanner should then be
121 accessible 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
130 ``make xconfig'', this shows up under ``SCSI support->SCSI generic sup‐
131 port''.
132
133 To keep scanning times to a minimum, it is strongly recommended to use
134 a large buffer size for the generic SCSI driver. From SG driver version
135 2.0 on, the maximum buffer size can be changed at program run time, and
136 there is no restriction in size. This driver version is part of the
137 Linux kernels from version 2.2.7 on. If the new SG driver is available
138 some backends (e.g. sane-umax, sane-mustek, sane-sharp) automatically
139 request larger scsi buffers. If a backend does not automatically
140 request a larger scsi buffer, set the environment variable
141 SANE_SG_BUFFERSIZE to the desired buffer size in bytes. It is not rec‐
142 ommended to use more than 1 MB, because for large values the probabil‐
143 ity increases that the SG driver cannot allocate the necessary buf‐
144 fer(s). For ISA cards, even 1 MB might be a too large value. For a
145 detailed discussion of memory issues of the SG driver, see
146 http://www.torque.net/sg.
147
148 For Linux kernels before version 2.2.7 the size of the buffer is only
149 32KB. This works, but for many cheaper scanners this causes scanning
150 to be slower by about a factor of four than when using a size of 127KB.
151 Linux defines the size of this buffer by macro SG_BIG_BUFF in header
152 file /usr/include/scsi/sg.h. Unless a system is seriously short on
153 memory, it is recommended to increase this value to the maximum legal
154 value of 128*1024-512=130560 bytes. After changing this value, it is
155 necessary to recompile both the kernel (or the SCSI generic module) and
156 the SCSI backends. Keep in mind that this is only necessary with older
157 Linux kernels.
158
159
160 A common issue with SCSI scanners is what to do when you booted the
161 system while the scanner was turned off? In such a case, the scanner
162 won't be recognized by the kernel and SANE won't be able to access it.
163 Fortunately, Linux provides a simple mechanism to probe a SCSI device
164 on demand. Suppose you have a scanner connected to SCSI bus 2 and the
165 scanner has a SCSI id of 5. When the system is up and running and the
166 scanner is turned on, you can issue the command:
167
168 echo "scsi add-single-device 2 0 5 0" > /proc/scsi/scsi
169
170 and the kernel will probe and recognize your scanner (this needs to be
171 done as root). It's also possible to dynamically remove a SCSI device
172 by using the ``remove-single-device'' command. For details, please
173 refer to to the SCSI-2.4-HOWTO.
174
175 Scanners are known to work with the following SCSI adapters under
176 Linux. This list isn't complete, usually any SCSI adapter supported by
177 Linux should work.
178
179 Acard/Advance SCSI adapters
180 Some old versions of the kernel driver (atp870u.c) cut
181 the inquiry information. Therefore the scanner couldn't
182 be detected correctly. Use a current kernel.
183
184 Adaptec AHA-1505/AHA-1542/AHA-2940
185 Reported to work fine with Linux since v2.0. If you
186 encounter kernel freezes or other unexpected behaviour
187 get the latest Linux kernel (2.2.17 seems to work) or
188 reduce SCSI buffer size to 32 kB.
189
190 ASUS SC200
191 Reported to work fine with Linux v2.0.
192
193 BusLogic BT958
194 To configure the BusLogic card, you may need to follow
195 these instructions (contributed by Jeremy
196 <jeremy@xxedgexx.com>): During boot, when your BusLogic
197 adapter is being initialized, press Ctrl-B to enter your
198 BusLogic adapter setup. Choose the address which your
199 BusLogic containing your scanner is located. Choose
200 ``SCSI Device Configuration''. Choose ``Scan SCSI Bus''.
201 Choose whatever SCSI id that contains your scanner and
202 then choose ``View/Modify SCSI configuration''. Change
203 ``Negotiation'' to ``async'' and change ``Disconnect'' to
204 ``off''. Press Esc, save, and Esc again until you are
205 asked to reboot.
206
207 NCR/Symbios 53c400/53c400a or Domex DTC3181E/L/LE (DTCT436/436P)
208 ISA SCSI card
209 This card is supplied by Mustek (and other vendors). It's
210 supported since Linux 2.2. The SCSI cards are supported
211 by the module g_NCR5380. It's necessary to tell the ker‐
212 nel the io port and type of card. Example for a 53c400a:
213 ``modprobe g_NCR5380 ncr_addr=0x280 ncr_53c400a=1''.
214 Once the kernel detects the card, it should work all
215 right. However, while it should work, do not expect good
216 performance out of this card---it has no interrupt line
217 and therefore while a scan is in progress, the system
218 becomes almost unusable. You may change the values of
219 the USLEEP macros in drivers/scsi/g_NCR5380.c. Some doc‐
220 umentation is in this file and NCR5380.c.
221
222 NCR/Symbios 810
223 For some scanners it may be necessary to disable discon‐
224 nect/reconnect. To achieve this use the option
225 ncr53c8xx="disc:n". Some people reported that their scan‐
226 ner only worked with the 53c7,8xx driver, not the
227 ncr53c8xx. Try both if you have trouble.
228 For Linux kernels before 2.0.33 it may be necessary to
229 increase the SCSI timeout. The default timeout for the
230 Linux kernels before 2.0.33 is 10 seconds, which is way
231 too low when scanning large area. If you get messages of
232 the form ``restart (ncr dead ?)'' in your /var/log/mes‐
233 sages file or on the system console, it's an indication
234 that the timeout is too short. In this case, find the
235 line ``if (np->latetime>10)'' in file ncr53c8xx.c (nor‐
236 mally in directory /usr/src/linux/drivers/scsi) and
237 change the constant 10 to, say, 60 (one minute). Then
238 rebuild the kernel/module and try again.
239
240 Tekram DC315
241 The driver can be downloaded from
242 http://www.garloff.de/kurt/linux/dc395/. For some older
243 scanners it may be necessary to disable all the more
244 advanced features by using e.g. modprobe dc395x_trm
245 dc395x_trm=7,5,1,32.
246
247 Tekram DC390
248 Version 1.11 of the Tekram driver seems to work fine
249 mostly, except that the scan does not terminate properly
250 (it causes a SCSI timeout after 10 minutes). The generic
251 AM53C974 also seems to work fine and does not suffer from
252 the timeout problems.
253
254
256 Under Solaris, OpenStep and NeXTStep, the generic SCSI device name
257 refers to a SCSI bus, not to an individual device. For example,
258 /dev/sg0 refers to the first SCSI bus. To tell SANE which device to
259 use, append the character 'a'+target-id to the special device name.
260 For example, the SCSI device connected to the first SCSI controller and
261 with target-id 0 would be called /dev/sg0a, and the device with target-
262 id 1 on that same bus would be called /dev/sg0b, and so on.
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)