The Cube - Assimilating Technology

The Cube

Adding saned to Thinstation

For Humans only


Adding saned to Thinstation Print E-mail
Monday, 26 November 2007 04:36

I needed to be able to allow scanning from my thinstation to the remote windows XP based machine. This article described how I got that working.

It handles how to install saned to the linux thinstation client's boot image.

 

To note: I have not personally used this setup in over 2 years. Recently Jagadeesh used the article and ran into some problems. I was unable to help him, as I could not figure out what was wrong. I am a bit busy, and not much time to spend on the problem. I figure I'll have to follow the guide at some point, see what has chnaged, one day, when I have time.

Anyway, if someone knows what these erros are from, and how to fix the issue(s), please let me know. If tis works for you, give it a rating.

Firstly it was found that you must remove the comments from the dependencies file. The file must only contain your list of dependencies (in this instance only base)

/bin# scanimage -L
scanimage: /lib/libc.so.6: version 'GLIBC2.4' not found (required by /lib/libsane.so.1)

This was later solved by downloading and installing Glibc2.7 into thinstation.

Thus saned compiled, but no scanners are found.

I think I may install some forum software, to create a place where this can be discussed. Whoo hoo another forum on the web....how grand.

Ok, here comes the guide.....

As described in my thinstation setup, I access the windows pro machine via RDP from a diskless thinstation.

Last night Mel wanted to do some image scanning, which presented a problem, as the windows pro machine is hiding in a cupboard, some distance away from the desk where the thinstation lives.

The only solution would be to allow the scanner to be connected directly to the thinstation, and allow the windows machine to access it remotely.

Saned to the rescue !

With saned you can connect the scanner to a linux client, and share it with the network. Then using a windows based saned client, the windows machine can access it remotely.

This document does not describe how to setup the scanner, or saned. It only describes how to add saned to the thinstation client.  You can use the 'How to share a scanner with your network' guide to setup your scanner.

I assume you know how to build/install/setup thinstation, and already have a working build environment (don't confuse build with compile - the compile bit is used to compile and install the new package, build is used to build the thinstation image)

 

The first step was to get the thinstation 2.2 compile environment setup. I use my gentoo based laptop to do the build.

All the work is done under my home folder on the laptop :

 

cd /home/<username> 
mkdir thinstation-compile
cd thinstation-compile

I use thinstation 2.2, so I get the appropriate source tree:

wget http://optusnet.dl.sourceforge.net/sourceforge/thinstation/thinstation_src-2.2.tar.bz2 

Unpack it and cd into the unpacked folder

tar xvf thinstation_src-2.2.tar.bz2 
cd thinstation_src-2.2

Inside the unpacked folder is a source folder (called source)
This is where Thinstation stores the source for packages
cd into this folder

cd source


Get saned sources (During this setup 1.0.18 was the current release)

wget http://alioth.debian.org/frs/download.php/1669/sane-backends-1.0.18.tar.gz

unpack it and cd into the new folder

tar xvf sane-backends-1.0.18.tar.gz
cd sane-backends-1.0.18

copy a setup.sh from another thinstation package, i chose openssh

cp ../openssh-4.3p2/setup.sh ./

edit setup.sh (use your editor - I use joe)

joe setup.sh

Mine looks like this

THINSTATION_PATH=`cat ../../THINSTATION_PATH`

. ../SET_ENV

./configure --prefix= --bindir=/bin --sbindir=/bin --libdir=/lib

make clean
make

enter the thinstation compile environment (this is the root of the unpacked thinstation files)

cd ../../
./RUNME

You should get a message like this :

'You have entered the Thinstation Build Environment'

(note, I also get an error : tgetent: warning: termcap entry too long which i chose to ignore for now)

compile sane: (you MUST be in the compile environment, or else the next command will compile against your base install, and not against Thinstation libs etc)

cd source/sane-backends-1.0.18
./setup.sh

Great, I had no compile errors. If you had any, sort them out first, then recompile. install it

make install 

exit build environment

exit

Ok, so now sane is built. The next task is to add it as a package into the thinstation build environment. I have my previous build environment, which was used to build my current running thinstation remote boot. So I will add sane to this.

cd /home//Thinstation-2.2/packages

Use the example package folder as a template:

cp -xav ./template ./sane

copy the compiled sane binaries

cd ./sane/bin 
cp -xav /home//Thinstation-compile/thinstation_src-2.2/bin/sane* ./
cp -xav /home//Thinstation-compile/thinstation_src-2.2/bin/scanimage ./
cp -xav /home//Thinstation-compile/thinstation_src-2.2/bin/gamma4scanimage ./
cp -xav /home//Thinstation-compile/thinstation_src-2.2/bin/libusb-config ./
rm your_own_binaries_should_go_here

copy the required sane libs

cd ../lib
cp -xav /home//Thinstation-compile/thinstation_src-2.2/lib/sane ./
cp -xav /home//Thinstation-compile/thinstation_src-2.2/lib/libsane.* ./
cp -xav /home//Thinstation-compile/thinstation_src-2.2/lib/libusb.* ./

Edit the package command file

cd ../etc/cmd
echo 'CMD_GLOBAL=""' >./sane.global
rm example*
rm README

The following file must exist, as per the Thinstation docs

cd ../console
touch sane
rm README

Create the startup file for when the thinstation boots

cd ../init.d
mv your_start_up_script ./sane

edit the new startup script and add the following line in the init part:

'mount -t usbfs none /proc/bus/usb'

link the startup init file to the startup process

cd ../rc5.d
rm S10*
ln -s ../init.d/sane ./S10sane

Go back into the etc folder, and create an entry in xinietd for the saned-port

cd ..
mkdir xinetd.d
cd xinetd.d

Create a new config file called saned and add the following lines

service sane-port
{
socket_type = stream
server = /bin/saned
protocol = tcp
user = nobody
group = users
wait = no
disable = no
}

Go back up one folder, back into etc

cd ..  

create udev rules

mkdir -P udev/rules.d 
cp /home//Thinstation-compile/thinstation_src-2.2/source/sane-backends-1.0.18/tools/udev/libsane.rules ./udev/rules.d/

edit the rules and change all occurrences of group name scanner to users

joe ./udev/rules.d/libsane.rules (in joe I use ctrl+k+f to do a search and replace)  

You should still be in the etc folder. If not go there. copy the sane config files

cp -xav /home//Thinstation-compile/thinstation_src-2.2/etc/sane* ./ cd sane.d 

Edit the sane config files to your needs (outside scope of this document)
Edit dll.conf and make sure the config entry 'net' is enabled
Edit net.conf and add your subnet, or just the ip's of machines allowed to access scanner. You must also make sure localhost is enabled in this file.
Edit saned.conf and add subnet(s) allowed to access local scanners. add the line to build our package to build.conf

cd ..
echo "package sane # sane scanner software" >> build.conf

That should be it.
Rebuild the Thinstation system, copy the boot image you want to use to your bootp server (or however you use it, and reboot. Using the steps above I got mine working first time.

On the windows client I use a saned client (just google for them, there are a few)

Works 100% everytime I want to scan.

Last Updated on Tuesday, 22 December 2009 21:18
 
Share on facebook