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 to iden‐
27 tify scanners by the SCSI vendor and model string and/or by the SCSI
28 device address (consisting of bus number, channel number, id, and logi‐
29 cal unit number). The syntax for specifying a scanner in this way is:
30
31 scsi VENDOR MODEL TYPE BUS CHANNEL ID LUN
32
33 where VENDOR is the SCSI vendor string, MODEL is the SCSI model string,
34 TYPE is type SCSI device type string, BUS is the SCSI bus number (named
35 "host" in /proc/scsi/scsi), CHANNEL is the SCSI channel number, ID is
36 the SCSI id, and LUN is the logical unit number of the scanner device.
37 The first two fields are strings which must be enclosed in double-
38 quotes if they contain any whitespace. The remaining four fields are
39 non-negative integer numbers. The correct values for these fields can
40 be found by using operating system specific tools, e.g. for Linux by
41 looking at the output of the command "cat /proc/scsi/scsi". To sim‐
42 plify configuration, a field's value can be replaced with an asterisk
43 symbol (``*''). An asterisk has the effect that any value is allowed
44 for that particular field. This can have the effect that a single
45 scsi-line matches multiple devices. When this happens, each matching
46 device will be probed by the backend one by one and registered if the
47 backend thinks it is a compatible device. For example, the line
48
49 scsi MUSTEK MFS-06000CX Scanner 0 00 03 00
50
51 would attach the Mustek SCSI scanner with the following /proc/scsi/scsi
52 entry:
53
54 Host: scsi0 Channel: 00 Id: 03 Lun: 00
55 Vendor: MUSTEK Model: MFS-06000CX Rev: 4.04
56 Type: Scanner ANSI SCSI revision: 0
57
58 Usually it's sufficient to use vendor and model strings only or even
59 only the vendor string. The following example
60
61 scsi MUSTEK * * * * * *
62
63 would have the effect that all SCSI devices in the system with a vendor
64 string of MUSTEK would be probed and recognized by the backend.
65
66 If the remainder of a scsi-string consists of asterisks only, the
67 asterisks can be omitted. For example, the following line is equiva‐
68 lent to the one specified previously:
69
70 scsi MUSTEK
71
72 On some platforms (e.g., OpenStep), SANE device names take a special
73 form. This is explained below in the relevant platform-specific sec‐
74 tion.
75
76 When using a SCSI scanner, ensure that the access permission for the
77 generic SCSI device is set appropriately. We recommend to add a group
78 "scanner" to /etc/group which contains all users that should have
79 access to the scanner. The permission of the device should then be set
80 to allow group read and write access. For example, if the scanner is
81 at generic SCSI device /dev/sg0, then the following two commands would
82 set the permission correctly:
83
84 $ chgrp scanner /dev/sg0
85 $ chmod 660 /dev/sg0
86
87 When your system uses the device filesystem (devfs), you have to edit
88 /etc/devfs/perms. There you should search the line
89
90 REGISTER ^sg[^/]* PERMISSIONS root.root 0600
91
92 and add a new line (eg. for changing permissions of sg4):
93
94 REGISTER ^sg4 PERMISSIONS root.scanner 0660
95
97 Auto-configuration using the "scsi *" lines in the config files only
98 works if the user running the frontend has read/write access to
99 /dev/xpt0. Instead, you can also set a link /dev/scanner to the appro‐
100 priate /dev/uk device.
101
102 Adaptec AHA1542CF
103 Reported to work fine under FreeBSD 2.2.2R with the aha
104 driver.
105
106 Adaptec 2940
107 Reported to work fine under FreeBSD 2.2.2.
108
109 Adaptec 1522
110 The scanner probes ok but any attempt to access it hangs
111 the entire system. It looks like something is disabling
112 interrupts and then not re-enabling them, so it looks
113 like a bug in the FreeBSD aic driver.
114
115 Adaptec 1505
116 Works on FreeBSD 2.2.5R and 3.0 using the aic driver,
117 provided that Plug-and-Play support is disabled on the
118 card. If there are no uk devices, just do a ``sh MAKEDEV
119 uk0'' in the /dev directory. The scanner should then be
120 accessible as /dev/uk0 if it was probed during boot.
121
122 Tekram DC390
123 Reported to work fine under FreeBSD 2.2.2R with the amd
124 driver.
125
126
128 First, make sure your kernel has SCSI generic support enabled. In
129 ``make xconfig'', this shows up under ``SCSI support->SCSI generic sup‐
130 port''.
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, sane-mustek, sane-sharp) automatically
138 request larger scsi buffers. If a backend does not automatically
139 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''.
213 Once the kernel detects the card, it should work all
214 right. However, while it should work, do not expect good
215 performance out of this card---it has no interrupt line
216 and therefore while a scan is in progress, the system
217 becomes almost unusable. You may change the values of
218 the USLEEP macros in drivers/scsi/g_NCR5380.c. Some doc‐
219 umentation 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.c (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
264 SANE_DEBUG_SANEI_SCSI
265 If the library was compiled with debug support enabled, this
266 environment variable controls the debug level for the generic
267 SCSI I/O subsystem. E.g., a value of 128 requests all debug
268 output to be printed by the backend. A value of 255 also prints
269 kernel messages from the SCSI subsystem (where available).
270 Smaller levels reduce verbosity.
271
272 SANE_SCSICMD_TIMEOUT
273 sets the timeout value for SCSI commands in seconds. Overriding
274 the default value of 120 seconds should only be necessary for
275 very slow scanners.
276
277
279 sane(7), sane-find-scanner(1), sane-"backendname"[22m(5), sane-usb(5)
280
281
283 David Mosberger
284
285
286
287 14 Jul 2008 sane-scsi(5)