Friday, October 09, 2009

Network printing for host-based printer HP LaserJet 1000/1005/1018/1020 by Oleg's firmware

What do you need?
  • A wireless router like D-Link DIR-320, which has at least one USB port, with Oleg's firmware inside. 
  • An USB printer. In my case I have HP LaserJet 1018, change it to your printer model.
  • An USB hub if you want to connect more device (USB flask stick, scanner, etc) to the router.

Fig. 1. HP LaserJet 1018 connected to wireless router D-Link DIR-320 through an 4-port USB hub

Why is Oleg's firmware?

Because original router firmware doesn't work with host-based printer like HP Laserjet 1018, thus it's needed to load some printer firmware to this kind of printer to make it operates properly. And beside that, you don't have much things to do with the manufactor's firmware. Oleg's firmware gives you more freedom of operations. If you have a D-Link DIR-320, you can see how to reflashing your router in my other post. The owner of other router can check Oleg's firmware website and forum.

1. Server settings

The main idea here is putting printer firmware in some place, where the router can find and load it to printer when the last one is connected. You need to download/create some files as below:

1.1. sihp1018.dl

This is the printer firmware. We need to load this file to printer. After login to the router by ssh, you can get this firmware from Oleg's firmware website as below:

$ wget -O /tmp/sihp1018.dl

All the files in /tmp will be deleted every time the router rebooted. Remember to download printer firmware again if you don't have external storage media. In case you have an USB hub and an USB flash stick mounted under /opt, you can have second copy of firmware on the USB stick:

$ mount /dev/discs/disc0/part1 /opt
$ cp sihp1018.dl /opt

1.2. /usr/local/sbin/usb_printerid

wget -O /usr/local/sbin/usb_printerid

1.3. /usr/local/sbin/

This file is a hotplug script, which will load printer firmware automatically every on/off cycle.

# Logging
echo --------------- >> $LOG
date >> $LOG
echo $* >> $LOG
set >> $LOG
if [ "$ACTION" = "add" ] || [ "$1" = "usb" ] || [ "$DEVFS" = "/proc/bus/usb" ]; then
sleep 5
$PRN_BIN /dev/usb/lp0 | grep -q FWVER || cat $PRN_FRM1 > /dev/usb/lp0;
$PRN_BIN /dev/usb/lp0 | grep -q FWVER || cat $PRN_FRM2 > /dev/usb/lp0
echo "Printer OnLine" >> $LOG
echo "Printer OffLine" >> $LOG

1.4 /usr/local/sbin/post-boot

Commands in this file will be executed after router's booting. Here I use it to mount USB flash stick, load firmware to printer if it is on and connected and the firmware is not presented on printer. At last, the hotplug script about is load to kernel's hotplug.

# Mount USB flash disk
if [ -w /dev/discs/disc0/part1 ]; then
mount /dev/discs/disc0/part1 /usr/local/flashdisk
# Load firmware to printer if the printer is connected and
# firmware is not loaded (grep -q FWVER)
if [ -w /dev/usb/lp0 ]; then
  /usr/local/sbin/usb_printerid /dev/usb/lp0 | grep -q FWVER || cat /tmp/sihp1018.dl > /dev/usb/lp0;
  /usr/local/sbin/usb_printerid /dev/usb/lp0 | grep -q FWVER || cat /opt/sihp1018.dl > /dev/usb/lp0
# Hotplug script
echo "/usr/local/sbin/" >> /proc/sys/kernel/hotplug

After downloading/creating files, we need to make some of them executable and then save the flashfs:

$ chmod +x /usr/local/sbin/*
$ flashfs save
$ flashfs commit
$ flashfs enable
$ reboot

That's all from server side. Now you can connect printer to router, turn it on and configure the client side, after what — print.

2. Client side

2. 1. Linux client

Ubuntu for example. Install and run cupsd:

$ sudo apt-get install cups

Then add printer through GNOME interface (wizard). Not very hard to do. And don't forget to add users to lp group!

Fig. 2. Network printer properties

2. 2. Windows(R) client

I won't show you. I hate Windows users ;).
Read here instead:


1. When try:

$ flashfs save && flashfs commit && flashfs enable && reboot

and get

[admin@(none) local]$ flashfs commit
/tmp/flash.tar.gz: File is to big (73504, max 65536)

mean your flash file is not fit on flash ROM. Maybe you download printer firmware to some where in /usr/local. Need to check it:

$ ls -lR /usr/local
lrwxrwxrwx 1 admin root 12 Aug 22 11:35 /usr/local -> ../tmp/local
$ ls -lR /tmp/local

2. If you have connected, for example, 4-port USB hub to the router, then you have more posibilities other than network printing:
  • network storage device,
  • network camera,
  • network scanning, etc.

See for more compatible hardware with Oleg's firmware.

3. Do not use 3-m USB-cable and over, can cause problem with USB 2.0.


alina said...

Barrister Global Services Network, one of premier provider of IT solutions, printer repair , Printer Service, managed print services, Barrister Global Services. Printing services as printer repair and Managed Print Services are among the best services provided by barrister.

Jessica said...

Barrister Global Services Network Complaints

magi said...

I just put this on my site. I hope it works for technologically challenged old farts! Network Printer Setup

network printer said...

You can setup your printer on a computer and then share it with all the other computers on your home network. But note that you have to have both the computer and the printer on for other computers to see the printer. Here's how to add a network printer.

Sweet Fairy said...

Great post. Is this printer be used for printing plastic business cards?

Phan Vinh Thinh said...

@Sweet Fairy: No, this printer can not be used for printing those name cards.

kurru said...

I have Kubuntu 12.10 on my computer.
Installed HP 1020 printer to WL500gP v2 - Oleg FW, which is working fine with Win XP, but can not setup my Linux computer to print.

When connecting directly to the compute via USB, it works on Kubuntu also.

Please, advise. Thanks!

kurru said...

Photocopier Machine London said...

12 years experience in photocopier industry & networking, Copy Ltd have been repairing and maintaining printers, photocopiers and fax machines for our many of satisfied customers. We currently have engineers operating from multiple locations around the London area.
Photocopier Services in London | Photocopier Maintenance London | Best Photocopier Repair London | Photocopier Refurbishing in London | Best Color Photocopier Machine | Black & White Photocopier London | Ricoh London UK | Cheap Photocopier Machine London | Bizhub Dealers in London | Best Laser Printer in London | Office Depot Copier Repair | Refurbished Photocopier London | konica Minolta London UK |

rachel said...

Your blog is the arrangement

midhu said...

Hi,Thanks a lot and really happy to see such a wonderful comment.

123 HP LJ M227 Setup

hp support said...

thanks of sharing information

HP Technical Support

HP Printer Customer Technical support +1-800-723-4210

HP DJ Setup said...

Thank you for the info. It sounds pretty user friendly. I guess I’ll pick one up for fun. thank u.

123 HP Laserjet M227 Setup

Alec said...

Thank you so much.your blog is very helpful.Could you please post any material on Web services testing too.

123 HP Setup

divya said...

Really its very useful information that you have shared and thanks for sharing the information with us. 1018

cavin straut said...

pogo support number is available to customers covered by Support and Subscription contract. PoGo Technical Support is delivered primarily in English except where local language availability is noted. Most Pogo Support Number listed for Phone assistance is toll-free Number 1833-442-7444. which will directly connect you with the Pogo Support and get you necessary help. For More Info>>> pogo games not loading, Pogo games not loading, Pogo support number, Pogo games not working, Pogo technical problem

Emma Williams said...

Brother Printer Support is a one stop solution for printer services. We are proud of delivering instant and highly effective services at any hour of day and also the issue is being rectified as well as corrected in real time right in front of you. We are available 24x7 at +1-888-621-0339.

Brother Printer Support