Initiate scan from Fujitsu ix500 to Linux over USB
scanimage supports the ix500 scanner over usb
example:
scanimage -L
device `fujitsu:ScanSnap iX500:59766' is a FUJITSU ScanSnap iX500 scanner
So what's missing it the trigger from the button. I found
https://www.camroncade.com/cloud-scanner-with-raspberry-pi-fujitsu-ix500-2/
mentioning a scannerbuttond package. There is a german description at:
- https://wiki.ubuntuusers.de/scanbuttond/ and an english one at
- http://virantha.com/2014/03/17/one-touch-scanning-with-fujitsu-scansnap-in-linux/
Both are a bit outdated but give some hints on the general idea. Here is a description of a trial with an Ubuntu 18.04 LTS virtual machine. After installing
sudo apt-get install scanbuttond
I connected the scanner by assigning it's USB device to the virtual machine.
scanimage -L
worked as described above.
sudo sane-find-scanner
# sane-find-scanner will now attempt to detect your scanner. If the
# result is different from what you expected, first make sure your
# scanner is powered up and properly connected to your computer.
# No SCSI scanners found. If you expected something different, make sure that
# you have loaded a kernel SCSI driver for your SCSI adapter.
found USB scanner (vendor=0x04c5 [Fujitsu], product=0x132b [ScanSnap iX500]) at libusb:003:007
could not fetch string descriptor: Input/output error
could not fetch string descriptor: Input/output error
could not fetch string descriptor: Pipe error
could not fetch string descriptor: Pipe error
could not fetch string descriptor: Pipe error
could not fetch string descriptor: Pipe error
could not fetch string descriptor: Input/output error
# Your USB scanner was (probably) detected. It may or may not be supported by
# SANE. Try scanimage -L and read the backend's manpage.
# Not checking for parallel port scanners.
# Most Scanners connected to the parallel port or other proprietary ports
# can't be detected by this program.
looks promising.
sudo scanbd -d7 -f
starts the daemon in foreground with debugging set to a high level. In my case i had to comment out some scanner drivers in dll.conf to get rid of results from a different scanner that was available on my network.
Due to bug https://bugs.launchpad.net/ubuntu/+source/scanbd/+bug/1747115 I also had to change the users / group settings.
diff --git a/scanbd/scanbd.conf b/scanbd/scanbd.conf
index 5d74933..1356236 100644
--- a/scanbd/scanbd.conf
+++ b/scanbd/scanbd.conf
@@ -39,8 +39,8 @@ global {
# ArchLinux (ArchLinux doesn't have saned user)
# user = daemon
# *BSD
- # user = root
- user = saned
+ user = root
+ #user = saned
I added the full path to my test script 5 times in scanbd.conf and 4 times in scanner.d/fujitsu.conf:
root@fur:/etc/scanbd# grep scan.sh scanbd.conf
script = "/home/wf/bin/scan.sh"
script = "/home/wf/bin/scan.sh"
script = "/home/wf/bin/scan.sh"
script = "/home/wf/bin/scan.sh"
script = "/home/wf/bin/scan.sh"
root@fur:/etc/scanbd# cd scanner.d/
root@fur:/etc/scanbd/scanner.d# grep scan.sh fujitsu.conf
script = "/home/wf/bin/scan.sh"
script = "/home/wf/bin/scan.sh"
script = "/home/wf/bin/scan.sh"
script = "/home/wf/bin/scan.sh"
with the script scan.sh being:
#!/bin/bash
# WF 2018-12-18
echo "scanning"
echo "scan button pressed on ix500" >> /tmp/ix500.log
i then tested with
sudo scanbd -f
in one terminal and
tail -f /tmp/ix500.log
in another.
scanbd: dbus match type='signal',interface='org.freedesktop.Hal.Manager'
scanbd: SANE_CONFIG_DIR not set
scanbd: Not Primary Owner (-1)
scanbd: Name Error (Connection ":1.96" is not allowed to own the service "de.kmux.scanbd.server" due to security policies in the configuration file)
scanbd: trigger action for page-loaded for device fujitsu:ScanSnap iX500:59766 with script /home/wf/bin/scan.sh
scanning
shows on the daemon's foreground output
and
scan button pressed on ix500
from here it seems be all downhill - the environment variables being passed are described in the scanbd.conf file.
e.g. modifying scan.sh to:
#!/bin/bash
# WF 2018-12-18
echo "scanning"
cat << EOF >> /tmp/ix500.log
scan button pressed on ix500
function: $SCANBD_FUNCTION
mode: $SCANBD_FUNCTION_MODE
device: $SCANBD_DEVICE
action: $SCANBD_ACTION
EOF
will create
scan button pressed on ix500
function: 1
mode: Lineart
device: fujitsu:ScanSnap iX500:59766
action: scan
on the press of the scan button :-)
Running on Ubuntu 18.04 I was able to get my script starting for my fujitsu snapscan ix500.
Use sudo apt install scanbd
to install the button daemon. Start lsusb
to get your scanner usb identifier.
$ lsusb
...
Bus 003 Device 009: ID 04c5:132b Fujitsu, Ltd
...
So I grep for 132b
to find which driver supports my scanner.
$ grep 132b /etc/sane.d/*.conf
/etc/sane.d/fujitsu.conf:usb 0x04c5 0x132b
/etc/sane.d/magicolor.conf:# usb 0x132b 0x2098
Which is the fujtisu
driver in my case.
I copied the original configuration like this:
sudo cp /etc/sane.d/dll.conf /etc/sane.d/dll.conf.orig
sudo cp /etc/scanbd/dll.conf /etc/scanbd/dll.conf.orig
sudo cp /etc/scanbd/scanbd.conf /etc/scanbd/scanbd.conf.orig
Change the /etc/scanbd/scanbd.conf
to run the service as root instead of saned user and change the action script to my own script.
$ sudo vi /etc/scanbd/scanbd.conf
...
user = root
# user = saned
...
action scan {
filter = "^scan.*"
numerical-trigger {
from-value = 1
to-value = 0
}
desc = "Scan to file"
# script must be an relative path starting from scriptdir (see above),
# or an absolute pathname.
# It must contain the path to the action script without arguments
# Absolute path example: script = "/some/path/foo.script
# script = "test.script"
script = "/home/madmike/bin/scan"
}
...
Change the files /etc/sane.d/dll.conf
and /etc/scanbd/dll.conf
to only contain one line with the name of the driver supporting your scanner. In my case fujitsu
$ sudo /etc/sane.d/dll.conf
# yada yada comment
# ...
fujitsu
$ sudo /etc/scanbd/dll.conf
# yada yada comment
# ...
fujitsu
The easiest way to test the setup is to stop the systemd-daemon and run it in the console.
sudo systemctl stop scanbd
sudo scanbd -d7 -f
If your script gets called, you can stop scanbd with Ctrl-c in the console and start the daemon again.
sudo systemctl start scanbd
The question wants to scan what is on the scanner. I'll post the script I wrote later with a update to this answer.
I've used this answer and the guide here for Raspberry-Pi to find this solution.