Wiki

Clone wiki

rt-n56u / EN / HowToInstallSane

How To Install SANE (Scanner Access Now Easy) On Routers RT-N56U/RT-N65U with ENTWARE


SANE stands for "Scanner Access Now Easy" and is an application programming interface (API) that provides standardized access to any raster image scanner hardware (flatbed scanner, hand-held scanner, video- and still-cameras, frame-grabbers, etc.).


  1. At first, you must check that your scanner or MFP is supported in SANE.

  2. Install Sane-Backends:

    opkg update
    opkg install sane-backends
    
  3. Install Sane-Frontends:

    opkg update
    opkg install sane-frontends
    
  4. Power-On (reconnect) your scanner/MFP and checks that the router identified it. If all is well, we see this result (for example):

    /opt/home/admin # scanimage -L
    device `hpljm1005:libusb:001:002' is a Hewlett-Packard LaserJet M1005 multi-function peripheral
    
  5. Sane works with server inetd or xinetd. In considered firmware integrated server inetd, so we will use it. To automatically start the inetd on startup and reboot the router, add the following lines to the script /etc/storage/started_script.sh:

    ############### inetd.conf file create ###################
    # if app not exist
        if [ ! -f /usr/sbin/inetd ]; then
                exit 0
        fi
        if [ -n "`pidof inetd`" ] ; then
            # stop daemon
                killall -q inetd
        fi
        Login=`nvram get http_username`
        touch /etc/inetd.conf
        echo "sane-port stream tcp nowait $Login /opt/sbin/saned saned" > /etc/inetd.conf
        /usr/sbin/inetd -R 30 -q 64 /etc/inetd.conf
    ##########################################################
    

    When the router will be reboot, the file /etc/inetd.conf will be created with the parameters necessary to run SANE on startup inetd.

  6. Edit file /opt/etc/sane.d/saned.conf.
    6.1. Uncomment following line:

        data_portrange = 10000 - 10100
    

    6.2. Edit the range of IP addresses on the local network which provides access to SANE. For example, in the section Access list add network:

        192.168.1.0/24
    
  7. Install a graphical frontend for SANE at your computer. If your PC OS is Windows, it can be xSane, SaneTwain or SANEWinDS, and if Linux - xSane.
    If you are using xSane as frontend, then do not forget to edit sane\etc\sane.d\net.conf (for Windows) or /etc/sane.d/net.conf (for Linux), adding a router:

    # 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.1.1
    

Updated