How Too Peripherals Python Tutorials

Setting-up SANE for Canon CanoScan LiDe 300 scanner

Post Reply
raspberrypi / howtoo     Views: 2820Prev .. Next
Setting-up SANE for Canon CanoScan LiDe 300 scannerPosted: Friday, June 5, 2020 [21:17:21] - 1
rootPosted by:rootMember Since:
June 16 2010
Posts: 357
Apparently, current RPi backends version 1.0.27 don't support Canon CanoScan LiDe 300 scanner.
THis scanner requires version 1.0.28 but 1.0.29 is even better.
Setting-up SANE for Canon CanoScan LiDe 300 scanner

Installing SANE backends from repository installs version 1.0.27 and scanner is a no-go.
It's a dirty hack, but it works like a charm for what we need it.
View Code
Remove all installed SANE components if anything was installed before:
sudo apt-get remove --purge xsane sane && apt-get update && apt-get upgrade

create a temp directory and cd to it:
mkdir temp
cd temp

Install prerequisites:
sudo apt-get install libusb-dev
sudo apt-get install libusb-1.0-0-dev
sudo apt-get install libjpeg-dev
sudo apt-get install libtiff-dev
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libxml2-dev
sudo apt-get install libpng-dev

Get backends version 1.0.29
wget gitlab.com/sane-project/b..
tar -xvf sane-backends-1.0.29.tar.gz
cd sane-backends-1.0.29
./autogen.sh # only if you just cloned the git repository
./configure
make
sudo make install

Then configure your scanner by editing canon_dr.conf file:
sudo nano /usr/local/etc/sane.d/canon_dr.conf

Add the following to the bottom of the file:
# [LiDE 300]
usb 0x04a9 0x1913

We also deleted all other scanners from canon_dr.conf file as we have no plans on using them.
Also, we removed all configs from /usr/local/etc/sane.d/dll.conf and left only:
canon_dr
pixma

in /usr/local/etc/sane.d/pixma.conf
uncomment line, unless you plan to use your scanner on a network:
networking=no


We're almost done. Now, we need to check if scanners works. Scanner do not work directly from USB port, it needs power and Raspberry Pi's USB is not capable to provide enough of it.
So, use powered USB Hub.

At this point your LiDe 300 scanner should work.

Next, using and troubleshooting Canon CanoScan LiDe 300 scanner.There's no place like ~
Using Canon CanoScan LiDe 300 scanner from TerminalPosted: Friday, June 5, 2020 [21:29:45] - 2
rootPosted by:rootMember Since:
June 16 2010
Posts: 357
Your scanner should be functional by now.
We did not add pi user to scanner group, so we'll be using sudo for all commands.
View Code
sudo sane-find-scanner
should result in something like this:
...
found USB scanner (vendor=0x04a9 [Canon], product=0x1913 [LiDE 300]) at libusb:001:008
...

and then scanner should be recognized by:
sudo LD_LIBRARY_PATH=/usr/local/lib scanimage -L
(we force library location by LD_LIBRARY_PATH

Now, try scanning:
sudo LD_LIBRARY_PATH=/usr/local/lib scanimage --resolution 300 --format=tiff > ~/test.tif

In our case scan had 40 seconds delay before actually scanning.
Delay caused by backend search for scanner's USB port. To speed things up, let's tell scanimage where our scanner is by adding device-name:

sudo LD_LIBRARY_PATH=/usr/local/lib scanimage --mode Gray --device-name=pixma:04A91913_484XXX --resolution 300 --format=tiff > ~/test.tif

device-name is produced by scanimage -L command above

if you need to debug the process, just add debug command to scan:
sudo LD_LIBRARY_PATH=/usr/local/lib SANE_DEBUG_DLL=128 scanimage --device-name=pixma:04A91913_484XXX --resolution 300 --format=tiff > ~/test.tif

to see all available scanimage commands, use the following:
sudo LD_LIBRARY_PATH=/usr/local/lib scanimage -h



Now, it takes 10-12 seconds for scanner to scan 300dpi letter-size color TIFF file, producing about 28Mb file.There's no place like ~
SANE two Canon CanoScan LiDe 300 scannersPosted: Friday, July 3, 2020 [13:11:11] - 3
rootPosted by:rootMember Since:
June 16 2010
Posts: 357
It appears that FreeBSD won over Raspberry Pi:
www.codemacs.com/other/an..

Few reasons why FreeBSD on Intel NUC was chosen over RPi:
1. More dependable and faster SATA Hard Drive
2. Easier and faster setup
3. Power capable USB ports, no need for USB Hubs
4. More hardware resourcesThere's no place like ~
RE: Setting-up SANE for Canon CanoScan LiDe 300 scannerPosted: Wednesday, July 15, 2020 [09:05:31] - 4
Posted by:BorisPosts: 2
Hello,
I am trying to set up a Lide 400 scanner using your post. I ended to
sudo LD_LIBRARY_PATH=/usr/local/lib scanimage -L
which work fine as my scanner is well identified as pixma:04A91912_43D381 is a Canon canoscan LiDe 400.
Next step (sudo LD_LIBRARY_PATH=/usr/local/lib scanimage --resolution 300 --format=tiff > ~/test.tif)
ends with an Error during device I/O.
When I run the command with debug, I have
/usr/local/lib/libsane-pixma.so.1' (No such file or directory).
However file exists on drive.
Could you please help me on debugging this?
RE: Setting-up SANE for Canon CanoScan LiDe 300 scannerPosted: Wednesday, July 15, 2020 [09:45:17] - 5
rootPosted by:rootMember Since:
June 16 2010
Posts: 357
I assume you're using RPi and edited:
/usr/local/etc/sane.d/canon_dr.conf
and
/usr/local/etc/sane.d/dll.conf
files

Don't know the code for LiDE 400 scanner to enter in /usr/local/etc/sane.d/canon_dr.conf
it should look like:
# [LiDE 400]
usb xxxxxx xxxxxxThere's no place like ~
RE: Setting-up SANE for Canon CanoScan LiDe 300 scannerPosted: Wednesday, July 15, 2020 [10:03:51] - 6
Posted by:BorisPosts: 2
Hi,
Indeed I use a RPi 3B.
I edited canon_dr.conf with
usb 0x04a9 0x1912 since Lide 400 idProduct is 0x1912
I also edited dll.conf as mentionned in your post
This allowed the command scanimage -L to work. I was struggling before to make this command work so thank you for that.
Any idea of what to test next to make the command scanimage to work?
Thank you for your help
RE: Setting-up SANE for Canon CanoScan LiDe 300 scannerPosted: Wednesday, July 15, 2020 [10:15:00] - 7
rootPosted by:rootMember Since:
June 16 2010
Posts: 357
Boris,
As I've mentioned above, it's a dirty hack.
After considering all the hurtles I went a FreeBSD way. Much easier and works right out of the box without any hacks.
No need for network scanner setups etc.
I looked at my /usr/local/lib/libsane-pixma.so.1 - no such file
I have /usr/local/lib/libsane.so.1 link to a file /usr/local/lib/libsane.so.1.0.29
and /usr/local/lib/libsane.so.1.0.30 on FreeBSD
(your file system may vary)There's no place like ~
raspberrypi / howtooPrev .. Next
 
Post Reply
Home - Raspberrypi: How Too Peripherals Python Tutorials
Our Telegram Group