Zprovozneni HP LaserJet P1005 pres USB

Zdravim, zkousel jsem postupovat podle navodu https://doc.turris.cz/doc/cs/howto/printer_sharing, povolil jsem ve sluzbach p910nd a dokonce ani po rebootu se mi nedari s tiskarnou spojit z OS X dle navodu, volba vyrobce a typu tiskarny nenasleduje ani pri protokolu HP Jet Direct - Socket. Pri generic to nic take nenajde. V dokumentaci bylo:

Zařízení, které má server spravovat ponechte na výchozí hodnotě (pokud tedy nepřipojujete tiskáren více). Jako Rozhraní zvolte lan, Port ponechte na výchozí hodnotě 9100.

Poradi mi nekdo jak konkretne se to da nastavit v LuCI nebo pres ssh? Dekuji moc.

local:~ savalo$ ssh root@192.168.1.1
root@192.168.1.1's password:


BusyBox v1.25.1 (2018-01-25 21:40:40 CET) built-in shell (ash)

  _______  _    _  _____   _____   _____   _____
 |__   __|| |  | ||  __ \ |  __ \ |_   _| / ____|
    | |   | |  | || |__) || |__) |  | |  | (___
    | |   | |  | ||  _  / |  _  /   | |   \___ \
    | |   | |__| || | \ \ | | \ \  _| |_  ____) |
    |_|    \____/ |_|  \_\|_|  \_\|_____||_____/



root@turris:~# netstat -an | grep 9100
tcp        2      0 192.168.1.1:9100        0.0.0.0:*               LISTEN
tcp    82040      0 192.168.1.1:9100        192.168.1.152:52457     ESTABLISHED
tcp        1      0 192.168.1.1:9100        192.168.1.152:52596     CLOSE_WAIT
tcp      226      0 192.168.1.1:9100        192.168.1.152:52597     CLOSE_WAIT
root@turris:~#

Otevíral jste port pro komunikaci ?

config 'rule’
option ‘src’ 'lan’
option ‘proto’ 'tcp’
option ‘dest_port’ '9100’
option ‘target’ ‘ACCEPT’

Dekuji za odpoved, neoteviral, poradite mi cestu k tomu konfigu, tedy jestli je to soubor :slight_smile:

Jedná se o cestu /etc/config/firewall

Je to popsáno i na oficiální Wikipedii openwrt
https://wiki.openwrt.org/doc/howto/p910nd.server

Dekuji, tak uz ji to naslo a po instalaci

opkg install kmod-usb-printer
opkg install kmod-lp
opkg install luci-app-p910nd

se i objevila volba p910nd - Printer server ve sluzbach.

root@turris:/dev/usb# dmesg | grep printer
[   16.593746] usblp 2-1:1.0: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x03F0 pid 0x3D17

root@turris:/dev/usb# ls -l /dev/usb/
crw-r--r--    1 root     root      180,   0 Mar 18 23:29 lp0

root@turris:/dev/usb# lsusb
Bus 002 Device 002: ID 03f0:3d17 Hewlett-Packard LaserJet P1005

bohuzel ale netiskne, do tiskarny se odesle img ktery dam tisknout, zmizi z fronty jako by to melo byt ok, ale dal se nic nedeje…

In this printer you must send firmware over usb every time when you power on printer.
This process can be automated using hotplug.
I used the similar HP LJ1020 printer so if I find scripts and firmware I will give you a solution.
Firmware files you can download from my old site http://tomato.cmza.pl/hplj_fw/ (in this folder i compile usb_printerid program for turris omnia)

You need to compile the usb_printerid program which will check if the firmware is already loaded into the printer and prevents unnecessary sending of firmware (each time the firmware is sent to the printer, the device is restarted)

Create script /etc/hotplug.d/usb/20-hpljP1005
You must edit FIRMWARE, DEVICE and PROD_ID to corespond with yours settings

#!/bin/sh

FIRMWARE=/usr/lib/sihpP1005.dl.gz
DEVICE=/dev/usb/lp0
PROD_ID=3f0/3d17/100

if [ "$ACTION" = "add" ] && [ "$PRODUCT" = "$PROD_ID" ]; then
        for i in $(seq 10); do
                if [ -c $DEVICE ]; then
                        if [ $(usb_printerid $DEVICE | grep -c FWVER) == 0 ]; then
                                zcat $FIRMWARE > $DEVICE
                                exit
                        fi
                else
                        sleep 3
                fi
        done
fi

If you run usb_printid /dev/usb/lp0 you can see similar log (printer hasn’t loaded firmware yet)

GET_DEVICE_ID string:
MFG:Hewlett-Packard;MDL:HP LaserJet 1020;CMD:ACL;CLS:PRINTER;DES:HP LaserJet 1020;

and after load firmware

GET_DEVICE_ID string:
MFG:Hewlett-Packard;MDL:HP LaserJet 1020;CMD:ACL;CLS:PRINTER;DES:HP LaserJet 1020;FWVER:20051028;

Source link for usb_printerid

Hi Krzysztof, after your hint it works!

I leave PROD_ID on same value like your example and log looks:

GET_DEVICE_ID string:
MFG:Hewlett-Packard;MDL:HP LaserJet P1005;CMD:HBS,PJL,ACL;CLS:PRINTER;DES:HP LaserJet P1005;FWVER:20090916;

Thanks a lot!

Sadly, the supplied binary refuses to work on Turris: ./usb_printerid: line 1: syntax error: unexpected “(”. Could someone please provide a compiled code that works? Preparing toolchain just to compile this single piece of code seems like unnecessary pain in a bum. Thanks in advance.

You used this binary on TO? It’s compiled for arm device. Mayby Turris team compile this as package for Turris OS

I just tried it in despair.

The compilation was not straight forward, but I managed to make it.
Steps to reproduce:

  1. Download SDK made by @Ondrej_Caletka: http://k5.sh.cvut.cz/~oskar/stah/OpenWrt-SDK-mpc85xx-for-pc-x86_64-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2 (may be obsolete, but compiler seems to work without issues)

  2. Set and export environment variables:
    Add [path]/staging_dir/toolchain-powerpc_8540_gcc-4.6-linaro_uClibc-0.9.33.2/bin to PATH
    Set STAGING_DIR to [path]/staging_dir/toolchain-powerpc_8540_gcc-4.6-linaro_uClibc-0.9.33.2

  3. Use the compiler with prefix powerpc-openwrt-linux-uclibcspe- (i.e.powerpc-openwrt-linux-uclibcspe-gcc)

The resulting binary: https://drive.google.com/file/d/1bzjjQf4gZeCpeEqkW7XORA3yAUdhTX0W/view?usp=sharing

I am also trying to make it work.

Here is firmware for this printer: http://foo2zjs.rkkda.com/firmware/sihp1005.tar.gz