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@
root@'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*               LISTEN
tcp    82040      0     ESTABLISHED
tcp        1      0     CLOSE_WAIT
tcp      226      0     CLOSE_WAIT

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

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



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
                        sleep 3

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

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

and after load firmware

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

Source link for usb_printerid

1 Like

Hi Krzysztof, after your hint it works!

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

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- (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- to PATH
    Set STAGING_DIR to [path]/staging_dir/toolchain-powerpc_8540_gcc-4.6-linaro_uClibc-

  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

I also needed to have this printer working, unfortunately original link is not working and the link @AreYouLoco provided is in different format AFAIK. However I have this printer working using this file: https://github.com/mtchang/rt-n56u.files/blob/master/hplj/sihpP1005.dl

The only problem with this file is not gzipped as original guide expects, to use this file in hotplug.d file you need to change zcat to cat.

I hope this can help someone.

Thanks. Did you diff the files? I will check if it works for me when I have some free time.

From my understanding the file you provided is tar.gz compressed .img file.
However in this guide we expecting .dl.gz file - which is gzipped (and then unzipped using zcat). So I found non gzipped .dl file, updated the script and it worked.

Using your tar.gz file it was not working, I tried to extract to tar.gz file to get more details about it and I found .img file. I think it’s the different format, but I’m not sure. For example here you can find gist which contains some conversion command from .img to .dl https://gist.github.com/sebastianwagner/8548683

For sure its not the correct cross-compiler. Omnia architecture for example is arm not powerpc. I tested (just to be sure) your binary and it doesnt work. Its compiled for other proccessor type.

Should be armv8 or some other naming convention like mvebu.

Ok so I did crosscompile statically usb_printerid for Omnia. Here it is:
Put it in /bin/usb_printerid and make executable (chmod +x) and set permissions as other files there.

Also I extracted latest firmware I could find (FWVER:20100824) from HP website
// (from here to be precise:
// https://ftp.hp.com/pub/softlib/software12/COL21058/bi-55362-7/ljP1000_P1500-HB-pnp-win64-en.exe
for Windows and converted it using arm2hpdl as @JaKoB suggested to .dl format so it’s including HP download header. Result is here:

And it seems to work fine now to load firmware with hotplug.d script and all.

Did someone managed to advertise it on network so for example android phone, windows machine and linux box can find it without problems when connected to the network?

@AreYouLoco I forgot to mention I’m using old Turris 1.1, so I just used usb_printerid binary provided above.

And yes, after having a successful connection with loaded firmware I’m using p910nd print server provided for old Turris 1.1. Unfortunately I don’t know if this is suitable for Omnia, however you should be able to use any print server and just point it /dev/lp0 or similar device virtual file.

I reinstalled my router and try to apply the same process but compiled binary of usb_printerid provided by @petrpulc is no longer working. Can someone compile latest version of give me some instructions what to do?

Current version of binary is printing this problem with linked library

$ldd /tmp/usb_printid
/lib/ld-uClibc.so.0 (0xb7f0d000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7edc000)
libc.so.0 => /lib/ld-uClibc.so.0 (0xb7f0d000)
Error relocating /tmp/usb_printid: __uClibc_main: symbol not found
Error relocating /tmp/usb_printid: __uClibc_main: symbol not found

Or should I just install some packages? Thank you.

TurrisOS 5.1.4, Turris 1.x