1sane-usb(5) SANE Scanner Access Now Easy sane-usb(5)
2
3
4
6 sane-usb - USB configuration tips for SANE
7
9 This manual page contains information on how to access scanners with a
10 USB interface. It focusses on two main topics: getting the scanner
11 detected by the operating system kernel and using it with SANE.
12
13 This page applies to USB most backends and scanners, as they use the
14 generic sanei_usb interface. However, there is one exceptions: USB
15 Scanners supported by the microtek2 backend need a special USB kernel
16 driver, see sane-microtek2(5) for details.
17
18
20 This is a short HOWTO-like section. For the full details, read the fol‐
21 lowing sections. The goal of this section is to get the scanner
22 detected by sane-find-scanner(1).
23
24 Run sane-find-scanner. If it lists your scanner with the correct vendor
25 and product ids, you are done. See section SANE ISSUES for details on
26 how to go on.
27
28 sane-find-scanner doesn't list your scanner? Does it work as root? If
29 yes, there is a permission issue. See the LIBUSB section for details.
30
31 Nothing is found even as root? Check that your kernel supports USB and
32 that libusb is installed (see section LIBUSB).
33
34
36 For accessing USB devices, the USB library libusb is used. There used
37 to exist another method to access USB devices: the kernel scanner
38 driver. The kernel scanner driver method is deprecated and shouldn't be
39 used anymore. It may be removed from SANE at any time. In Linux, the
40 kernel scanner driver has been removed in the 2.6.* kernel series. Only
41 libusb access is documented in this manual page.
42
43
45 SANE can only use libusb 0.1.6 or newer. It needs to be installed at
46 build-time. Modern Linux distributions and other operating systems come
47 with libusb.
48
49 Libusb can only access your scanner if it's not claimed by the kernel
50 scanner driver. If you want to use libusb, unload the kernel driver
51 (e.g. rmmod scanner under Linux) or disable the driver when compiling a
52 new kernel. For Linux, your kernel needs support for the USB filesystem
53 (usbfs). For kernels older than 2.4.19, replace "usbfs" with "usbdevfs"
54 because the name has changed. This filesystem must be mounted. That's
55 done automatically at boot time, if /etc/fstab contains a line like
56 this:
57
58 none /proc/bus/usb usbfs defaults 0 0
59
60 The permissions for the device files used by libusb must be adjusted
61 for user access. Otherwise only root can use SANE devices. For Linux,
62 the devices are located in /proc/bus/usb/ or in /dev/bus/usb, if you
63 use udev. There are directories named e.g. "001" (the bus name) con‐
64 taining files "001", "002" etc. (the device files). The right device
65 files can be found out by running scanimage -L as root. Setting permis‐
66 sions with "chmod" is not permanent, however. They will be reset after
67 reboot or replugging the scanner.
68
69 Usually udev or for older distributions the hotplug utilities are used,
70 which support dynamic setting of access permissions. SANE comes with
71 udev and hotplug scripts in the directory tools/udev and tools/hotplug.
72 They can be used for setting permissions, see /usr/share/doc/sane-back‐
73 ends-1.0.24/README.linux, tools/README and the README in the tools/hot‐
74 plug directory for more details.
75
76 For the BSDs, the device files used by libusb are named /dev/ugen*.
77 Use chmod to apply appropriate permissions.
78
79
81 This section assumes that your scanner is detected by sane-find-scan‐
82 ner. It doesn't make sense to go on, if this is not the case. While
83 sane-find-scanner is able to detect any USB scanner, actual scanning
84 will only work if the scanner is supported by a SANE backend. Informa‐
85 tion on the level of support can be found on the SANE webpage
86 (http://www.sane-project.org/), and the individual backend manpages.
87
88 Most backends can detect USB scanners automatically using "usb" config‐
89 uration file lines. This method allows to identify scanners by the USB
90 vendor and product numbers. The syntax for specifying a scanner this
91 way is:
92
93 usb VENDOR PRODUCT
94
95 where VENDOR is the USB vendor id, and PRODUCT is the USB product id of
96 the scanner. Both ids are non-negative integer numbers in decimal or
97 hexadecimal format. The correct values for these fields can be found by
98 running sane-find-scanner, looking into the syslog (e.g., /var/log/mes‐
99 sages) or under Linux by issuing the command "cat
100 /proc/bus/usb/devices". This is an example of a config file line:
101
102 usb 0x055f 0x0006
103
104 would have the effect that all USB devices in the system with a vendor
105 id of 0x55f and a product id of 0x0006 would be probed and recognized
106 by the backend.
107
108 If your scanner is not detected automatically, it may be necessary to
109 edit the appropriate backend configuration file before using SANE for
110 the first time. For a detailed description of each backend's configu‐
111 ration file, please refer to the relevant backend manual page (e.g.
112 sane-mustek_usb(5) for Mustek USB scanners).
113
114 Do not create a symlink from /dev/scanner to the USB device because
115 this link is used by the SCSI backends. The scanner may be confused if
116 it receives SCSI commands.
117
118
120 SANE_DEBUG_SANEI_USB
121 If the library was compiled with debug support enabled, this
122 environment variable controls the debug level for the USB I/O
123 subsystem. E.g., a value of 128 requests all debug output to be
124 printed. Smaller levels reduce verbosity. Values greater than 4
125 enable libusb debugging (if available). Example: export
126 SANE_DEBUG_SANEI_USB=4.
127
128 SANE_USB_WORKAROUND
129 If your scanner does not work when plugged into a USB3 port, try
130 setting the environment variable SANE_USB_WORKAROUND to 1. This
131 may work around issues which happen with particular kernel ver‐
132 sions. Example: export SANE_USB_WORKAROUND=1.
133
134
136 sane(7), sane-find-scanner(1), sane-"backendname"[22m(5), sane-scsi(5)
137
138
140 Henning Meier-Geinitz <henning@meier-geinitz.de>
141
142
143
144 14 Jul 2008 sane-usb(5)