Wednesday, July 10, 2013

xsane rabbit hole

Links: scanimage man page :: clear overview of network and usb scanners, groups

I recently connected a mothballed Epson that scans on every system, but found that it didn't work in Fedora. The sane-find-scanner utility detected the scanner, but scanimage -L did not (as root or user). This is apparently a common problem, sometimes associated with permissions, sometimes random bugs.

I did get it to scan by manually entering the USB address detected by sane-find-scanner, and add the library suffix for Epsons* from /usr/lib/sane/. This looks like, eg...
$ scanimage -d epson2:libusb:001:005 --resolution 75 --mode Gray > star.jpeg
$ convert star.jpeg -normalize out.jpg
Conversion (ImageMagick) is required because the output image caused errors "not jpeg starts 0x50 0x34". The Start of File (SOF) was not the correct header for a JPEG. This is because it's really a PGM file. Anyway, scanning in this way would be prohibitively time intensive.

*attempted both /usr/lib/sane/libsane-epson and /usr/lib/sane/libsane-epson2

$ scanimage --help --device-name epson:libusb:001:005

Options specific to device `epson:libusb:001:005':
Scan Mode:
--mode Lineart|Gray|Color [Lineart]
Selects the scan mode (e.g., lineart, monochrome, or color).
--dropout None|Red|Green|Blue [None]
Selects the dropout.

--gamma-correction User defined (Gamma=1.0)|User defined (Gamma=1.8) [User defined (Gamma=1.8)]
Selects the gamma correction value from a list of pre-defined devices
or the user defined table, which can be downloaded to the scanner
--resolution 75|150|300|600dpi [75]
Sets the resolution of the scanned image.
--speed[=(yes|no)] [no]
Determines the speed at which the scan proceeds.

--short-resolution[=(yes|no)] [no]
Display short resolution list
--red-gamma-table 0..255,...
Gamma-correction table for the red band.
--green-gamma-table 0..255,...
Gamma-correction table for the green band.
--blue-gamma-table 0..255,...
Gamma-correction table for the blue band.

--wait-for-button[=(yes|no)] [no]
After sending the scan command, wait until the button on the scanner
is pressed to actually start the scan process.
Preview:
--preview[=(yes|no)] [no]
Request a preview-quality scan.
--preview-speed[=(yes|no)] [no]

Geometry:
-l 0..215.9mm [0]
Top-left x position of scan area.
-t 0..297.857mm [0]
Top-left y position of scan area.
-x 0..215.9mm [215.9]
Width of scan-area.
-y 0..297.857mm [297.857]
Height of scan-area.
--quick-format CD|A5 portrait|A5 landscape|Letter|A4|Max [Max]

strace

Stracing scanimage revealed that the appropriate lsusb.so was consulted, but nothing was returned. I also moved all .conf files in /etc/sane.d/ except the epsons, in case the client was could not locate the appropriate .conf file from the 30 or so in that folder. No luck.

saned

One article (link is also at top of page), seemed to imply that saned was necessary to run the scanner. I considered saned (configured via /etc/sane.d/saned.conf) only necessary for network access to scanners, and so looked more closely.

Saned and CUPS appear similar, at least in concept. Since I could find no clear guideline for the syntax for adding USB printers into saned, it's possible they are added to /etc/sane.d/saned.conf in a similar USB URL format as in CUPS, eg usb:/dev/usb/lp0. But it appears we may have to more specific about which USB and so include each:


groups

The Fedora installation had no group for scanning. It might be necessary to add a "scanner" group and create user access. If there is an underlying permissions issue, this might resolve it.

No comments: