P910nd problem

The LAN OpenWrt IP is 192.168.0.2, as I understand, the printer IP is the same. PC is connected to the LAN. SaneTwain is configured to 192.168.0.2:6566 and works well.

By the way, if I remove p910nd.prn1.bind='192.168.0.2' the port listening is looking like
tcp 0 0 0.0.0.0:9100 0.0.0.0:* LISTEN 1706/p9100d
but still don't work

Now I have TP-Link wr842nd, Chaos Calmer 15.05 and Canon 2900 printer. But result is pretty the same :frowning: Where am I wrong???

I see 2 possible causes

  1. try bidirectional 0
  2. its possible your printer needs firmware after each power on. This is the case for my HP P1005, not sure about yours. I had to write manual scripts to satisfy the device

Thank you!

  1. already tried for both printers
  2. I know about the firmware uploading for printers like 1005, but I could not find the firmware for HP 1120 and for canon 2900. Thats why I think I do not need to do it.

Hi @bolvan,

I have the same printer (HP Laserjet P1005), a router Tp-Link TLWR 1043ND with Openwrt 19.07.1 and p910nd package...

I configured my router to use extraroot and I use a USB hub since that router has only one USB port.

Using the command "lsusb -v", I see that both the printer, the USB stick and the USB hub are detected correctly.

Using the command "dmesg", I notice that the kernel correctly detected the printer too ...

I created the script to load the firmware to the printer, but I can't test whether it was loaded correctly or not, however, if I enter the command that loads the firmware on the command line through ssh, I watch the printer start up correctly.

Honestly, I don't know where I might be going wrong, so I come here to ask that if possible, you can provide a step-by-step tutorial for setting up the HP Laserjet P1005 on Openwrt using the p910nd as a print server.

Thank you very much in advance!

/etc/hotplug.d/usb/20-hplj1020

#!/bin/sh

set -e

# change this to the location where you put the .dl file:
FIRMWARE="/lib/firmware/hp/sihpP1005.dl"

DEVICE=/dev/usb/lp0
LOGFILE=/var/log/hp

daemon_start() {
    echo "$(date) : Starting print daemon" >> $LOGFILE
    /etc/init.d/p910nd start
}
daemon_stop() {
    echo "$(date) : Stopping print daemon" >> $LOGFILE
    /etc/init.d/p910nd stop
}


if [ "$PRODUCT" = "3f0/3d17/100" ]; then
    case "$ACTION" in
        add)
            sleep 1
            if [ -c $DEVICE ]; then
                if [ "$DEVTYPE" = "usb_device" ]; then
                        echo "$(date) : Sending firmware to printer" >> $LOGFILE
                        cat $FIRMWARE > $DEVICE
                        echo "$(date) : done." >> $LOGFILE
                        daemon_start
                fi
            fi
            ;;
        remove)
            daemon_stop
            ;;
    esac
fi

/lib/firmware/hp/sihpP1005.dl - google for it

/etc/config/p910nd

config p910nd
        option device        /dev/usb/lp0
        option port          0
        option bidirectional 0
        option enabled       1

/dev/usb/lp0 shoud be present
first try cat /lib/firmware/hp/sihpP1005.dl > /dev/usb/lp0
printer flashes red light and rotates mechanics

then test unplugging and plugging, power off/on
check /var/log/hp

Thanks for your reply @bolvan...

I followed your tutorial step by step and got everything working correctly during the tests, but I still can't print and honestly, I don't know where I could be wrong ...

I have some doubts:

  1. Does the script "20-hplj1020" need to be executable? (chamod a + x)? In new installations, p910nd creates the folder "/etc/hotplug.d/usbmisc" where I put the script inside and it also didn't work ...

  2. After finishing the settings, I restarted the p910nd, having no effect, restarted the router ...

  3. The settings on my Windows station are like this: I believe that there is no secret here ...


    As you can see, I disabled "bidirectional" printing support in Windows dirver ...

  4. Finally, my "printserver", I configured with IP 192.168.1.2 and because this router is an "AP", I disabled the firewall. My main router has IP 192.168.1.1 and it has an active firewall, with the following rule:

config rule
        option name 'Allow PrintServer on 192.168.1.2'
        option src 'lan'
        option dest_port '9100'
        option target 'ACCEPT'
        list dest_ip '192.168.1.2'
        list proto 'tcp'
        list proto 'udp'

