Install packages:
$ apt install sane scanbd netpbm ghostscript poppler-utils imagemagick unpaper util-linux tesseract-ocr parallel units bc tesseract-ocr-deu ocrmypdf libtiff-tools
Add to the end of /etc/scanbd/fujitsu.conf:
ix1400
usb 0x04c5 0x1630
In /etc/scanbd/dll.conf comment out everything except "fujitsu".conf
:0,%s/^/#/
:0,%s/^#fujitsu/fujitsu/
Raspberry PI throws kernel OOPS around otherwhise due to scanbd trying to access devices the PI does not have(i assume a parrallel port or something).
Create "/etc/udev/rules.d/99-futjitsu.rules" with:
Fujitsu ix1400
ATTRS{idVendor}=="04c5", ATTRS{idProduct}=="1630", ENV{libsane_matched}="yes"
$ udevadm control --reload-rules $ udevadm trigger
< Reconnect Device by closing/reopening the lid>
$ systemctl stop scanbd.service
Verify that you see the device via: $ sudo -u saned bash -c "SANE_CONFIG_DIR=/etc/scanbd/ scanimage -L" device `fujitsu:ScanSnap iX1400:890' is a FUJITSU ScanSnap iX1400 scanner
If this does not work check udev rules.
In /etc/scanbd/scanbd.conf: Change group to saned Comment out everything except fujitsu.conf at the end.
$ systemctl start scanbd.service
In /etc/sane.d/dll.conf comment out everything except "net" :0,%s/^/#/ :0,%s/^#net/net/
Do the same for everything under /etc/sane.d/dll.d/
In "/etc/sane.d/net.conf" uncomment connection_timeout = 60 and add localhost to the end.
In /etc/inetd.conf comment out: sane-port stream tcp nowait saned /usr/sbin/scanbm scanbm
Restart inetd.service: $ systemctl restart inetd.service
Restart and check scanbm.socket systemctl start scanbm.socket systemctl status scanbm.socket
When scanbd gets a event it will free the usb device, this allows scanbm to provide the scanner to local/remote sane clients without having to stop scanbd. After the action script finished, watch by scanbd is resumed again. Yes its this insane. No not libinsane.
$ mkdir /var/lib/saned $ chown saned: /var/lib/saned $ sudo -u saned bash
ssh-keygen
< defaults are ok>
copy pub key to server
Create /etc/scanbd/scripts/test.script:
!/bin/bash
set -xe
trap 'catch $? $LINENO' EXIT
catch() { if [ "$1" != "0" ]; then echo "error $1 occured on $2" >> $LOG_FILE echo "error $1 occured on $2" | mosquitto_pub -t $MQTT_TOPIC -l fi }
MQTT_TOPIC=sj/rpi-sj/scan LOG_FILE=/tmp/scanbd.log ACTION=$SCANBD_ACTION UPLOAD_HOST=rpi-scan@XX UPLOAD_PATH=/scans
now=date +"%Y-%m-%d-%H%M%S"
filename=scan-$now.pdf
filepath=/tmp/scans/$filename
mkdir -p /tmp/scan
echo "-----" >> $LOG_FILE echo "ACTION: $ACTION" >> $LOG_FILE echo "SCANDIR: $filepath" >> $LOG_FILE echo "_____=" >> $LOG_FILE env >> $LOG_FILE echo "======" >> $LOG_FILE echo "......" >> $LOG_FILE if [ "$ACTION" == "scan" ]; then echo "running" | mosquitto_pub -t $MQTT_TOPIC -l
echo "scanning" >> $LOG_FILE
/opt/sane-scan-pdf-1.2/scan -d -r 300 -v -m Lineart --ocr --deskew --unpaper --skip-empty-pages -o $filepath >> $LOG_FILE 2>&1
echo "uploading" >> $LOG_FILE
echo "put $filepath $UPLOAD_PATH" | sftp -b - $UPLOAD_HOST >> $LOG_FILE 2>&1
echo "setting permissions" >> $LOG_FILE
echo "chmod 664 $UPLOAD_PATH/$filename" | sftp -b - $UPLOAD_HOST >> $LOG_FILE 2>&1
echo "finished" | mosquitto_pub -t $LOG_FILE -l
fi
echo "-----" >> $LOG_FILE
git clone https://github.com/rocketraman/sane-scan-pdf or use releases from repo Place it into /opt.