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.?
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:
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?
to change directory to a persistent folder
5 – Enter?
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
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!