I really don't know where I'm going wrong. If you can help me within your means, I am grateful!

In windows print dialog select your HP printer, check "print to file". Save something.prn
Copy it to openwrt
After applying firmware do cat something.prn >/dev/usb/lp0
does it print ?

files in /etc/hotplug.d do not have to be executable

Ok, I created the .prn file and copied it to the router ... no problem!

I loaded the firmware manually with the command "cat /lib/firmware/hp/sihpP1005.dl> /dev/usb/lp0" where the red led flashed and the printer mechanism was activated ...

I tried to send the .prn file for printing using the command "cat hp.prn> /dev/usb/lp0" and nothing happens ...

Some information:

  • I'm trying to use a 1443ND for this function, configured as dumb AP...
  • I am using a USB Hub powered by a good 5Volts x 2.5Amp power supply...
  • Use extroot with a good USB Stick too ...
  • Openwrt 19.07.2, firewall disabled for testing ...

I'm starting to think it might be something on the router, too weird ...

prn blob is what normally being sent to the printer's port
print to file function saves it to a file instead of queuing to the spooler
printer should print it
If it does not and it works normally in windows then it could be bad firmware
md5sum of my firmware that works is
87169d2606a44e186a4ed5d142da0c89 sihpP1005.dl
if you own another file I can post mine

prn file for P1005 should start with XQX preamble. check it in hexdump or hexedit

 0000000000: 2C 58 51 58 00 00 00 01 │ 00 00 00 06 80 00 00 00  ,XQX   ☺   ♠Ђ
 0000000010: 00 00 00 04 00 00 00 48 │ 10 00 00 01 00 00 00 04     ♦   H►  ☺   ♦
 0000000020: 00 00 00 00 10 00 00 02 │ 00 00 00 04 00 00 00 00      ►  ☻   ♦

User preformatted text (</>) instead of blockquote to avoid the smileys.

Thanks again @bolvan

md5sum is exactly the same as yours, that is, it is not corrupted as I read in another post ...

root@hades:/# md5sum /lib/firmware/hp/sihpP1005.dl
ed18611a9c0c6c23b97d8c543fb2ec79  /lib/firmware/hp/sihpP1005.dl

my prn file:

0000000 5a49 4d46 cd9a a9dc 2000 0000 0000 0000
0000010 0000 0000 0000 0000 0000 0000 0000 0000
0000020 0000 0000 cd9a a9dc 8d04 0000 0000 0000
0000030 2000 0000 0100 0000 0000 0000 0000 0000
0000040 0100 0000 2800 0000 8d04 0000 0100 00d2
0000050 2000 01ae 5000 e100 6700 6900 6e00 6100
0000060 2000 6400 6500 2000 7400 6500 7300 7400
0000070 6500 0000 2400 02ae 4800 5000 2000 4c00
0000080 6100 7300 6500 7200 4a00 6500 7400 2000
0000090 5000 3100 3000 3000 3500 0000 1104 03aa
00000a0 4800 5000 2000 4c00 6100 7300 6500 7200
00000b0 4a00 6500 7400 2000 5000 3100 3000 3000
00000c0 3500 0000 0000 0000 0000 0000 0000 0000
00000d0 0000 0000 0000 0000 0000 0000 0000 0000
00000e0 0104 0300 dc00 3503 0f9f 0000 0100 0900
00000f0 9a0b 3408 0000 0100 0700 5802 0100 0100
0000100 5802 0000 0000 0000 0000 0000 0000 0000
0000110 0000 0000 0000 0000 0000 0000 0000 0000
*
But I can't tell you if it's right. I used the command "hexdump hp.prn" to get it.

"hexdump -C" is the right thing
from what you posted I can state

  1. firmware is different from mine.
    Here is my file : https://www.sendspace.com/file/tj16e6
  2. prn does not look correct.What windows printer driver do you use ?
    P1005 is xqx printer.

Here is start of my dump:

00000000  5a 49 4d 46 cd 9a a9 dc  20 00 00 00 00 00 00 00  |ZIMF.... .......|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000020  00 00 00 00 cd 9a a9 dc  8d 04 00 00 00 00 00 00  |................|
00000030  20 00 00 00 01 00 00 00  00 00 00 00 00 00 00 00  | ...............|
00000040  01 00 00 00 28 00 00 00  8d 04 00 00 01 00 00 d2  |....(...........|
00000050  20 00 01 ae 50 00 e1 00  67 00 69 00 6e 00 61 00  | ...P...g.i.n.a.|
00000060  20 00 64 00 65 00 20 00  74 00 65 00 73 00 74 00  | .d.e. .t.e.s.t.|
00000070  65 00 00 00 24 00 02 ae  48 00 50 00 20 00 4c 00  |e...$...H.P. .L.|
00000080  61 00 73 00 65 00 72 00  4a 00 65 00 74 00 20 00  |a.s.e.r.J.e.t. .|
00000090  50 00 31 00 30 00 30 00  35 00 00 00 11 04 03 aa  |P.1.0.0.5.......|
000000a0  48 00 50 00 20 00 4c 00  61 00 73 00 65 00 72 00  |H.P. .L.a.s.e.r.|
000000b0  4a 00 65 00 74 00 20 00  50 00 31 00 30 00 30 00  |J.e.t. .P.1.0.0.|
000000c0  35 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |5...............|
000000d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000000e0  01 04 03 00 dc 00 35 03  0f 9f 00 00 01 00 09 00  |......5.........|
000000f0  9a 0b 34 08 00 00 01 00  07 00 58 02 01 00 01 00  |..4.......X.....|
00000100  58 02 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |X...............|
00000110  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000170  00 00 00 00 00 00 00 00  00 00 00 00 53 44 44 4d  |............SDDM|
00000180  00 06 00 00 00 06 00 00  48 50 20 4c 61 73 65 72  |........HP Laser|
00000190  4a 65 74 20 50 31 30 30  35 00 00 00 00 00 00 00  |Jet P1005.......|
000001a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001b0  00 00 00 00 00 00 00 00  00 00 00 00 02 00 00 00  |................|
000001c0  00 00 00 00 00 00 00 00  01 00 00 00 09 00 00 00  |................|
000001d0  09 00 00 00 09 00 00 00  09 00 00 00 09 00 00 00  |................|

1 - Thanks for your file, I will test im my router...
2 - I didn't quite understand your question, but I'm using the driver with the versions below in Windows 10:

I use the same driver and it produces XQX output.
May be you used some advanced software like ms word with custom print dialog, not standard one, and selected custom "print to file function" ?
Try with notepad. It calls standard windows print dialog. Ensure correct printer is selected

Your file is in ZIMFprint format. Its different wire protocol

I retry the test using notepad and printing file...

Again, the ZIMF print format is present... :sleepy:
image

I honestly don't know how to change that ...

In printer preferences check Advanced->Print processor dialog

pp

Did not work... :cold_sweat:

Even changing the requested configuration, generating the file with the identification of XQX and restarting the router ... When sending an impression, nothing happens.

I can't set the print processor to "IMF" by default. I define it and it always returns to "RAW" ,,,

That's enough for today, I'm tired, but tomorrow I'll try again.

Thanks for the help @bolvan

Good morning everyone! The "saga" continues ...

I redid the configuration of my 1043ND router using version 18.06.8 for testing ...
I reinstalled the HP driver on my desktop and now I was able to correctly set the print processor to "XQX" ...

I remade the script exactly the same way and with the same name that @bolvan had posted, performed the test using the command "cat", the printer starts normally, but I still can't print.

In the desktop driver, I configure this for appoint to the ip 192.168.0.2 (router ip / printserver), config for RAW mode and port 9100 ... Do not print!

I restarted the router and nothing ... I believe that for some problem, the script does not start on the router or whatever else may be happening ... How to test to see that starts or no??

I followed the tutorial step-by-step, everything works, but it doesn't print.

I removed the USB hub and connect my print directly on the router... I remove extroot configs too.

Ah, I disabled the firewall on the print-server and the main router, as well as the Windows firewall too ...

Could someone give me the command of tcpdump to monitor the router if any request is coming from the Windows machine?

I haven't given up yet lol

If cat firmware; cat xqx doesnt work then it won't work at all
All what p910nd does is netcat-ting socket input to specified lp device
it receives prn file and pipes it to lp

does your printer work if connected to a PC ?

tcpdump -ni br-lan tcp port 9100
but you can also run wireshark in windows

note that scripts must be unix EOL (0A instead of OD0A)