For a long time I was tormented by the idea of an old RPI to make a print server (remote printing and scanning), and finally I got to this.
We presume that we have a set of RPI, flash drives with Raspbian, Wi-Fi adapter, HP LaserJet Pro 1102 printer, HP Deskjet F2180 MFP and usb hub. The main machine (BB) that will use the print server lives on Linux (however, the differences in use for Windows will be minimal).
In order not to connect to the RPI over the wire, we will add an automatic connection via wi-fi. To do this, insert the USB flash drive with Raspbian in the BB and go to / boot, where we will create 2 files:
network={ ssid="YOUR_SSID" psk="YOUR_PASSWORD" key_mgmt=WPA-PSK }
In the RPI we insert a USB flash drive, a wi-fi adapter (directly, and not in the hub - it is for printers), we connect the power. After a minute, we’ve made a wi-fi router to find out the address that he issued the RPI, and go to him via SSH.
Perform RPI configuration by running raspi-config .
If you are not satisfied with IP addressing, you can configure the host name to work through mDNS. We write the name in / etc / hostname and in / etc / hosts, for example, printserver.local, commit changes to sudo /etc/init.d/hostname.sh and go to reboot. After rebooting the RPI via mDNS will be available at printserver.local. For Linux, mDNS works by default, and for Windows, you must install Bonjour's print service .
Let's do it first
sudo apt-get update && sudo apt-get upgrade
Then install the CUPS
sudo apt-get install cups
To manage printers in CUPS, you need to add some user to the lpadmin group. We presume that we work under the default user - pi. Here we add it:
sudo usermod -a -G lpadmin pi
Since the print server is in the home network, we allow it to be accessible for everyone and then restarted:
sudo cupsctl --remote-any sudo /etc/init.d/cups restart
In principle, we have a ready-made CUPS, which is available at https: //printserver.local: 631 / and, probably, for many printers, it is suitable for this, but not in our case.
For this beast in the standard delivery there were no suitable drivers. I had to install a foomatic driver:
sudo apt-get install printer-driver-foo2zjs-common printer-driver-foo2zjs
and choose a different driver for this printer in the admin panel : HP LaserJet 1022 Foomatic / foo2zjs-z1
He began to print, but very slowly and sometimes stupidly skipping my commands.
I left the configuration with this driver, because it allows you to print from any device without installing drivers, albeit for a long time and mostly one page. For large volumes, I had to configure another configuration of the same printer in CUPS.
We will use xinetd to emulate an HP-jetdirect printer. First, install xinetd:
sudo apt-get install xinetd
Now we configure our service for xinetd:
service hp-jetdirect { socket_type = stream protocol = tcp wait = no user = pi # server = /usr/bin/lp server_args = -d HP_LaserJet_Professional_P1102_direct -o raw groups = yes disable = no }
HP_LaserJet_Professional_P1102_direct - what the profile of the jet-direct-printer in CUPS will be called.
Run:
/etc/rc.d/xinetd start
Now we go to the admin panel and create a new printer named HP_LaserJet_Professional_P1102_direct. The main thing to choose here is this driver: Local Raw Printer. As a result, our printer will have a network link https: //printserver.local: 631 / printers / HP_LaserJet_Professional_P1102_direct , which should be used when setting up printing on the BB.
Everything, now the main thing is to install the driver on the machine with which we print and voila - large volumes are printed at a normal speed.
Actually, this is not a scanner, but an MFP, but I use it only as a scanner.
We need sane to scan
sudo apt-get install sane
Then we will use the utility, which allows us to see what we have for the scanners.
sudo sane-find-scanner
In the case of the HP Deskjet F2180 scanner, you probably will not see.
We install drivers from hp:
sudo apt-get install hplip
Now repeat the search:
found USB scanner (vendor=0x0424, product=0xec00) at libusb:001:003
Great, now let's try to see if our scanner can accept commands
pi@PrintServer:~ $ sudo scanimage -L device `hpaio:/usb/Deskjet_F2100_series?serial=CN78R4R3PB04TK' is a Hewlett-Packard Deskjet_F2100_series all-in-one
that is, the RPI scanner works.
Next, on the remote linux, install sane and sane-utils and climb in /etc/sane.d/net.conf to add the RPI address at the bottom
Unfortunately, on a remote machine, sudo scanimage-L issued.
No scanners were identified. If you were expecting something different, check that the scanner is plugged in, turned on and detected by the sane-find-scanner tool (if appropriate). Please read the documentation which came with this software (README, FAQ, manpages).
Scanning ports RPI saw that port 6566 is closed. Well, let's configure xinetd a little more.
sudo nano /etc/xinetd.d/sane-port
We insert
service sane-port { socket_type = stream port = 6566 wait = no user = root group = root server = /usr/sbin/saned disable = no }
Exit, save and restart service:
sudo service xinetd restart
Repeat sudo scanimage -L on the remote machine and see
device `net:printserver.local:hpaio:/usb/Deskjet_F2100_series?serial=CN78R4R3PB04TK' is a Hewlett-Packard Deskjet_F2100_series all-in-one
What you need. You can start scanning by running xsane.
Thanks for attention.
upd praeivis xsane is under Windows
http://www.raspberry-pi-geek.com/Archive/2013/01/Converting-the-Raspberry-Pi-to-a-wireless-print-server
https://samhobbs.co.uk/2014/07/raspberry-pi-print-scanner-server
https://blog.johanv.org/posts/old/node-195.html
http://lib.ru/unixhelp/linuxset.txt
Source: https://habr.com/ru/post/328576/
All Articles