Friday, August 13, 2010

A Scanner Server for the, uhm, Server...

I went to to find out how to add a scanner server to my setup, and the directions worked perfectly (almost) I had to add two steps to the setup for it to work on my Ubuntu Lucid 10.04 Server setup, so I am going to mirror his steps and just add my little bit. I have no idea if this situation was caused by an Ubuntu thing, my dumb mistake or some minor oversight in the directions, but either way here we go...

First of all I am installing two scanners to the machine, why you ask? Well because I have two within reach and too much time on my hands at the moment.

First you need to make sure you are ready for the scanner so drop to a command line and do the following.

sudo apt-get install libsane sane-utils

First is a Mustek BearPaw 1200CU Plus like so.

Go ahead and get a file called PS1Dfw.usb from and move it to /usr/share/sane/gt68xx/ then sudo chmod a+w it.

Type sudo scanimage -L and you should see something like this...

device `gt68xx:libusb:001:003' is a Mustek Bearpaw 1200 CU Plus flatbed scanner

What you need to know the numbers immediately following gt68xx:libusb:, in my case 000:003 and try to scan the image from the command line.

sudo chmod a+w /dev/bus/usb/001/003
sudo scanimage gt68xx:libusb:001:003 --resolution 300 --format png > ~/test.png

Of course you want to replace the 001:003 with the numbers you got.

The scanner should work now, so if you happen to be have X installed, simply try to scan with your favorite software. If you happen to be at the command line, then you can test it with this the following.

One scanner down, one to go.. If you are just setting up this scanner, read the little bit after I set up the next scanner. It might apply to you.

Next is a HP Photosmart 2610 all-in one. (the printer installs just fine with cups and is probably auto-detected and set up for you if using the desktop version.
Install the HP software.

sudo apt-get install hplip

Now to find out where on the USB bus it is...


You'll get something like this.

Bus 001 Device 002: ID 03f0:4511 Hewlett-Packard PhotoSmart 2600

You'll need to know the first two numbers 001 and 002 in this case and substitute them into the following command.

sudo hp-makeuri 001:002

Now is time for the actual Scanner Server. The steps I added are in a different font.
sudo su

apt-get install netpbm sane-utils tesseract-ocr-eng apache2

groupadd scanner

adduser www-data scanner

echo 'AddHandler cgi-script .cgi' >> /etc/apache2/apache2.conf

cat /etc/apache2/sites-available/default | sed
's/FollowSymLinksMultiViews/FollowSymLinks MultiViews ExecCGI/g' > /tmp/default

mv /tmp/default /etc/apache2/sites-available/default

/etc/init.d/apache2 restart

cd /var/www


tar -xvvf scan_*.tar

rm scan_*.tar
chmod a+w /dev/bus/usb/001:002

Now that the Server is up, just open a page to the machine running the server like this..

If all went well you are almost done, just one more thing...

Now that the scanner is installed and working, you will need (at least I did) to make the chmod a+w /dev/bus/..... permanent. To do this I modified /etc/rc.local to include the two chmod lines I issued to make them work.

chmod a+w /dev/bus/usb/001/003
chmod a+w /dev/bus/usb/001/002

No comments: