Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0Digg thisPin on Pinterest0Email this to someone

At home, I happen to use a Buffalo WZR-HP-AG300H??router (with an external Fiber modem) and a cheap HP Laserjet printer. The printer is a GDI (meaning it has no PCL or Postscript support, relying on Windows to draw text and graphics), USB only device. The router has a handy USB port: with DD-WRT installed (v24SP2) it is possibile to activate a handy network printer server function even with such a brain dead printer.

Here’s how – this works with this particular version of DD-WRT, with others it will most certainly need modifications. I couldn’t find the exact procedure online, so I am reporting it here, collected and amended from various sources.

With other similar printers, like the Laserjet Laserjet 1000 / 1005 / 1018 / 1020 / P1005 / P1006 / P1007 / P1008 / P1505?it’s probably only necessary to change the firmware file.

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

Here is a guide:?USB PRINTER WORKSTATION SETUP GUIDE

Next on the router:

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.?
?

Next:

2 – Under Administration, activate JFFS2

If your rounter does not support JFFS2 – follow the instructions below, thank you for the suggestion Thas Y

Some builds of dd-wrt do not have support for JFFS2 (like my TP-LINK). So I worked around this by putting the driver file in a small USB memory device. Then I modified your script to send the driver firmware directly from the USB memory device to the printer.
If the USB memory was mounted at /tmp/mnt/sda1/ the I replaced line 14 in your script as:
FIRMWARE=”/tmp/mnt/sda1/sihp1018.dl”

3 -?Under Services/Services, activate SSH

At this stage make sure you click >> Apply Settings << on the bottom

4 – Log in to the router command line interface with SSH
4 – Enter?

cd /jffs

to change directory to a persistent folder
5 – Enter?

wget http://oleg.wl500g.info/hplj/sihpP1007.dl

The wget command downloads the P1005 firmware from a know location.

With other similar printers one must of course change the URL – you can find the other firmwares here

http://oleg.wl500g.info/hplj/

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 – Back on the router – Under Administrator/ Commands enter this script

NB!! >> You need to change the?FIRMWARE location to fit your firmware

#Make sure that Printk is off on runtime - this removes the "Time Since Startup" lines from dmes
#Eg - <6>[  829.900000] usblp0: removed
#Should be <6>usblp0: removed
echo 0 > /sys/module/printk/parameters/time

#Set Default Printer off
PRINTEROFF="<6>usblp0: removed"

#time to watch for printer state
WATCHTIME=5

#Set Firmware location
#This needs to be changed to your location and firmware name
FIRMWARE="/jffs/sihpP1007.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

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.

I hope this helps.

Thanks to the?http://delendanet.blogspot.com/2012/11/gdi-usb-printer-on-dd-wrt-v24-sp2.html?blog – without it I would never have been able to do this – most of this is also copied from there!

 

 

If you enjoyed this post, why not leave a comment or consider a Donation as a token of your appreciation. If you need help implementing something you saw on this site or any other project why not Hire Me?
How to: GDI USB Printer on DD-WRT v24-SP2 (HP Laserjet 1000 / 1005 / 1018 / 1020 / P1005 / P1006 / P1007 / P1008 / P1505 on Buffalo WZR-HP-AG300H)
Tagged on:                                                                                                     

Leave a Reply

Your email address will not be published. Required fields are marked *

4 thoughts on “How to: GDI USB Printer on DD-WRT v24-SP2 (HP Laserjet 1000 / 1005 / 1018 / 1020 / P1005 / P1006 / P1007 / P1008 / P1505 on Buffalo WZR-HP-AG300H)

  • Thanks for the great information on this page. After a good bit of messing around (I am not a LINUX guy), I was able to make this work for my P1006 printer, and it is pretty sweet now. There are a couple of syntax errors that I found… wish that I had read the other comment that was left by Thas Y before proceeding. Anyways, here is my final (working) code:

    #from: http://kiteplans.info/2013/03/05/gdi-usb-printer-dd-wrt-v24-sp2-hp-laserjet-1000-1005-1018-1020-p1005-p1007-p1008-p1505-buffalo-wzr-hp-ag300h/
    #Make sure that Printk is off on runtime – this removes the “Time Since Startup” lines from dmes
    #Eg – [ 829.900000] usblp0: removed
    #Should be usblp0: removed
    echo 0 > /sys/module/printk/parameters/time

    #Set Default Printer off
    PRINTEROFF=”usblp0: removed”

    #time to watch for printer state
    WATCHTIME=5

    #Set Firmware location
    #This needs to be changed to your location and firmware name

    FIRMWARE=”/jffs/sihpP1006.dl”

    LASTPRINTER= ” ”

    while true;
    do
    sleep $WATCHTIME
    LAST=`dmesg |grep “usblp” | tail -n -1`
    if [ “$LAST” != “$PRINTEROFF” ]; then
    if [ “$LAST” != “$LASTPRINTER” ]; then
    LASTPRINTER=$LAST
    #echo flashing the printer
    cat $FIRMWARE > /dev/lp0
    fi
    fi
    done

  • Thank you for the great post. I have a TP-LINK WDR3600 and an HP1018 printer. I used your description above and it worked. THANK YOU!
    Few edits/notes:
    1. Line 21 has a typo: the variable should be $PRINTEROFF and not $PRINTEROF
    2. Some builds of dd-wrt do not have support for JFFS2 (like my TP-LINK). So I worked around this by putting the driver file in a small USB memory device. Then I modified your script to send the driver firmware directly from the USB memory device to the printer.
    If the USB memory was mounted at /tmp/mnt/sda1/ the I replaced line 14 in your script as:
    FIRMWARE=”/tmp/mnt/sda1/sihp1018.dl”

    And this worked! I tested this first by simply issuing the “cat” command in line 25 of your script. I replaced the $FIRMWARE variable with the complete path to the .dl file. When the printer light flashed amber and the printer behaved as if it was rebooting, I knew the firmware was working.
    Hope this helps others trying to do the same thing.

    1. Thanks for the reply – I added the changes – I will also add your suggestion on running it without JFFS2

Loading Facebook Comments ...