On Windows, enter the printer properties and create a new tcp/ip port using custom settings: the port address must be the router ip address, the protocol must be RAW, the port 9100. Windows won't detect the port by itself, at least in my case
1 - Enter the web interface. Under Services/USB activate every USB option
With a normal printer and this DD-WRT version, this would be all that it's needed. But in the case of this GDI printer the effect is that print jobs are read from the router with no error, but the printer prints nothing. There is a small firmware file to be sent to the printer every time it's switched on and connected to the router, for this the firmware file must be kept on the router and a small script must send it every time the printer is recognized by the USB controller.
2 - Under Administration, activate JFFS2
3 - Enter the command line interface with telnet of SSH
4 - Enter cd /jffs to change directory to a persistent folder
5 - Enter wget http://oleg.wl500g.info/hplj/sihp1018.dl
The wget command downloads the 1018 firmware from a know location. With other similar printers one must of course change the URL: of course it's always possibile to download the file to a USB pen drive, mount it on the router and copy to /jffs (other locations in the filesystem are in ram and won't survive a power off
6 - Under commands enter this script
PRINTEROFF="<6>usblp0: removed" #time to watch for printer state WATCHTIME=5 FIRMWARE="/jffs/sihp1018.dl" LASTPRINTER=" " while true; do sleep $WATCHTIME LAST=`dmesg |grep "<6>usblp0" | tail -n -1` if [ "$LAST" != "$PRINTEROFF" ];then if [ "$LAST" != "$LASTPRINTER" ]; then LASTPRINTER=$LAST #echo flashing the printer cat $FIRMWARE > /dev/lp0 fi fi done 6>6>
and click on the SAVE STARTUP button. The script is added to the init chain. Note that hotplug script do not seem to work with printers on this DD-WRT version, so a polling cycle like the one above is needed. The script has been adapted from the DD-WRT forum: on my system the printer is on /dev/lp0 not /dev/usb/lp0. The PRINTEROFF and grep arguments are based on the output of the dmesg command. Your mileage may vary: check the dmesg output using dmesg at the command line, and filtering with grep. If the procedure is correct every time the printer is connected the firmware will be sent within 5 seconds. The printer orange led will light up, and the engine will start briefly, like when attaching the device directly to a windows PC via usb.
EDIT 14/2/2016: I still have the TL-WR1043ND and the HP 1018, I've upgrade to DD-WRT v24-sp2 (12/22/14) std - build 25697, and .. JFFS is gone, that is there is no more space in newer builds for a real JFFS partition. Furthermore, the dmesg output has changed, so the script above no longer works. Here's a partial solution. The script below must still be copied in Commands/Startup as before, and one won't wget the printer's firmware to /jffs because the mount point is now empty and not writable. What the script will do is parse correctly the dmesg output to check for the printer switching on and off and then trying to upload the firmware file from /tmp (which is in volatile ram disk). If it doesn't find it it tries to wget from the URL mentioned above, which still works.Of course it won't work without net access, it possibly won't work the first time/times the router is booted, it would probably better to use one's web server to wget the firmware et cetera. But in any case if the router will stay on for long periods of time it should be acceptable. One can always load sihp1018.dl in /tmp with scp or something like that of course.
#time to watch for printer state
WATCHTIME=5
FIRMWARE="/tmp/sihp1018.dl"
LASTPRINTER=" "
while true; do
sleep $WATCHTIME
LAST=`dmesg |grep "^<6>.*\(usblp0.*\)" | tail -n -1`
if [ "$LAST" != *"removed" ];then
if [ "$LAST" != "$LASTPRINTER" ]; then
LASTPRINTER=$LAST
#echo flashing the printer
if [ ! -f "$FIRMWARE" ]
then
cd /tmp
wget http://oleg.wl500g.info/hplj/sihp1018.dl
fi
cat $FIRMWARE > /dev/lp0
fi
fi
done 6>
Thanks for the tutorial a managed to get my hp1018 somewhat working (had to add usb storage because there is no jffs in my build and I couldnt find a build for this router that had it). My problem is that whenewer I print something the printer just keeps reprinting it over and over again until it runs out of pages or i turn it off. Then I ussualy have to reboot the router....
ReplyDeleteDo you have any idea what might be causing this or how do i make it work ?
Which build did you use ?
That's funny.. My printer started to show the same behaviour, inexplicably, a few weeks ago. I haven't had the time to look into it, at the moment, though..
ReplyDeletejust switch off: printer 2 way comunication
ReplyDelete