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