Page 1 of 1

Howto: Install an scanner server on bubba 2

Posted: 20 Feb 2009, 18:46
by ryz
This is how I installed my all in one Epson Stylus Photo RX 560 on Bubba 2 and accessing it from my Ubuntu machine. Note that this should only be done in an secure local network behind a good firewall since else your scanner will be open to the whole world.

The scanner server does not work as the printer server, that is you will not be able to use your windows scanner programs and drivers. The scanner needs to be supported by the Linux SANE software that is running on Bubba http://www.sane-project.org/. To access the scanner from windows you need to install a scanner program that is capable to talk to the sane server. One such program is the windows port of xsane http://www.xsane.org/xsane-win32.html I have not tried this myself.

1) Installing the necessary scanner software. This is done with running the following command as root. Note that almost every command in this how to needs to be run by root.

Code: Select all

apt-get install libsane-extras sane-utils
2) Now you should connect the usb scanner to Bubba 2 and test if it is found. Run the command

Code: Select all

 scanimage -L
This should print some thing like
ryz:~# scanimage -L
device `epkowa:libusb:001:004' is a Epson PM-A820 flatbed scanner
If not your scanner is probably not supported by the sane scanner program and then I have no idea on what to do.

3) Now it is time to see if your scanner device gets the right permission. This is done by running

Code: Select all

ls -l /dev/bus/usb/<number1>/<number2>
Where nuber one is the first number after the libusb: printed by the command scanimage -L and number2 is the second number. So for me it looked like this
ryz:~# ls -l /dev/bus/usb/001/004
crw-rw-r-- 1 root scanner 189, 3 2009-02-20 23:00 /dev/bus/usb/001/004
The important part here is the word that I made bold and underlined. If it does not say scanner but rather lp the Bubba does not correctly recognise your scanner as an scanner. If Bubba correctly detects your scanner you can move on to section 5 else you should start with section 4

4) Fixing permission
If Bubba does not correctly recognise your scanner you need to edit the config files for udev. Udev is the demon that tries to figure out what devices is pluged in to Bubba and take the correct actions. Run

Code: Select all

nano /etc/udev/libsane-extras.rules
The line to add is

Code: Select all

SYSFS{idVendor}=="<vendor_number>", SYSFS{idProduct}=="<product_number>", MODE="664", GROUP="scanner"
Where you will get the <vendor_number> and <product_number> by running the following command

Code: Select all

sane-find-scanner
My listing was
ryz:~# sane-find-scanner

# sane-find-scanner will now attempt to detect your scanner. If the
# result is different from what you expected, first make sure your
# scanner is powered up and properly connected to your computer.

# No SCSI scanners found. If you expected something different, make sure that
# you have loaded a kernel SCSI driver for your SCSI adapter.

found USB scanner (vendor=0x04b8 [EPSON], product=0x0827 [USB2.0 MFP(Hi-Speed)]) at libusb:001:004
# Your USB scanner was (probably) detected. It may or may not be supported by
# SANE. Try scanimage -L and read the backend's manpage.

# Not checking for parallel port scanners.

# Most Scanners connected to the parallel port or other proprietary ports
# can't be detected by this program.
The important line is the one marked in bold. So the line I added was
SYSFS{idVendor}=="04b8", SYSFS{idProduct}=="0827", MODE="0664", GROUP="scanner"
After this an reboot of Bubba is needed which is easiest done with running

Code: Select all

reboot
Now do an new

Code: Select all

ls -l /dev/bus/usb/<number1>/<number2>
And hopefully you will now have the right permission. Note that number1 and number2 might have changes so you might need to run scanimage -L once again to get the correct numbers.

5) Adding the scanner group to the saned user.
Every user that shall be able to access the scanner needs to belong to the scanner group. Since you should not run the saned server as the root user but rather the by the added saned user, which was added when installing the sane tools, you need to add the scanner group to the saned user. This is done with the following command

Code: Select all

adduser saned scanner
6) Configure saned to allow connections from the clients.
Default saned does not allow anyone to connect to it over the network so we need to configure who should be able to connect. This is done by editing

Code: Select all

nano /etc/sane.d/saned.conf
Here you need to add the hostnames for the client that should be able to connect.

7) Installing and configuring xinetd
Since the saned server is not a demon that is a program that should be runing all the time but rather only when some one connects to Bubba for scanning we need some demon that listens for connections and start the saned server when it finds one. This is where xinetd comes in since its purpose is to listen to incoming connections and when it finds one to start the correct program. I have to confess that I do not have the full knowledge of xinetd and especially not how the default install of xinetd is set up. Hopefully it is set up in an secure way and does not listen to any connections at all so that the only connections it will listen to is the one that we will configure. But since your computer should be behind an god firewall anyway it should probably be safe but i do not promise anything.

Install xinetd with

Code: Select all

apt-get install xinetd
And the you should edit the configuration file

Code: Select all

nano /etc/xinetd.conf
Add the following lines
# description: The sane server accepts requests
# for network access to a local scanner via the
# network.
service sane-port
{
port = 6566
socket_type = stream
wait = no
protocol = tcp
user = saned
group = scanner
disable = no
server = /usr/sbin/saned
}
The we need to tell xinietd to re read its configuration this is done with

Code: Select all

/etc/init.d/xinetd restart
This should be all for the Bubba part.

8) Installing and configure the Ubuntu 8.10 client.
If you have an other distribution the method might differ. First we should install the sane-utils if it is not already installed. It Might be installed in the default configuration I do not remember. This is done by runing the following command as an user. In Ubuntu you do not change to the user root instead you use the sudo command to run commands as root.

Code: Select all

sudo apt-get install sane-utils
You then need to edit the file /etc/sane.d/net.conf and add the address to your Bubba.

Code: Select all

sudo nano /etc/sane.d/net.conf
You also need to add your user to the scanner group with

Code: Select all

sudo adduser $USER scanner
Now you should be able to find the scanner with the command

Code: Select all

scanimage -L
The next thing to do is installing your favourite sane user interface. One of the most powerful is xsane even if it is a little bit ugly and confusing sometimes. If you would like to try xsane install it with

Code: Select all

sudo apt-get install xsane
THE END

Re: Howto: Install an scanner server on bubba 2

Posted: 04 Mar 2011, 04:53
by Tompa
Thanks for this guide!

It worked flawlessly on my bubba 3 using my Samsung SCX-4200 multifunctional printer/scanner.