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 http://oleg.wl500g.info/hplj/sihp1018.dl -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 http://oleg.wl500g.info/hplj/usb_printerid -O /usr/local/sbin/usb_printerid

1.3. /usr/local/sbin/hotplug.sh

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

#!/bin/sh
LOG=/tmp/hotplug.log
PRN_BIN=/usr/local/sbin/usb_printerid
PRN_FRM1=/tmp/sihp1018.dl
PRN_FRM2=/opt/sihp1018.dl
# 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
else
echo "Printer OffLine" >> $LOG
fi
killall hotplug.sh

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.

#!/bin/sh
# Mount USB flash disk
if [ -w /dev/discs/disc0/part1 ]; then
mount /dev/discs/disc0/part1 /usr/local/flashdisk
fi
# 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
fi
# Hotplug script
echo "/usr/local/sbin/hotplug.sh" >> /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: http://oleg.wl500g.info/printing/

Note:

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 http://wl500g.info/forumdisplay.php?f=24 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.

30 comments:

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.

Safdar Ali 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...

http://wl500g.info/showthread.php?4092-HP-LaserJet-1000-1005-1020-not-working-sort-of-solution&p=258317#post258317

rachel said...

Your blog is great..love the arrangement

midhu said...



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

123 HP LJ M227 Setup

Unknown 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.
123.hp.com/setup 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

Unknown said...

Woah! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “ perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.
Buy Generic Medicine is an online store that offers medicines for customers at an affordable price
peek here
navigate here
his comment is here

Unknown said...

This Collection host all the VAPE PEN KITS in the traditional easy to use Pen-Style. This collection contains products from various brands such as Kangertech, Smok, Joyetech, wismec and more. Easy and ready to use starter kits.

Arshad zaidi said...


Find the best deals on the best e juice and premium e liquid right here. Shop by eJuice flavors with categories like Dessert, Candy, Fruit & Menthol. Explore even more flavors with our popular eJuice Mystery Box! Stock up on vape supplies now at Cheap eJuice! We are one of the cheap e juice companies you can easily find on the net.

Arshad zaidi said...

LA Vaproz is here to bring you best vape juice available in the market. LA Vapors deals in Wholesale vape juice. Based in the US and China while globally shipping bulk e liquid wholesale, LA Vaporz offers Cheap Vape Juice at your doorstep.

Arshad zaidi said...



Welcome to VapeRankz! The # 1 Best Vape Review Website.

We all have the Right to Privacy and Protection of our Personal Data. From This Point of View, We Started This Website, With information about VPN Review, Online Privacy, Security And Responsible internet use. With a small, Dedicated Team of Professionals, We Ensure that up-to-date and Qualitative Articles Appear on our Platform.

GarryJones said...

How can you tell which is the best product from the list on this site?https://buywirelessrouternow.com/best-rangefinder/

DKIM Services said...

DKIM services - Protect your domain from email spammers. DKIM ((Domain Keys Identified Mail) is a defined process used for the email message authenticity.DKIM Services

DKIM Email Authentication

Email Authentication Service

Best IVF Centre in Delhi said...

IVF centre in Delhi have the most Trusted & Successful IVF Specialist in Delhi. Get assured chance to become parents. Consult for Best IVF Treatment in Delhi at Most Affordable Price.Best IVF Centre in Delhi

IVF Specialist in Delhi

best IVF clinic in Delhi

Printer Offline Tech said...

Thanks for posting article....keep posting always

Printer Offline Tech said...

Brother Printer Offline is common issue faced by brother printer users. Visit Brother Printer UK. A Brother Printer expert troubleshoots all issues in the shortest span of time to make the user comfortable with printer.

Brother Printer UK said...

Brother Printer UK is an independent helpline service provider. A Brother Printer expert troubleshoots all issues in the shortest span of time to make the user comfortable with printer.

Orbi Helpline said...

We at Orbi Helpline, offer Orbi technical services throughout the USA, Canada, and the UK. We are a team of technical experts who help you with solving all Orbi related problems.

Unknown said...

Router Error Code is a team of intelligent smart professionals who responds to the user. Our Router Expert team constitutes experienced tech experts who will troubleshoot all issues related to your device as soon as possible.

Daisy Jones said...

Thanks for give us valuable information If you are Looking for D-link Support , visit on

dlink admin password
D-link australia

lucynelson said...

Is your canon printer won't connect to wifi? Unable to find the perfect solution? Don’t worry we are here to help you. Our dedicated team will guide you and provide you the best solution. To know more visit Printer Offline Error.

Glenn Hannan said...

Thanks a lot for sharing this amazing knowledge with us. This site is fantastic. I always find great knowledge from it.  Laserjet shop in Nairobi Kenya

Smart austo said...


Nice Information , Thanks For The Great Content
Get started Hp printer software install and setup .you can install 123 HP OJ4650 Setup from

123.hp.com/Setup|ojpro6968
|123.hp.com/oj3830|123.hp.com/oj4650 |123.hp.com/ojpro6968| 123.hp.com/Setup ojpro

Smart austo said...

Nice Information , Thanks For The Great Content
Get started Hp printer software install and setup .you can install 123 HP OJ4650 Setup from

123.hp.com/Setup|ojpro6968
|123.hp.com/oj3830|123.hp.com/oj4650 |123.hp.com/dj3630| 123.hp.com/Setup ojpro