[sane-devel] sanei_usb has libusb support now
Wed, 3 Jul 2002 16:29:31 +0200
I have just updated sanei_usb in CVS. Please test.
* added some constants from the USB spec to sanei_usb.h. If you need
more, please contact me.
* added support for libusb
The next goal is updating the documentation.
Some details about libusb support: libusb 0.1.6 is needed. I have
tested 0.1.6a and their 0.1 CVS version. The configure script should
be smart enough to only use 0.1.6 or newer.
If libusb isn't found, everything works like before.
However, if you use sanei_usb, you shouldn't mix sanei_usb_open and
libc functions like close () because the fd variable used by
sanei_usb_open and the other sanei_usb functions is an index, not a
normal file descriptor now.
Otherwise, your backends should work without changes.
If you use sanei_usb_attach_matching_devices () or
sanei_usb_find_devices () you will automatically use libusb if
available. First the usual kernel devices are checked
(/dev/usb/scanner etc.), then the libusb devices.
Libusb devices are named like this: "libusb:bus-id:device-id", e.g.
"libusb:001:002" for Linux.
Example output from scanimage -L
Kernel driver loaded:
device mustek_usb:/dev/usb/scanner1' is a Mustek 600 CU flatbed scanner
device mustek_usb:/dev/usb/scanner2' is a Mustek 1200 CU flatbed scanner
device mustek_usb:/dev/usb/scanner0' is a Mustek 1200 UB flatbed scanner
device mustek_usb:/dev/usbscanner0' is a Mustek 1200 UB flatbed scanner
Without kernel driver:
device mustek_usb:libusb:002:003' is a Mustek 600 CU flatbed scanner
device mustek_usb:libusb:001:003' is a Mustek 1200 CU flatbed scanner
device mustek_usb:libusb:002:002' is a Mustek 1200 UB flatbed scanner
Make sure that libusb can access the USB device files. For Linux: set
permissions for e.g. /proc/bus/usb/001/002 or run as root.
Also make sure that your scanner isn't claimed by the kernel scanner
driver. For Linux, try rmmod scanner for testing.
Compilation was tested with and without libusb for Linux, FreeBSD,
NetBSD, and OpenBSD. Testers of other systems are welcome. I'm
especially interested in reports on Mac OS X, as libusb is reported
to run on those systems, too.
Linux: I have tested scanning with libusb and some Mustek USB
scanners. No problems. Other scanners and sanei_usb_control_msg
couldn't be tested. Reports are welcome.
FreeBSD: I can't test if scanning with libusb really works as all my
scanners are claimed by the kernel uscanner driver.
NetBSD: With libusb, my scanners are detected, but opening
OpenBSD: Libusb seems to detect the devices but the kernel prints
"error setting timeout" afterwards?