PLEASE NOTE: This article is obsolete or related to a discontinued product.

Scanning images via network using SANE and a USB scanner

by John Crispin
@phrozen

This article explains how to setup your fox to turn it into a network scanner

To quickly test the Sane support for your FoxLX416 or classic "red" Fox with MCM chip download one of these file:

  • Fimage for FoxBoard LX416 that contains SANE
  • Fimage for classic FoxBoard with MCM that contains SANE
  • SANE - Scanner Access Now Easy for the Fox

    SANE is a tool that is used on Linux to allow scanning of images. The project is very mature and supports about 1270 different scanner devices, some work better than others. You can find a list of all the supported devices here . SANE is part of the new SDK Install the SDK on Linux(Phrozen Patch Beta2). As the whole application would take several MB, only the basics parts are installed. You will have to manually copy the files specific to your scanner to the FOX.

    Configuration

    There are certain steps that need to be taken to make sane work. Firstly the fox needs to be configured. After that your host PC needs to have sane installed (Linux only) and then you need to install an application to do the actual scanning

    Setting up the FOX

    Firstly we can match IP and hostname in the Fox to let sane know its own IP. This is done by adding an entry in the file /etc/hosts. The correct content for a FOX with the IP 192.168.0.90 would look like this
    192.168.0.90    axis
    127.0.0.1       localhost
    
    After you have done this, you need to set which IPs are allowed to connect to the sane daemon program running on your Fox. To do this you need to edit the file /etc/saned.conf. The following will show lines that are valid choices:
    # allow access to the PC with the IP 192.168.0.1
    192.168.0.1
    # allow access to PCs with the IPs between 192.168.0.1 and 192.168.0.255
    192.168.0.1/8
    
    Finally, you need to copy the backend provider file to the fox, that matches your scanner device. The file needs to be placed in the folder /mnt/flash/sane-libs/. To find out, which backend provider you need, check this list. I have a Canon N670U. According to the list i need to use the plustek backend. The backend files have the format libsane-.so.1. This archive contains all the backends. As I have a plustek based scanner i need to copy the file libsane-plustek.so.1 to the FOX.
    # scp libsane-plustek.so.1 root@192.168.0.90:/mnt/flash/sane-libs
    
    Once you have done all this, you can test if the setup is working. There are two commands you can run. The first one checks for any scanner attached to the USB ports of the FOX.
    # sane-find-scanner
    found USB scanner (vendor=0x04a9 [Canon], product=0x220d [CanoScan], chip=LM9832/3) at libusb:001:002
    
    The second command checks if your backend works with the scanner
    # scanimage -L
    device `plustek:libusb:001:002' is a Canon N670U/N676U/LiDE20 USB flatbed scanner
    
    All done, we can now configure our PC to use the scanner via the network.

    Setting up your Linux PC

    To be able to scan images from a Linux PC some steps need to be taken. Firstly you need to have sane installed. On my debian system, I need to run the following command. (If you managed to get it working on a different distro, please let us know so we can add the info here)
    # apt-get install sane libsane sane-utils
    
    The next step to take is to tell sane where the scanner is located. To do this you need to edit the net.conf file. On my debian PC it is located under /usr/local/etc/sane.d. Simply add the IP of your FOX to this file. My file looks like this
    # 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.0.90
    
    Finally you need to have an application that can use sane. I tested with xsane. To install it on debian and then run it, I did the following:
    # apt-get install xsane
    # xsane
    
    Xsane will startup and then try to detect the FOX, so be patient, it seems like nothing happens for about 15 seconds. Now you can start scanning :-) It is also possible to use a gnome plugin, but i have not yet tried it.

    Setting up your Windows PC

    Coming soon, with hopefully TWAIN support :-)

    Compiling an fimage with sane support

    This is requiring the new SDK release 101 or newer installed on your Linux workstation: Install the SDK on Linux

    Run the following command and choose the SANE configuration option

    # ./acme_config
    

    This configuration options has been prepared for a Fox LX416. If you have a MCM one or another kind of Fox like LX832 you have to change board type in the first option after launching make menuconfig.

    Afterwards, run

    # ./configure
    # make
    # make flash
    

    Links