RSS

Tag Archives: xinetd

TP-Link TL-WR1043ND – Openwrt – Ch08_Photo_scanner_server

0) Briefing

  • To setup a service that I can remotely control my scanner and scan image directly to my computer.
  • The printer / scanner I am using is HP Deskjet F2280 All-in-one
  • You should have already done:
  • What next
    • Install sane-backends ( 9052 Byte in total )
      • Dependency : libjpeg libtiff libusb librt libv4l sane-libs zlib
    • Install sane-frontends ( 180 Byte in size )
    • Install HP printer/scanner library – hplip ( 6836 Byte in total )
      • Dependency : libpng libstdcpp cups
      • If you are not using HP, install something else.
    • Install xinetd for SANE ( 152 Byte in size )

——————————————————————————–

1) Install SANE softwares

  • Open up your favorite terminal and login into the router
    ssh root@192.168.1.1
  • These commands will update database:
    opkg update
  • Install SANE, HP library and related files (16095 Byte in size), use other library if you are not using HP scanner:
    opkg install sane-backends sane-frontends hplip
  • Check if SANE can detect your scanner or not:
    scanimage -L
  • Should have similar result:

    device `hpaio:/usb/Deskjet_F2200_series?serial=CN88M4Q0Z40534′ is a Hewlett-Packard Deskjet_F2200_series all-in-one

——————————————————————————–

2) Setup SANE as a network enable service

  • This part involve quite some effort to get SANE network enable. Personally, I think SANE in OpenWRT is not very complete. But don’t worry, all you need to do is to create and edit some config files.

2.1) Get around the check_host error in SANE

  • This is the most important step to get around the check host problem of SANE. You must get this done first. Otherwise even you got all the below settings right, you will still unable to get SANE work over the network.
    The problem is SANE wants to know the router own host name but SANE could not find it.
  • Edit the following file:
    vim /etc/host
  • Add the following line:

    192.168.1.1 OpenWRT

    IP_address = your_router_IP
    host_name = any_name_of_your_choice

2.2) Allow who can use your scanner from your network

  • Edit the following file:
    vim /etc/sane.d/saned.conf
  • To allow only a subnet of computers to use your scanner, add the following line:

    192.168.1.0/24

  • To allow all computer, add the following line, just a “+” sign:

    +

  • Start SANE in debug mode, so we can do some test after setting up the client software
    saned -d 128

——————————————————————————–

3) Setup client side softwares

3.1) In Ubuntu:

  • Install the following software:
    sudo apt-get install sane-utils
  • If you also want graphical interface, install this as well:
    sudo apt-get install simple-scan
  • Edit the following file, to tell SANE where the network enabled scanner is:
    sudo vim /etc/sane.d/net.conf
  • Add the following line:

    192.168.1.1

  • We can test the connectivity from client to server now, from your computer:
    scanimage -L
  • On client side you should see this:

    device `net:192.168.3.1:hpaio:/usb/Deskjet_F2200_series?serial=CN88M4Q0Z40534′ is a Hewlett-Packard Deskjet_F2200_series all-in-one

  • On OpenWRT you should see similar result in saned debug output:

    [saned] check_host: access by remote host: 192.168.1.75
    [saned] init: access granted to mary@192.168.1.75
    [saned] bailing out, waiting for children…
    [saned] bail_out: all children exited

3.2) In Microsoft Windows

——————————————————————————–

4) Set SANE as a daemon

  • SANE is setup now, but it will not startup by itself on boot, since SANE cannot set as a daemon in OpenWRT. So it has to be resided with xinetd.

4.1) Install xinetd

  • Install xinetd (extended Internet daemon) (152 Byte in size):
    opkg install xinetd

4.2) Config xinetd for SANE

4.2.1) Listening port

  • Check if SANE listening port is listed in /etc/service:
    cat /etc/service | grep sane
  • You should see the follow line, if not, add it to /etc/service

    sane-port    6566/tcp    sane saned

4.2.2) Add SANE to xinetd

  • Create folder /etc/xinetd.d and edit /etc/xinetd.d/sane by:
    mkdir /etc/xinetd.d && vim /etc/xinetd.d/sane
  • Add the following lines:

    service sane-port
    {
    disable        = no
    socket_type    = stream
    wait           = no
    user           = root
    group          = root
    server         = /usr/sbin/saned
    port           = 6566
    protocol       = tcp
    }

4.3) Start xinetd and set as service:

  • Enable xinetd to startup itself at boot, and start the service now:
    /etc/init.d/xinetd enable
    /etc/init.d/xinetd start

——————————————————————————–

Appendix : References

 
4 Comments

Posted by on May 11, 2013 in Networking, Router

 

Tags: , , , , , , , , , , ,

 
%d bloggers like this: