Принт и скан сервер

Повторенные мною конструкции
Ответить
TechMike
Site Admin
Сообщения: 213
Зарегистрирован: Вт окт 06, 2009 3:37 pm
Контактная информация:

Re: Принт и скан сервер

Сообщение TechMike »

Ставим ОС:
Раскатываем на SD-карту образ отсюда (Raspberry Pi OS Lite) https://downloads.raspberrypi.org/raspi ... f-lite.zip

Подключаем к ноуту SD-карту, на первом диске boot в коне создаем два файла:
ssh с любым содержимым
wpa_supplicant.conf содержащим параметры подключения:

Код: Выделить всё

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev          
update_config=1                           
country=RU                                                                             
network={                        
        ssid="4te-WIFI"                         
        psk="mywifipassword"                             
        key_mgmt=WPA-PSK                                         
} 
Отключаем SD-карты от ноута, вставялем в малинку и включаем. Ждем пока она подключиться к роутеру, заходим на нее по ssh и стандартному порту 22.
Логин и пароль по умолчанию в raspbian:
login: pi
password: raspberry

sudo systemctl start ssh
sudo systemctl enable ssh
sudo apt-get dist-upgrade
sudo raspi-config

в меню Advance устанавливаем размер памяти GPU как 8 мб
TechMike
Site Admin
Сообщения: 213
Зарегистрирован: Вт окт 06, 2009 3:37 pm
Контактная информация:

Re: Принт и скан сервер

Сообщение TechMike »

Ставим CUPS:
pi@raspberrypi:~ $

Код: Выделить всё

sudo apt-get install cups
Reading package lists... Done
Building dependency tree
Reading state information... Done
cups is already the newest version (2.2.10-6+deb10u4).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

sudo usermod -a -G lpadmin pi
sudo nano /etc/cups/cupsd.conf

добавляем в начало

Код: Выделить всё

Port 631
DefaultEncryption Never
DefaultAuthType None 
в секции ниже добавляем строку Allow from all

Код: Выделить всё

<Location />
  Order allow,deny
  Allow from all
</Location>
<Location /admin>
  Order allow,deny
  Allow from all
</Location>
<Location /admin/conf>
  AuthType Default
  Require user @SYSTEM
  Order deny,allow
  Allow from all
</Location>
sudo service cups restart

смотрим, что подключено из устройство:

Код: Выделить всё

sudo lpinfo -l -v
Device: uri = beh
class = network
info = Backend Error Handler
make-and-model = Unknown
device-id =
location =
Device: uri = cups-brf:/
class = file
info = CUPS-BRF
make-and-model = Virtual Braille BRF Printer
device-id = MFG:Generic;MDL:CUPS-BRF Printer;DES:Generic CUPS-BRF Printer;CLS:PRINTER;CMD:BRF;
location =
Device: uri = vnc:/
class = direct
info = VNC Remote Printer
make-and-model = VNC Printer
device-id =
location =
Device: uri = ipps
class = network
info = Internet Printing Protocol (ipps)
make-and-model = Unknown
device-id =
location =
Device: uri = ipp
class = network
info = Internet Printing Protocol (ipp)
make-and-model = Unknown
device-id =
location =
Device: uri = lpd
class = network
info = LPD/LPR Host or Printer
make-and-model = Unknown
device-id =
location =
Device: uri = http
class = network
info = Internet Printing Protocol (http)
make-and-model = Unknown
device-id =
location =
Device: uri = hp
class = direct
info = HP Printer (HPLIP)
make-and-model = Unknown
device-id =
location =
Device: uri = socket
class = network
info = AppSocket/HP JetDirect
make-and-model = Unknown
device-id =
location =
Device: uri = https
class = network
info = Internet Printing Protocol (https)
make-and-model = Unknown
device-id =
location =
Device: uri = hpfax
class = direct
info = HP Fax (HPLIP)
make-and-model = Unknown
device-id =
location =

смотрим ошибки в cups:

Код: Выделить всё

sudo journalctl -u cups -e
~
~
~
-- Logs begin at Thu 2021-06-17 18:17:01 BST, end at Thu 2021-06-17 19:06:05 BST. --
Jun 17 18:45:16 raspberrypi systemd[1]: Started CUPS Scheduler.
Jun 17 18:47:55 raspberrypi /hpfax[985]: [985]: error: Failed to create /var/spool/cups/tmp/.hplip
Jun 17 18:54:11 raspberrypi hpcups[1425]: common/utils.c 112: unable to open /var/lib/hp/hplip.state: No such file or directory
Jun 17 18:54:11 raspberrypi hpcups[1425]: common/utils.c 162: validate_plugin_version() Failed to get Plugin version from [/var/lib/hp/hplip.state]
Jun 17 18:54:11 raspberrypi hpcups[1425]: common/utils.c 206: Plugin version is not matching
Jun 17 18:54:11 raspberrypi hpcups[1425]: prnt/hpcups/HPCupsFilter.cpp 489: m_Job initialization failed with error = 48
Jun 17 18:54:11 raspberrypi hpcups[1425]: common/utils.c 277: Invalid Library hanlder pLibHandler = NULL.
Jun 17 19:00:22 raspberrypi hpcups[1854]: common/utils.c 112: unable to open /var/lib/hp/hplip.state: No such file or directory
Jun 17 19:00:22 raspberrypi hpcups[1854]: common/utils.c 162: validate_plugin_version() Failed to get Plugin version from [/var/lib/hp/hplip.state]
Jun 17 19:00:22 raspberrypi hpcups[1854]: common/utils.c 206: Plugin version is not matching
Jun 17 19:00:22 raspberrypi hpcups[1854]: prnt/hpcups/HPCupsFilter.cpp 489: m_Job initialization failed with error = 48
Jun 17 19:00:22 raspberrypi hpcups[1854]: common/utils.c 277: Invalid Library hanlder pLibHandler = NULL.

sudo apt update && sudo apt upgrade

Запускаем обновление библиотек от hp (принтер то hp), без этого не найдется принтер в админке cups:

Код: Выделить всё

sudo hp-setup -u -i
HP Linux Imaging and Printing System (ver. 3.18.12)
Printer/Fax Setup Utility ver. 9.0

Copyright (c) 2001-15 HP Development Company, LP
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to distribute it
under certain conditions. See COPYING file for more details.

(Note: Defaults for each question are maked with a '*'. Press <enter> to accept the default.)


--------------------------------
| SELECT CONNECTION (I/O) TYPE |
--------------------------------

Num Connection Description
Type
-------- ---------- ----------------------------------------------------------
0* usb Universal Serial Bus (USB)
1 net Network/Ethernet/Wireless (direct connection or JetDirect)

Enter number 0...1 for connection type (q=quit, enter=usb*) ?

Using connection type: usb

Setting up device: hp:/usb/HP_LaserJet_M1005?serial=KJ11DZB



------------------------
| PLUG-IN INSTALLATION |
------------------------


HP Linux Imaging and Printing System (ver. 3.18.12)
Plugin Download and Install Utility ver. 2.1

Copyright (c) 2001-15 HP Development Company, LP
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to distribute it
under certain conditions. See COPYING file for more details.

warning: It is not recommended to run 'hp-plugin' in a root mode.

HP Linux Imaging and Printing System (ver. 3.18.12)
Plugin Download and Install Utility ver. 2.1

Copyright (c) 2001-15 HP Development Company, LP
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to distribute it
under certain conditions. See COPYING file for more details.

(Note: Defaults for each question are maked with a '*'. Press <enter> to accept the default.)


------------------------------------------
| PLUG-IN INSTALLATION FOR HPLIP 3.18.12 |
------------------------------------------

Option Description
---------- --------------------------------------------------
d Download plug-in from HP (recommended)
p Specify a path to the plug-in (advanced)
q Quit hp-plugin (skip installation)

Enter option (d=download*, p=specify path, q=quit) ? d

-------------------
| DOWNLOAD PLUGIN |
-------------------

Checking for network connection... Downloading plug-in from:
Downloading plug-in: [\ ] 0% Receiving digital keys: /usr/bin/gpg --homedir /root/.hplip/.gnupg --no-permission-warning --keyserver pgp.mit.edu --recv-keys 0x4ABA2F66DBD5A95894910E0673D770CDA59047B9

----------------------
| INSTALLING PLUG-IN |
----------------------

Creating directory plugin_tmp
Verifying archive integrity... All good.
Uncompressing HPLIP 3.18.12 Plugin Self Extracting Archive.........................................................

HP Linux Imaging and Printing System (ver. 3.18.12)
Plugin Installer ver. 3.0

Copyright (c) 2001-15 HP Development Company, LP
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to distribute it
under certain conditions. See COPYING file for more details.

Plug-in version: 3.18.12
Installed HPLIP version: 3.18.12
Number of files to install: 55

You must agree to the license terms before installing the plug-in:

LICENSE TERMS FOR HP Linux Imaging and Printing (HPLIP) Driver Plug-in


These License Terms govern your Use of the HPLIP Driver Plug-in Software (the "Software"). USE OF THE SOFTWARE INCLUDING, WITHOUT LIMITATION, ANY DOCUMENTATION, IS SUBJECT TO THESE LICENSE TERMS AND THE APPLICABLE AS-IS WARRANTY
STATEMENT. BY DOWNLOADING AND INSTALLING THE SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THESE TERMS. IF YOU DO NOT AGREE TO ALL OF THESE TERMS, DO NOT DOWNLOAD AND INSTALL THE SOFTWARE ON YOUR SYSTEM.


1. License Grant. HP grants you a license to Use one copy of the Software with HP printing products only. "Use" includes using, storing, loading, installing, executing, and displaying the Software. You may not modify the Software or
disable any licensing or control features of the Software.


2. Ownership. The Software is owned and copyrighted by HP or its third party suppliers. Your license confers no title to, or ownership in, the Software and is not a sale of any rights in the Software. HP's third party suppliers may
protect their rights in the Software in the event of any violation of these license terms.


3. Copies and Adaptations. You may only make copies or adaptations of the Software for archival purposes or when copying or adaptation is an essential step in the authorized Use of the Software. You must reproduce all copyright notices
in the original Software on all copies or adaptations. You may not copy the Software onto any public network.


4. No Disassembly. You may not Disassemble the Software unless HP's prior written consent is obtained. "Disassemble" includes disassembling, decompiling, decrypting, and reverse engineering. In some jurisdictions, HP's consent may not be
required for limited Disassembly. Upon request, you will provide HP with reasonably detailed information regarding any Disassembly.


5. No Transfer. You may not assign, sublicense or otherwise transfer all or any part of these License Terms or the Software.


6. Termination. HP may terminate your license, upon notice, for failure to comply with any of these License Terms. Upon termination, you must immediately destroy the Software, together with all copies, adaptations and merged portions in
any form.


7. Export Requirements. You may not export or re-export the Software or any copy or adaptation in violation of any applicable laws or regulations.


8. U.S. Government Restricted Rights. The Software has been developed entirely at private expense. It is delivered and licensed, as defined in any applicable DFARS, FARS, or other equivalent federal agency regulation or contract clause,
as either "commercial computer software" or "restricted computer software", whichever is applicable. You have only those rights provided for such Software by the applicable clause or regulation or by these License Terms.


9. DISCLAIMER OF WARRANTIES. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, HP AND ITS SUPPLIERS PROVIDE THE SOFTWARE "AS IS" AND WITH ALL FAULTS, AND HEREBY DISCLAIM ALL OTHER WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED, OR
STATUTORY, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE AND NON-INFRINGEMENT, ANY IMPLIED WARRANTIES, DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE, AND OF LACK OF VIRUSES ALL WITH REGARD TO THE
SOFTWARE. Some states/jurisdictions do not allow exclusion of implied warranties or limitations on the duration of implied warranties, so the above disclaimer may not apply to you in its entirety.


10. LIMITATION OF LIABILITY. Notwithstanding any damages that you might incur, the entire liability of HP and any of its suppliers under any provision of this agreement and your exclusive remedy for all of the foregoing shall be limited
to the greater of the amount actually paid by you separately for the Software or U.S. $5.00. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL HP OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, BUT NOT LIMITED TO, DAMAGES FOR LOSS OF PROFITS OR CONFIDENTIAL OR OTHER INFORMATION, FOR BUSINESS INTERRUPTION, FOR PERSONAL INJURY, FOR LOSS OF PRIVACY ARISING OUT OF OR IN ANY
WAY RELATED TO THE USE OF OR INABILITY TO USE THE SOFTWARE, OR OTHERWISE IN CONNECTION WITH ANY PROVISION OF THIS AGREEMENT, EVEN IF HP OR ANY SUPPLIER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND EVEN IF THE REMEDY FAILS OF
ITS ESSENTIAL PURPOSE. Some states/jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so the above limitation or exclusion may not apply to you.

Do you accept the license terms for the plug-in (y=yes*, n=no, q=quit) ? y
Done.
Done.

---------------------
| PRINT QUEUE SETUP |
---------------------

warning: One or more print queues already exist for this device: HP_LaserJet_M1005_USB_KJ11DZB_HPLIP.

Would you like to install another print queue for this device (y=yes, n=no*, q=quit) ? y

Please enter a name for this print queue (m=use model name:'HP_LaserJet_M1005'*, q=quit) ?m
Using queue name: HP_LaserJet_M1005
Locating PPD file... Please wait.

Found PPD file: drv:///hpcups.drv/hp-laserjet_m1005.ppd
Description:

Note: The model number may vary slightly from the actual model number on the device.

Does this PPD file appear to be the correct one (y=yes*, n=no, q=quit) ? y
Enter a location description for this printer (q=quit) ?hp 1005
Enter additonal information or notes for this printer (q=quit) ?

Adding print queue to CUPS:
Device URI: hp:/usb/HP_LaserJet_M1005?serial=KJ11DZB
Queue name: HP_LaserJet_M1005
PPD file: drv:///hpcups.drv/hp-laserjet_m1005.ppd
Location: hp 1005
Information:


---------------------
| PRINTER TEST PAGE |
---------------------


