配置 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/***