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:
- USB external storage (Visit Ch05 to see how). SANE scanner softwares are huge in size.
- 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 )
- Install sane-backends ( 9052 Byte in total )
——————————————————————————–
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
- Follow this link and download the software:
——————————————————————————–
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
- https://forum.openwrt.org/viewtopic.php?pid=67485#p67485
- http://janskala.blogspot.cz/2012/11/openwrt-sane.html
- http://habrahabr.ru/post/127739/
Mogyi - modzsi
January 13, 2015 at 8:24 pm
Hi I am trying to do the same install for my HP 3050 AIO printer/scanner and 1043ND. I dont have enough space on my router to install the packages:
Collected errors:
* verify_pkg_installable: Only have 788kb available on filesystem /overlay, pkg cups needs 881
* opkg_install_cmd: Cannot install package sane-backends.
* verify_pkg_installable: Only have 656kb available on filesystem /overlay, pkg cups needs 881
* opkg_install_cmd: Cannot install package hplip.
I did a reset before install, still no luck?
Which version of OpenWRT are you using? Also which version of 1043ND you got? 🙂
jirijanata
August 31, 2018 at 2:49 am
Thank you for a great guide. There are just few corrections (I got working SANE on OpenWrt 18.06.1).
– New name for sane-backends is sane-daemon – so command for install SANE on OpenWrt is opkg install sane-daemon sane-frontends (+ you need to specify package, which will fit your printer)
– You should add the hostname to hostS file. Not to the host. So after the correction vim /etc/hosts
– Same it’s with /etc/serviceS – cat /etc/services | grep sane
– There is also no need to create xinitd.d folder (on OpenWrt 18.06.1) – vim /etc/xinetd.d/sane is enough.