I'm a new user of OpenWRT. At the moment I have configured two TP-Links and I really like the flexibility of OpenWrt.
Now I'm configuring the MR3220 for using of the HP M1120n printer and scanner. I have build an image with necessary usb support, and moved overlay to microsd card. The version is 17.01.5. I installed p910nd and sane for printing and scanning. Scanning is working well, but for a couple of days I could not setup the printing. I have tried with and without firewall rules - just "error of printing" on windows machine.
Printer recognized
root@LEDE:~# dmesg | grep printer
[ 13.096031] usblp 1-1.1:1.1: usblp0: USB Bidirectional printer dev 3 if 1 alt 0 proto 2 vid 0x03F0 pid 0x5617
p910nd exists and enabled
root@LEDE:~# uci show p910nd
p910nd.prn1=p910nd
p910nd.prn1.device='/dev/usb/lp0'
p910nd.prn1.port='0'
p910nd.prn1.enabled='1'
p910nd.prn1.bidirectional='1'
p910nd.prn1.bind='192.168.0.2'
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
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
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.
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.
#!/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
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:
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 ...
After finishing the settings, I restarted the p910nd, having no effect, restarted the router ...
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 ...
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
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
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.