Would you like to print a test page (y=yes*, n=no, q=quit) ? y
warning: hp-testpage should not be run as root/superuser.

HP Linux Imaging and Printing System (ver. 3.18.12)
Testpage Print Utility ver. 6.0

Copyright (c) 2001-15 HP Development Company, LP
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to distribute it
under certain conditions. See COPYING file for more details.

Printing test page to printer HP_LaserJet_M1005...
request id is HP_LaserJet_M1005-4 (1 file(s))
Test page has been sent to printer.

note: If an error occured, or the test page failed to print, refer to the HPLIP website
note: at: http://hplip.sourceforge.net for troubleshooting and support.


Done.

Done.
pi@raspberrypi:~ $
TechMike
Site Admin
Сообщения: 213
Зарегистрирован: Вт окт 06, 2009 3:37 pm
Контактная информация:

Re: Принт и скан сервер

Сообщение TechMike »

Настраиваем принтер в CUPS:
подключаемся в браузере к админке
http://192.168.1.248:631
в меню Администрирование жмем Найти новый принтер, в списке выбираем наш принтер, выбираем поизводителя и потом модель. Делаем доступным принтер всем и по умолчанию.
Ищем на ноуте (W10) новый принтер в сети, он находится и успешно ставиться, печатает тестовую страницу. Контролируем в Админке cups что задание на печать успешно выполняется.
Если в задании будет статус "Filter failed", то нужно переустановить либы от HP командой

Код: Выделить всё

sudo hp-setup -u -i
TechMike
Site Admin
Сообщения: 213
Зарегистрирован: Вт окт 06, 2009 3:37 pm
Контактная информация:

Re: Принт и скан сервер

Сообщение TechMike »

Настраиваем sane & xinetd:
apt-get install sane sane-utils xinetd

sudo usermod -a -G lp saned
sudo modprobe sg

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".

could not fetch string descriptor: Pipe error
could not fetch string descriptor: Pipe error
found USB scanner (vendor=0x03f0, product=0x3b17) at libusb:001:002
could not open USB device 0x1d6b/0x0002 at 001:001: Access denied (insufficient permissions)
  # 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.

  # You may want to run this program as root to find all devices. Once you
  # found the scanner devices, be sure to adjust access permissions as
  # necessary.
scanimage -L

Код: Выделить всё

device `hpljm1005:libusb:001:002' is a Hewlett-Packard LaserJet M1005 multi-function peripheral
device `hpaio:/usb/HP_LaserJet_M1005?serial=KJ11DZB' is a Hewlett-Packard HP_LaserJet_M1005 all-in-one

sudo nano /etc/systemd/system/saned@.service

Код: Выделить всё

[Unit]                  
Description=Scanner Service
Requires=saned.socket

[Service]
ExecStart=/usr/sbin/saned
User=saned
Group=saned
StandardInput=null
StandardOutput=syslog
StandardError=syslog
sudo nano /etc/systemd/system/saned.socket

[Unit]
Description=saned incoming socket

Код: Выделить всё

[Socket]
ListenStream=6566
Accept=yes
MaxConnections=64

[Install]
WantedBy=sockets.target
sudo nano /etc/default/saned sudo nano /etc/sane.d/saned.conf

Код: Выделить всё

192.168.1.0/24
systemctl enable saned.socket

Видим в логах ошибки вида

Код: Выделить всё

saned.socket: Too many incoming connections (1), dropping connection.
Делаем так:
sudo nano /etc/systemd/system/saned.socket

меняем 1 в MaxConnections на 64
потом делаем
systemctl daemon-reload

Если видим ошибки вида

Код: Выделить всё

saned[6487]: io/hpmud/musb.c 515: invalid claim_interface ff/ff/ff: Device or resource busy
то просто рестартуем малинку
TechMike
Site Admin
Сообщения: 213
Зарегистрирован: Вт окт 06, 2009 3:37 pm
Контактная информация:

Re: Принт и скан сервер

Сообщение TechMike »

Принтер спокойно теперь находится в домашней сети как сетевой принтер из W10:
printer.jpg
printer.jpg (47.74 КБ) 3747 просмотров
Клиенты под W10:
sanetwain.ozuzo.net
https://sourceforge.net/projects/sanewinds/

Удобнее SANEWin, но он аскетичный по предпросмотру, зато быстро все работает.
SaneWin_1.jpg
SaneWin_1.jpg (28.87 КБ) 3747 просмотров
SaneWin_2.jpg
SaneWin_2.jpg (33.72 КБ) 3747 просмотров
SaneWin_3.jpg
SaneWin_3.jpg (21.4 КБ) 3747 просмотров
SaneWin_4.jpg
SaneWin_4.jpg (17.81 КБ) 3747 просмотров
Ответить