【问题标题】:scanbd has 30 seconds delay when running as service on Archlinuxscanbd 在 Archlinux 上作为服务运行时有 30 秒的延迟
【发布时间】:2018-12-02 13:43:05
【问题描述】:

我已经用 Archlinux 在 arm box(类似于树莓派)上设置了 sane/scanbd。 scanbd 配置为在按下scan 按钮时从扫描仪扫描页面。当直接从命令行以scanbd -d1 -f 运行scanbd 时,一切正常。但是,当我将它作为服务运行时(使用systemd),在扫描开始之前会有大约 30-40 秒的延迟(尽管它最终会扫描)。

我已按照 this 指南安装/配置 scanbd。

我将scanbd.conf 保留为默认配置。我的test.script 看起来像这样:

scanimage --batch-count=1 --resolution 150 --source="ADF Duplex" --batch=/tmp/$(date +%Y%m%d_%H%M)_%02d_out.tiff --format=tiff
#merge into multipage tiff
tiffcp -c lzw /tmp/*out.tiff /tmp/output.tiff
#convert to pdf
tiff2pdf -z /tmp/output.tiff > /tmp/output.pdf

rm /tmp/*.tiff
chmod 755 /tmp/output.pdf
mv /tmp/output.pdf /home/scanner/output.pdf

关于为什么引入大量延迟有什么想法吗?

【问题讨论】:

  • 您是否手动确定扫描仪设备类型?自动检测设备在扫描总线/总线时有很多延迟。
  • 如果是自动检测问题,那么从命令行运行 scanbd 会有同样的延迟,但奇怪的是没有。
  • 在终端先试一下,如果没有服务记录会延迟运行。此外,一些 ttyAMx 连接需要在系统中进行额外配置。终端可以提供这个,但应用程序不会像系统应用程序那样工作!
  • 小技巧:如何在插件上准备 bus/bus_block_size ?填充缓冲区和读取EOF是不同的方法。
  • 要添加更多调试输出,包括计时,请使用export SANE_DEBUG_DLL=255 && scanimage -L

标签: raspberry-pi archlinux sane


【解决方案1】:

终于想出了一个解决办法。延迟来自 scanbm.socket 服务。

修复步骤: 1. 禁用套接字:

systemctl stop scanbm.socket
systemctl disable scanbm.socket
  1. net作为设备从/etc/scanbd/sane.d/dll.conf中移除

  2. 从 scanbd 服务中移除 scanbm 依赖:

#/etc/systemd/system/dbus-de.kmux.scanbd.server.service
[Unit]
Description=Scanner button polling Service

[Service]
Type=simple
ExecStart=/usr/sbin/scanbd -f -c /etc/scanbd/scanbd.conf
#ExecReload=?
Environment=SANE_CONFIG_DIR=/etc/scanbd/sane.d
StandardInput=null
StandardOutput=syslog
StandardError=syslog
#NotifyAccess=?

[Install]
WantedBy=multi-user.target
#Also=scanbm.socket <-- comment out this line
Alias=dbus-de.kmux.scanbd.server.service
  1. 重启scanbd服务:systemctl restart scanbd

【讨论】:

    猜你喜欢
    • 2012-01-13
    • 1970-01-01
    • 2019-12-01
    • 2022-01-20
    • 2023-03-27
    • 1970-01-01
    • 2014-07-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多