configuration d’un scanner usb partagé sur le réseau via Tomato firmware

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!

source