As I wrote in my previous post, Tomato USB firmware is quite stable and functional. It was able to detect my Epson BX300F printer just of the box, but later I’ve noticed that the scanner on my printer does not work. It is possible to solve this problem with just a few lines of commands in command line, but it took quite a while for me to figure out what exactly was wrong.
This guide will focus on installing and configuring scanner server for Asus RT-N16 router on Tomato USB firmware. Before proceeding make sure you have configured ipkg optware, and if not, follow this article: http://www.shcherbyna.com/?p=960
Following is required to perform this task:
1. Asus RT-N16 router
2. Tomato USB firmware installed on router
3. Ipkg already configured on router
4. SSH enabled
Let’s get started. First of all we have to install required libraries before installing saned server. Connect to router via SSH and issue the following commands:
ipkg update
ipkg install libusb
ipkg install libtiff
ipkg install libjpeg
ipkg install libieee1284
mkdir /opt/var
Now we have to install xinetd and sane packages:
ipkg install xinetd
ipkg install sane-backends
It has to be done exactly in this order, otherwise things may go wrongly. Make sure you had no errors when executing above commands. Now it is time to test if sane can see your scanner. Run the following command:
sane-find-scanner
This should output any scanners attached to router, if sane is capable to detect them. Here is mine output:
found USB scanner (vendor=0x04b8, product=0x0848) at libusb:001:002
Now let’s try to issue some scanner test command, for example:
scanimage -L
It should output something like this:
device `epson2:libusb:001:002′ is a Epson NX300 flatbed scanner
If it shows errors use google to find solution for them :), otherwise it is time to change config files for xinetd and sane so that they can accept clients scanning from LAN. Open file /opt/etc/xinetd.d/saned and make sure it looks like this:
service saned
{
port = 6566
socket_type = stream
server = /opt/sbin/saned
protocol = tcp
user = root
group = root
wait = no
disable = no
}
Attention: settings below are only in case if your subnetwork is of type 192.168.1.* , if it is not the case, modify 192.168.1.0/24 accordingly.
Now open file /opt/etc/xinetd.conf and make sure it looks like this:
defaults
{
only_from = 192.168.1.0/24
instances = 60
log_type = FILE /opt/var/xinetd.log
log_on_success = HOST PID
log_on_failure = HOST
cps = 25 30
}
includedir /opt/etc/xinetd.d
Now open file /opt/etc/sane.d/saned.conf and add the following line somewhere:
192.168.1.0/24
You are done! It is time now to make xinetd to be run just after mounting, so that if you reboot router, it get’s started after /opt is mounted:
Save settings and reboot router. You are done on the server side.
Now it is time to configure your client machine(s).
Linux computers
If you are running Fedora install xsane package:
sudo yum install xsane
If you are running Ubuntu:
sudo apt-get install xsane
Now you have to edit the file /etc/sane.d/net.conf and add into it the IP of router, i.e.
192.168.1.1 # My RT-N16 IP
Windows computers
1. Download xsane from ftp://ftp.sane-project.org/pub/sane/xsane/
2. Extract it to folder C:\sane (do not change folder, it may not work)
3. Edit file C:\sane\etc\sane.d\net.conf and make sure it looks like this: (attention: some people had problem when having multiple lines in this file, so make sure you have only one line!):
192.168.1.1 # My RT-N16 IP
Now you can run xsane and see if scanning works ๐ Have fun!
Hi,
Excellent article. Good work!
The output from scanimage -L is:
device `hpljm1005:libusb:001:002′ is a Hewlett-Packard LaserJet M1005 multi-function peripheral
The printer is working ok. Unfortunately sane/scanning is not working in my system. I think that in my system the xinetd is not running. How can I check if the xinetd service is running?
Should the xinetd write something to xinetd.log?
I am a total newbie with this, so I am sorry if my questions are simple/stupid.
Could You please give me a couple of hints where to start looking the solution?
Hello AriA,
Glad that this article is interesting for someone ๐
If you have configured /opt/etc/xinetd.conf to store log file as I wrote in the article, the log file should be stored in /opt/var/xinetd.log . Show the ouput here.
Hi,
Thx, I can install SANE on Tomato into my ASUS N16 router with the instructions you provided.
When I use sane-find-scan, it can identify my multifunction Epson printer:
“found USB scanner (vendor=0x04b8 [SEIKO EPSON], product=0x084d [USB MFP]) at libusb:002:003”
Howeve the scanimage -L cannot identify my scanner. Any idea? My scanner is Epson TX110
“No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).”
Alex
Hi,
I was too tired last time when I tried to make this work :-(. I had two mistakes in configuration files, and that was the reason why it didn’t work:
in xinetd.conf I had only_from = localhost 192.168.1.0/24, so the localhost was somewhow left there…. stupid mistake.
The other error was sane port configuration, the = -mark was missing.
So fixing the configs made it work
Thank You again for the excellent instructions.
So it is now proved that tomato USB 1.28 Beta can be used to turn a HP Laserjet 1005M to a network printer & Scanner. Thanks again!!!
I have managed to get the scanimage -Z working, by adding a line (usb vendorID and productID…) to the epson2.conf
However the saned cannot be started
I got the following message in the system log
saned from sane-backends 1.0.20 starting up
check_host: getpeername failed: Socket operation on non-socket
init: access by host [error] denied
saned: saned exiting
Any idea
I got something like this as well. After playing with config files I was able to make it work. Try to make sure your config files are exactly like the one I wrote in this article.
I finally got it working. Actually, it was already working.
Thx for the great information.
Any good frontend program can product multiple PDF?
Alex
Infix Pro PDF Editor ?
Hi,
Thanks for the detailed instruction. I have a problem though, sane-find-scanner found USB scanner, but scanimage -L: No scanners were identified.
Alex, how did you fix this?
Thanks
Turns out my multifunction printer, Brother MFC-4800 is not on sane’s support list. Any solution? Thanks
Salut,
If it is not supported, it would not work. However, there is a hope that you can tweak sane configs to map already supported Brother printer config file into yours. I did simular in Windows for HP printers.
For example, in your particular case, according to this: http://www.sane-project.org/lists/sane-backends-external.html , there is a project in sourceforget.net to support mfc-4600: http://sourceforge.net/projects/brother-mfc/
If I would be you, I would try to download it and to compile it using mips toolchain.
Thanks Volodymyr
Actually I found that driver already. But I am a newbie to this, do you know how to compile and install a driver manually? or any how-to link?
Thanks again
Salut,
You can try this “howto”: http://code.google.com/p/wl500g/wiki/CompilingCustomFirmware
It is for compiling Oleg’s firmware on linux (should work in debian, ubuntu, fedora, opensuse). It contains toolchain which allows you to compile for arm.
Having toolchain you will have to dig further into sane faqs.
Have fun ๐
Hi Volodymyr,
I had a hard time to set up MFC-7340 scanner to work on N16 with tomato. This scanner is not sane-supported. The “sane-find-scanner” command can detect the device but “scanimage -L” returns “No scanners were identified”.
I followed your suggestions and downloaded the project for MFC-4600. But I do not know how to installed it as I am a Linux newbie. The readme information is below.
Installation:
1. Extract the contents into an existing SANE backend installation.
2. Rebuild:
make clean
make
Can you provide a more detailed help. Thanks a lot!
You will have to download toolchain for Tomato and rebuild the driver yourself. I believe you will also need to re-build sane …
It is not an easy task for a newbie.
Thanks for the information.
It’s a difficult task to rebuild the driver and sane for a newbie like me…
I found the driver on their website but it is in .deb or .rpm file. Is there anyway I can use these to get around of the difficult task of rebuilding driver and sane…
Please advise, thanks…
Having problems getting HP F2210 to be detected by scanimage -L, it is however getting detected by sane-find-scanner:
“found USB scanner (vendor=0x03f0 [HP], product=0x2404 [Deskjet F2200 series]) at libusb:002:002”
I can’t seem to find anything using google as suggested. Anyone know how to fix this?
Thank for any possible info!
What exactly error you got when doing scanimage -L ?
scanimage -L
No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).
Your device does not seem to be supported: http://www.sane-project.org/sane-mfgs.html#Z-HEWLETT-PACKARD
http://www.sane-project.org/cgi-bin/driver.pl?manu=&model=f2210&bus=any&v=&p=
That link indicates that it works with hpaio backend, is it possible to install the backend on the rt-n16?
Hello,
Good job for a well written guide =). However, I still couldn’t manage to get my scanner working.
I can see my device with scanimage -L, but whenever I tried to use xsane.exe, it responded “No devices available” (I believe I have triple-checked the setting to match instructions above).
My device is a multipurpose printer Canon MF3240. Any idea what is going wrong?
Thanks
First of all, thank you Volodymyr Shcherbyna for a great Ipkg and scanner install guides. I successfully applied them on the newest version of Tomato RAF.
I had same problem as you Marco and I found out, that I wrongly left localhost 192.168.0.7 in the net.conf, which is there by default. I deleted it and left just the IP of my router and everything works well ๐
Hope it helps!
I had the same problem with this install and a canon mf3240 initially. I had to update the install and backend, install python/etc from the hp walkthrough or the ddwrt forums, reboot and voila, it was working properly.
I’m able to scan (and print) to the canon downstairs. The only part that is non-functional is the print to fax option.
Hi,
I installed sane on my ASUS 520gu with Tomato USB. Everything look fine on the router. However, my windows 7 computer says “No scan device available.” Could that be the problem of setting “user = root” in file saned because the user is not root in my Windows 7 computer?
Hello twinclouds,
I don’t think so. Most likely something is wrong on the router side. Usually when you have this error in Windows it means that the port is closed on router.
Did you try to scan your router ports (if port is not open, it means your configuration is wrong) or/and see the sane logs?
Hi,
Excellent article. Everything is very clear but as many people got the same problem.
sane-find-scanner
โfound USB scanner (vendor=0x04e8/0x342e [SAMSUNG], product=0x04e8/0x342e [USB MFP]) at libusb:002:003โณ
Something like this.
But on scanimage -L
No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).
As I cheked this link, my device is on the supported list:
http://www.sane-project.org/sane-mfgs.html#Z-HEWLETT-PACKARD
my devise Samsung SCX-4300
any advise, thanksโฆ
Did Ge2tis’ issue ever get resolved? I have the exact same problem with a Samsung SCX-4623f MFP.
It’s found by sane-find-scanner. But not by scanimage -L (same “No scanners were identified” error).
I have modified /opt/etc/sane.d/xerox_mfp.conf to include the line “usb 0x04e8 0x3434”.
I’m using sane-backends 1.0.22-1, so the scanner should be supported.
How should I go about debugging this?
Hello protective1,
Take a look at posts of 2_LuDe and Roger Santos
Hi Volodymyr,
It looks like 2_LuDe and Roger Santos were able to get scanimage -L to work. However, I can’t get scanimage -L to work on my Samsung SCX-4623. If I execute “SANE_DEBUG_XEROX_MFP=9 scanimage -L”, the output is:
[sanei_debug] Setting debug level of xerox_mfp to 9.
[xerox_mfp] sane_init: Xerox backend (build 12), version != null, authorize != null
[xerox_mfp] sane_xerox_mfp_get_devices: 0x7fff5c18, 0
[xerox_mfp] list_one_device: libusb:001:005
No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).
Any ideas on what’s going wrong here?
Hi Volodymy,
First I want to say great article and a great job of doing all the research to gather the tools needed to accomplish this. Thanks for putting this up, I would have never been even close to figuring out all this stuff. Everything is well written and easy to follow.
I spent around 2 days figuring out how to get my setup working and figured that others may run into a similar issue that I saw. I have a supported printer and cut and pasted everything in this article. I was able to get a response back from my scanner through the scanimage -L command. However, every time I run xsane.exe, it will respond with โNo devices availableโ
I was able to finally root cause it to the C:\sane\etc\sane.d\net.conf file. I deleted everything in the file and only put in my router IP: 192.168.1.1. If I added any other commands or lines, it doesn’t work. I am using the Windows frontend. Now it works like a charm and I can scan from any computer!
I am glad it works for you ๐ Btw, your comments is 500th on my blog ๐
Thank you for pointing out the issue with net.conf. I just checked my file, and indeed, I have only one line:
volodymyr@sv1:/media/C/sane/etc/sane.d$ more net.conf
# This is the net config file. Each line names a host to attach to.
# If you list “localhost” then your backends can be accessed either
# directly or through the net backend. Going through the net backend
# may be necessary to access devices that need special privileges.
# localhost
192.168.1.1
I am going to modify article to indicate this.
Thank you, Volodymyr.
LuDe and Volodymyr,
Thank you both. Now my xsane works according to the change. However, I cannot make sanetwain work. It always give the error “Time out reading word from socket”. The exact same setup works with sane on Debian, though. Any suggestions to make it work?
Hello twinclouds,
I am sorry, I have never setup sanetwain, so I don’t know the details. Tell me why it is so good, maybe I will get interested? ๐
Speaking on a troubleshooting part. Do you have wireshark? You can do “sudo apt-get install wireshark” to install it in debian or download a version for Windows. Now, you can filter traffic for both cases: when it works, and when it does not work, and try to analyze the traffic.
Hi,
Thank you for reply.
The reason I want sanetwain is that it can scan within the Windows applications. For example, I can scan it from Adobe Photoshop and directly edit the scanned file there. This is just for convenience.
I will try wireshark as well and let me see if I can find the problem. In any case, thank you for your help.
I can take a look in the direction of sanetwain. Did it work for ya?
It works for me if I use the sane server on Dockstar with Debian but not with tomato/optware.
Which Debian you are using? Sid, stable?
It’s Squeeze (Stable). Sane was installed according to: http://dev.shyd.de/2011/03/debian-printserver-scanserver-hplip-cups-sane/.
I followed all the steps in this tutorial and scanning in Windows didn’t work for me.
Both sane-find-scanner and scanimage -L find the scanner. Also, scanimage -T apparently scans something. But when I try to connect to the server via xsane win32 client, it always gives me an error before connecting (No Devices Available). By the way, the only version I found downloadable over the internet was the 0.991 of this client. Could you help me, please? I’m totally lost in this. I’ve already tried to install CUPS as an alternative solution and it’s returning Segmentation fault. Do you have a guide on this too?
Thank you,
Roger
Hello Roger,
A few questions to understand what is your problem:
1. Can you provide here the content of your file C:\sane\etc\net.conf in Windows machine? The file should contain only and only one line: the IP of the router. If it contains multiple lines, it would not work.
2. What is the IP of your router?
3. Check if your sane port is open on the router using the following command:
netstat -l -e -t -n | grep 6566
4. Check that you can connect to router port 6566 from your Windows machine via telnet
Hello again! Thanks for helping me.
Answering your questions:
1) C:\sane\etc\sane.d\net.conf does have exaclty one line:
192.168.1.1 #My RT-N16 IP
2) 192.168.1.1
3) Command returns the following:
tcp 0 0 0.0.0.0:6566 0.0.0.0:* LISTEN
4) Keeps like this forever:
Microsoft Telnet> open 192.168.1.1 6566
Connecting To 192.168.1.1…
Putty simply returns an alert: “Connection closed by remote host”
I’ve already tried LuDeโs fix without success.
Thank you again,
Roger
Now I noticed the command
telnet 192.168.1.1 6566
is generating this log on the router:
11/6/21@23:28:03: START: saned pid=9652 from=192.168.1.223
The sane windows client isn’t.
Have you tried LuDe’s fix? If worked for me after using his trick.
With SaneTwain I was able to list available scanners but not to scan. This is a real progress! It’s crashing when I try to scan, but scanimage -T returns this error:
process 4543: arguments to dbus_connection_send() were incorrect, assertion “connection != NULL” failed in file dbus-connection.c line 3141.
This is normally a bug in some application using the D-Bus library.
D-Bus not compiled with backtrace support so unable to print a backtrace
Aborted
This is strange because scanimage -T was working yesterday… such a pain to configure this stuff!
Any clues?
Thanks.
Take a look at the section DBus problem:
https://wiki.archlinux.org/index.php/Sane
Seems not to be running. I’m getting Permission Denied error when trying to start it on TomatoUSB firmware. I think it’s everything messed up after several unsuccessfull tries. Gonna start all over again, from scratch, and post the results here.
Well, if you want, I can gzip my opt folder and publish it on the blog. This way, you will be able to have exactly mine configuration of packages & settings.
I did not perform ipkg update for a long time, because I am happy with the way it is working now. It may be that the latest ipkg packages are buggy.
I read somewhere the latest hplip and dbus packages are buggy. I’d very much appreciate if you provide a download of your configuration. Thanks.
Well, I decided to upgrade all my packages in RT-N16 to eliminate possibility of a bug introduced in a newer versions of sane … Well, it went almost well: http://www.shcherbyna.com/?p=1475
The bottom line is: it works, but I had to configure a few files which “ipkg upgrade” overwrote. In any case, I put my upgrade log, so you can see versions I had before and after upgrade …
Finally I got it working!
I formatted the opt partition and started from scratch. Here you are the steps I followed in order to get it working:
– installed optware
ipkg update
ipkg install vim
ipkg install transmission
/opt/bin/transmission-daemon -g /opt/etc/transmission-daemon
– configure settings.json and reboot
– Transmission working
ipkg install ink
– ink utility working
ipkg install libusb
ipkg install libtiff
ipkg install libjpeg
ipkg install libieee1284
ipkg install xinetd
ipkg install sane-backends
– sane-find-scanner works
– scanimage -L doesn’t find scanner
ipkg install hplip
ipkg remove python25 -force-depends
ipkg install python
ipkg install py25-dbus-python
– sane-find-scanner works
– scanimage -L works
– scanimage -T fails with dbus connection error
– manually start of dbus resulted in segmentation fault
– downgraded dbus optware to 1.1.1-3
ipkg remove dbus -force-depends
ipkg install /opt/dbus_1.1.1-3_mipsel.ipk
– reinstalled hplip
– manually started dbus
/opt/etc/init.d/S20dbus start
– sane-find-scanner works
– scanimage -L works
– scanimage -T works
– the start of dbus daemon is a bit buggy, so I found the solution here http://wl500g.info/showpost.php?p=226557&postcount=167 and added the following line to .autorun file:
rm /opt/var/run/dbus/*
Now I’m scanning from SaneTwain utility!
Thanks for helping.
Just to let people know my working configuration:
Printer/Scanner: HP PhotoSmart C4480
Printer works with default driver (p910nd) and scanner works with hplip and sane.
Router and Firmware: RT-N16 and TomatoUSB v1.28.9054 MIPSR2-beta K26 USB Ext
Optwares installed: basically vim, transmission and sane.
All packages and dependencies (from list_installed):
adduser – 1.10.3-1
bzip2 – 1.0.6-1
cups – 1.4.6-1
cyrus-sasl-libs – 2.1.23-2
dbus – 1.1.1-3
dbus-glib – 0.82-1
expat – 2.0.1-1
gdbm – 1.8.3-2
glib – 2.20.4-1
hplip – 3.11.3a-1
ink – 0.5.0-1
ipkg-opt – 0.99.163-10
libcurl – 7.21.6-1
libdb – 4.2.52-3
libevent – 2.0.11-1
libieee1284 – 0.2.11-1
libinklevel – 0.8.0-1
libjpeg – 6b-3
libpng – 1.2.44-1
libtiff – 3.9.5-1
libuclibc++ – 0.2.2-9
libusb – 0.1.12-2
ncurses – 5.7-1
ncursesw – 5.7-1
net-snmp – 5.4.2.1-1
openldap-libs – 2.3.43-2
openssl – 0.9.7m-5
psmisc – 22.13-1
py25-dbus-python – 0.83.0-2
python – 2.5-1
python25 – 2.5.6-1
readline – 6.1-2
sane-backends – 1.0.22-1
sqlite – 3.7.3-1
transmission – 2.31-1
uclibc-opt – 0.9.28-13
vim – 7.3-2
xinetd – 2.3.14-11
zlib – 1.2.5-1
One last thing:
got SaneTwain to work with Photoshop CS5 by copying SaneTwain.ds into %WINDIR%\twain_32 and downloading the adobe optional plugins package (which includes TWAIN support): http://kb2.adobe.com/cps/405/kb405072.html
Gents I am following you guide but coming up against some issues with the same firmware, router and an HP LJ3030 and would appreciate some advice?
Following Roger’s list…
– installed optware
ipkg update
ipkg install vim
ipkg install ink
– ink utility working, but says its an unsupported printer ๐
ipkg install libusb
ipkg install libtiff
ipkg install libjpeg
ipkg install libieee1284
ipkg install xinetd
ipkg install sane-backends
– sane-find-scanner does not work ๐
Please help to find xsane for Windows. Official site (http://www.xsane.org) does not provide it:
“The downloads for xsane-win32 make too much traffic for my server,so please use an other download location for xsane-win32 downloads.”
Could you please help me with link to your own server. Please send me to email.
Thanks a lot in advance!
Any luck with finding of xsane for windows?
Yes I found, mail me if you still need it: max@builderling.com
I have followed the howto step-by-step, but I couldn’t get my SCX-4200 scanner working. I have also tried Roger Santos’ recipe without success.
sane-find-scan can find my scanner, but scanimage -L didn’t work
Has someone been able to get SCX-4200 working?
Hi Volodymyr,
you have such a great blog!! now i know my asus wl-520gu on tomato can do more than just network printing! I’m a newbie in linux environment, but your tutorial is so easy to follow until my epson tx111 recognized successfully on my router and on xsane win32 0.991.
even on sanetwain the scanner is recognized. all “sane-find-scanner” and “scanimage -L” recognize the epson scanner like in your tutorial.
But i have a problem, everytime it starts to scan, after a moment it goes : “device i/o error” i tried with xsane and sanetwain both results are the same.
when i try “scanimage -T” from putty also has message like this:
scanimage : scanning image of size 632-877 pixel at 1 bits/pixel
scanimage : acquiring gray frame, 1 bit/sample
scanimage : reading one scanline, 79bytes… FAIL error : error during device I/O
what could possibly go wrong? i was that close to successfully scanning from my router..
here’s my system setup:
asus wl-520gu router
usb flash disk 1gb for configure and installing ipkg as yaour previous tutorial
epson tx 111 MFP connected to 4-port usb hub with the 1gig usb.
thanx a lot before… sorry for my bad english.
Hello abon,
Sorry for late reply. The best way is to contact the sane team asking why you got this error. You may also do dmesg to see the output of kernel when this problem happens.
WOuld you update the sane backends to 1.0.23?
It seems this thread is dead, anyone?
Thanks for your tutorial.
i have the same config and was really happy, when i read that we got the same printer.
for everyone who searchs sane.
i just take sanetwain (http://sanetwain.ozuzo.net/#download)
Hey, i try to get this working with my Epson Perfection V33. Turns out the V33 needs the external backend epkowa (iscan 2.29.1/iscan-data 1.23.0).
Is there any chance to get it working on the RT-16N??