配置 scanbd 以轮询本地扫描程序
识别本地扫描仪
通过使用 lsusb,识别 productId (1909):
pi:# lsusb
pi:# Bus 001 Device 005: ID 04a9:1909 Canon, Inc. CanoScan LiDE 110
使用该 productId ,grep 正确的配置文件(它取决于你的扫描仪型号,对我来说是 geneys.conf ):
pi:# grep 1909 /etc/sane.d/*conf
pi:# /etc/sane.d/genesys.conf:usb 0x04a9 0x1909
将文件复制到 scanbd 配置文件夹中:
cp /etc/sane.d/genesys.conf /usr/local/etc/scanbd/
cp /etc/sane.d/dll.conf /usr/local/etc/scanbd/
编辑 /usr/local/etc/scanbd/dll.conf 并用正确的扫描仪后端替换 net
:
# /etc/sane.d/dll.conf - Configuration file for the SANE dynamic backend loader
#
# Backends can also be enabled by configuration snippets under
# /etc/sane.d/dll.d directory -- packages providing backends should drop
# a config file similar to dll.conf in this directory, named after the package.
#
# The next line enables the network backend; comment it out if you don't need
# to use a remote SANE scanner over the network - see sane-net(5) and saned(8)
genesys
确认 scanbd 找到了本地扫描程序
现在我们准备测试:
scanbd -d7 -f
尽可能避免操作 env var SANE_CONFIG_DIR。它可能会破坏,默认值已在/usr/local/etc/scanbd/scanbd.conf 和 init 脚本中配置。
输出应类似于:
scanbd: foreground
scanbd: reading config file /usr/local/etc/scanbd/scanbd.conf
scanbd: debug on: level: 7
scanbd: dropping privs to uid saned
scanbd: dropping privs to gid scanner
scanbd: group scanner has member:
scanbd: saned
scanbd: pi
scanbd: drop privileges to gid: 110
scanbd: Running as effective gid 110
scanbd: drop privileges to uid: 110
scanbd: Running as effective uid 110
scanbd: dbus_init
scanbd: dbus match type='signal',interface='org.freedesktop.Hal.Manager'
scanbd: SANE_CONFIG_DIR=/usr/local/etc/scanbd/sane.d
scanbd: sane version 1.0
scanbd: Scanning for local-only devices
scanbd: found device: genesys:libusb:001:005 Canon LiDE 110 flatbed scanner
这里最重要的是 isfound device
。
如果找不到设备没有出现怎么办?
你应该再次检查你的配置,特别是本文档的标识部分,并通过键入以下内容清除任何错误设置的最终 SANE_CONFIG_DIR env var:
unset SANE_CONFIG_DIR
配置 xinetd 以在网络上侦听 scanbm
创建/etc/xinetd.d/sane-port
,其中包含:
service sane-port
{
port = 6566
socket_type = stream
wait = no
user = saned
group = scanner
server = /usr/local/sbin/scanbm
server_args = scanbm -c /usr/local/etc/scanbd/scanbd.conf
disable = no
}
/!\ 用
which scanbm
仔细检查 scanbm 的路径
然后,重新启动 xinetd 并启动 scanbd :
service xinetd restart
/etc/init.d/scanbd start
scanimage -L
现在应该显示扫描仪。
此阶段的大多数问题涉及权限。通过做
sudo -u saned -s
,确保scanimage -L
在你登录时有效。如果没有,请检查 USB 权限:
ls -al /dev/bus/usb/***