2

I've set up sane/scanbd on an arm box (similar to raspberry pi) with Archlinux. The scanbd is configured to scan a page from the scanner when the scan button is pressed. Everything works fine when running scanbd directly from command line as scanbd -d1 -f. However, when I run it as a service (with systemd), there's a delay of about 30-40s before scanning starts (although it scans eventually).

I've followed this guide to install/configure scanbd.

I left the scanbd.conf as the default configuration. My test.script looks like this:

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

Any ideas as to why the massive delay is introduced?

ierdna
  • 5,753
  • 7
  • 50
  • 84
  • Did you determine scanner device type manually ? Auto-detect-device got a lot delay for scanning bus/busses . – dsgdfg Dec 03 '18 at 11:57
  • if it was the auto-detect issue, then running scanbd from command line would have the same delay, oddly it does not. – ierdna Dec 03 '18 at 11:59
  • Try it first in the terminal, it will run late if there is no service record. In addition, some **ttyAMx** connections require additional configuration in the system. The Terminal can provide this, but applications will not work like system applications! – dsgdfg Dec 03 '18 at 12:06
  • Short tricks : How to prepare bus/bus_block_size on plugin ? Filling buffer and read `EOF` are different methods. – dsgdfg Dec 03 '18 at 12:12
  • 1
    To add more debug output, including timings, use `export SANE_DEBUG_DLL=255 && scanimage -L` – user8162 Jan 05 '21 at 16:44

1 Answers1

1

Finally figured out a workaround. The delay comes from scanbm.socket service.

Steps to fix: 1. disable the socket:

systemctl stop scanbm.socket
systemctl disable scanbm.socket
  1. remove net as the device from /etc/scanbd/sane.d/dll.conf

  2. remove scanbm dependency from the scanbd service:

#/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. restart the scanbd service: systemctl restart scanbd
ierdna
  • 5,753
  • 7
  • 50
  • 84