(Guide) Converting MFD to Network Scanner (Raspberry Pi)


arunmcops

Member
Disciple
In my earlier guide, I talked about converting USB printer/MFD to network printer via Raspberry Pi here. As promised, in this part I will tell how to setup the same MFD as Network Scanner using Pi.
The guide is as following:

Server Configuration:​

To get started, log back in to the Pi with SSH or directly and install SANE and find your scanner:
Code:
sudo apt-get update
sudo apt-get install sane
sudo sane-find-scanner

You should get some output like this:
Code:
pi@print-server ~ $ sudo sane-find-scanner

  # sane-find-scanner will now attempt to detect your scanner. If the
  # result is different from what you expected, first make sure your
  # scanner is powered up and properly connected to your computer.

  # No SCSI scanners found. If you expected something different, make sure that
  # you have loaded a kernel SCSI driver for your SCSI adapter.
  # Also you need support for SCSI Generic (sg) in your operating system.
  # If using Linux, try "modprobe sg".

found USB scanner (vendor=0x03f0 [HP], product=0xa011 [Deskjet 3050A J611 series]) at libusb:001:005
found USB scanner (vendor=0x0bda [Manufacturer Realtek ], product=0x8172 [RTL8191S WLAN Adapter ]) at libusb:001:004
found USB scanner (vendor=0x0424, product=0xec00) at libusb:001:003
  # Your USB scanner was (probably) detected. It may or may not be supported by
  # SANE. Try scanimage -L and read the backend's manpage.

  # Not checking for parallel port scanners.

  # Most Scanners connected to the parallel port or other proprietary ports
  # can't be detected by this program.

If the program returns information about your make and model like above, you're good to go.


Next, try the following:
Code:
sudo scanimage -L

You should get output like this:
Code:
device `hpaio:/usb/HP_Inktank_310_series?serial=CN1C3438F005PJ' is a Hewlett-Packard Inktank_310_series all-in-one

Finally, try scanning something. Put something inside the scanner enter this command:
Code:
scanimage > ~/test-scan-file.pnm

Now we know that the scanner is working locally, we can set up the sane daemon. Open the configuration file /etc/default/saned and set this option to turn the sane daemon/server on:
Code:
RUN=yes
Next, open the file /etc/sane.d/saned.conf and add this line, which tells the server to accept connections from all IP addresses in the range 192.168.1.1 to 192.168.1.255 (or 192.168.0.1 to 192.168.0.255 depending upon your ip):
Code:
192.168.1.0/24
Also uncomment this line:
Code:
data_portrange = 10000 - 10100
We also need to fix the permissions so that the sane daemon can access the scanner without root. Part of the output from sane-find-scanner was the following line:
Code:
found USB scanner (vendor=0x03f0 [HP], product=0xa011 [Inktank 310 series]) at libusb:001:005
The section "at libusb:001:005" at the end tells us that the scanner is located at /dev/bus/usb/001/005. Let's check who owns that file:
Code:
pi@print-server ~ $ ls -l /dev/bus/usb/001
total 0
crw-rw-r-T 1 root root 189, 0 Jul  6 19:44 001
crw-rw-r-T 1 root root 189, 1 Jan  1  1970 002
crw-rw-r-T 1 root root 189, 2 Jan  1  1970 003
crw-rw-r-T 1 root root 189, 3 Jul  6 19:44 004
crw-rw-r-T 1 root lp   189, 4 Jul  6 19:49 005
As you can see, it is owned by root with the group lp (linux printing). We need to add the sane daemon to the lp group to give it the necessary permissions:
Code:
sudo adduser saned lp
Now restart the SANE daemon to make all of the changes take effect.
Code:
sudo systemctl start saned.socket
And tell the SANE service to start automatically when the Pi starts.
Code:
sudo systemctl enable saned.socket
Now check SANE is running properly:
Code:
sudo service saned status
You can also check that the port is available externally by using nmap to port scan the Pi from your laptop:
Code:
nmap print-server

(again, assuming print-server is the hostname of your pi - alternatively, use the IP addresss).You shoudl get results like this:
Code:
Nmap scan report for print-server (192.168.1.151)
Host is up (0.019s latency).
rDNS record for 192.168.1.151: print-server.lan
Not shown: 997 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
631/tcp  open  ipp
6566/tcp open  sane-port
All good: the Pi has services bound to port 22 for SSH, 631 for printing/CUPS and 6566 for scanning/SANE.

You can use any scanning application depending on your OS, whether Windows, Linux or Android.
You can use any scanning apps from here...
 
Last edited:

Top