Copyright(c) Thomas Habets thomas@habets.se 2014-2016
Scans from USB scanner directly into Google drive.
apt-get install sane-utils libsane-hpaio imagemagick
And for compiling:
apt-get install git mercurial
And Go.
GOPATH=$HOME/go go get github.com/ThomasHabets/autoscan
Put this in /etc/udev/rules.d/99-autoscan.rules:
ATTRS{idVendor}=="04c5", ATTRS{idProduct}=="1155", SYMLINK+="usbscanner", GROUP="scanner"
Make sure whatever user you run as is member of "scanner" group.
sudo mkdir -p /opt/autoscan/{bin,log,etc}
sudo chown -R scanner /opt/autoscan
cp $HOME/go/bin/autoscan adafruit/lcd.py /opt/autoscan/bin/
cp -ax web/{templates,static} /opt/autoscan/
/opt/autoscan/bin/autoscan -config=/opt/autoscan/etc/autoscan.conf -configure
sudo apt-get install build-essential python-dev python-smbus python-pip git
sudo pip install RPi.GPIO
git clone https://github.com/adafruit/Adafruit_Python_CharLCD.git
(cd Adafruit_Python_CharLCD && sudo python setup.py install)
git clone https://github.com/adafruit/Adafruit_Python_GPIO
(cd Adafruit_Python_GPIO && sudo python setup.py install)
echo i2c-bcm2708 | sudo tee -a /etc/modules
echo i2c-dev | sudo tee -a /etc/modules
Also add the scanner user to the "i2c" group.
- ButtonSingle 22
- ButtonDuplex 23
- Button3 17
- Button4 27
- LED 1: 6 / 25
- LED 2: 5 / 24
Such as:
#!/bin/sh
exec scanimage \
-d fujitsu \
-y 300 -x 300 \
--page-width 300 \
--page-height 300 \
"$@"
/opt/autoscan/bin/autoscan \
-scanimage=/opt/autoscan/bin/scanimage-wrap \
-templates=/opt/autoscan/templates \
-static=/opt/autoscan/static \
-socket=/opt/autoscan/run/autoscan.sock \
-config=/opt/autoscan/etc/autoscan.conf \
-logfile=/opt/autoscan/log/autoscan.log \
-use_adafruit
If you scan 10 or more pages at a time (double-sided counts as two) then you may want to increase the limit from the default of 1GiB.
In /etc/ImageMagick-6/policy.xml
find <policy domain="resource" name="disk" value="1GiB"/>
and change it to a higher value like
10GiB.
Bugs in gpio on github:
- not checking for EINTR
- race condition opening for output: direction not set before value sent.
- improper locking