通过 USB 从 Fujitsu ix500 启动对 Linux 的扫描

通过 USB 从 Fujitsu ix500 启动对 Linux 的扫描

我想通过按下扫描仪的扫描按钮来开始扫描,并将数据传送到 Linux 机器。

不幸的是,我无法使用扫描仪的 WLAN 接口,因此我只能使用 USB。

有机会使这个工作成功吗?

以下是实现此目标的几种推测方法。您使用其中任何一种方法成功了吗?

  • 在 Linux 上运行一个客户端,该客户端(部分)遵守 ScanSnap 的 Windows 和 macOS 客户端中实现的协议(不太可能)
  • 在扫描仪上安装 USB 转以太网适配器,让扫描仪将其用作以太网设备。然后我就可以扫描到 FTP。
  • 通过 Wine 安装官方 Windows 客户端。

答案1

扫描图像支持通过 USB 连接的 ix500 扫描仪

例子:

scanimage -L
device `fujitsu:ScanSnap iX500:59766' is a FUJITSU ScanSnap iX500 scanner

那么缺少的就是按钮的触发器。我发现

https://www.camroncade.com/cloud-scanner-with-raspberry-pi-fujitsu-ix500-2/

提到了 scannerbuttond 包。德语描述如下:

两者都有点过时,但提供了一些关于总体思路的提示。以下是使用 Ubuntu 18.04 LTS 虚拟机进行试用的描述。安装后

sudo apt-get install scanbuttond

我通过将扫描仪的 USB 设备分配给虚拟机来连接扫描仪。

scanimage -L

按上述方法工作。

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.

看起来很有希望。

sudo scanbd -d7 -f

在前台启动守护进程,并将调试设置为高级别。在我的例子中,我必须注释掉 dll.conf 中的某些扫描仪驱动程序,以消除网络上可用的其他扫描仪的结果。

由于错误https://bugs.launchpad.net/ubuntu/+source/scanbd/+bug/1747115 我还必须更改用户/群组设置。

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

我在 scanbd.conf 中添加了 5 次测试脚本的完整路径,在 scanner.d/fujitsu.conf 中添加了 4 次:

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"

脚本 scan.sh 为:

#!/bin/bash
# WF 2018-12-18
echo "scanning"
echo "scan button pressed on ix500" >> /tmp/ix500.log

然后我测试了

sudo scanbd -f

在一个终端和

tail -f /tmp/ix500.log

在另一个。

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

显示在守护进程的前台输出上

scan button pressed on ix500

从这里开始似乎一切都顺利 - 传递的环境变量在 scanbd.conf 文件中描述。

例如将 scan.sh 修改为:

#!/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

将创造

scan button pressed on ix500
function: 1
mode: Lineart
device: fujitsu:ScanSnap iX500:59766
action: scan

按下扫描按钮即可:-)

答案2

在 Ubuntu 18.04 上运行时,我能够为我的 fujitsu snapscan ix500 启动脚本。

用于sudo apt install scanbd安装按钮守护程序。开始lsusb获取扫描仪 USB 标识符。

$ lsusb 
...
Bus 003 Device 009: ID 04c5:132b Fujitsu, Ltd 
...

因此我使用 grep 来132b查找哪个驱动程序支持我的扫描仪。

$ grep 132b /etc/sane.d/*.conf
/etc/sane.d/fujitsu.conf:usb 0x04c5 0x132b
/etc/sane.d/magicolor.conf:# usb 0x132b 0x2098

就我的情况来说,这是fujtisu驱动程序。

我复制了原来的配置如下:

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

将其更改/etc/scanbd/scanbd.conf为以 root 身份而不是 saned 用户身份运行服务,并将操作脚本更改为我自己的脚本。

$ 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"
        }
...

更改文件/etc/sane.d/dll.conf/etc/scanbd/dll.conf使其仅包含一行,其中包含支持扫描仪的驱动程序的名称。在我的情况下fujitsu

$ sudo /etc/sane.d/dll.conf
# yada yada comment
# ...
fujitsu


$ sudo /etc/scanbd/dll.conf
# yada yada comment
# ...
fujitsu

测试设置的最简单方法是停止 systemd-daemon 并在控制台中运行它。

sudo systemctl stop scanbd
sudo scanbd -d7 -f

如果您的脚本被调用,您可以在控制台中使用 Ctrl-c 停止 scanbd 并重新启动守护进程。

sudo systemctl start scanbd

问题是扫描扫描仪上有什么。稍后我将发布我编写的脚本,并更新此答案。

我用过这个回答以及这里的指南树莓派找到这个解决方案。

相关内容