HP LaserJet 1020

From YobiWiki
Jump to navigation Jump to search

Converted with HTML::WikiConverter::MediaWiki from my old phpwiki site


Inputs

Procedure

We need to patch the foo2zjs package.
You can try by yourself with my patch file or download directly my foo2zjs_20050217-2_i386.deb package.
On top of the changes proposed by the references given on top of this page, I had to make specific changes for Debian, especially for a correct hotplug integration.

  • apt-get install hotplug cupsys cupsys-client foomatic-db
  • apt-get build-dep foo2zjs
  • apt-get source foo2zjs
  • cd foo2zjs-*
  • patch -p1 < ../foo2zjs_20050217-2.diff
  • dpkg-buildpackage -rfakeroot -b
  • cd ..
  • dpkg -i foo2zjs_20050217-2_i386.deb
  • /etc/init.d/cupsys restart
  • /etc/init.d/hotplug restart

2006-03 update:

Last release of foo2zjs is ready for HP 1020.
But Debian package does not contain the firmware neither the loader nor usb_printerid.
See Bugreports #279830 and #355576

  • apt-get install foo2zjs
  • wget http://foo2zjs.rkkda.com/foo2zjs.tar.gz
  • tar xzf foo2zjs.tar.gz
  • cd foo2zjs
  • arm2hpdl sihp1020.img > /usr/share/foo2zjs/firmware/sihp1020.dl
  • make usb_printerid
  • cp usb_printerid /usr/local/sbin

Create the loader: create and make executable /usr/local/sbin/foo2zjs-loadfw

 #!/bin/sh
 
 #       foo2zjs-loadfw:
 #
 #       Hotplug script for HP1000/1005/1020 USB laser printers. The model number
 #       that this script deals with is determined from the udev env.
 #
 #       Used to download firmware automatically into the printer when it
 #       is powered up or plugged into the USB port.
 #
 #       The inspiration fo this script is from:
 #               Oscar Santacreu. Alicante-Spain (2002)
 #               Mike Morgan (2004)
 #       Modified by Stefan Schweizer (2005) to work as a udev-RUN-script
 
 #
 # Directory to find downloadable HP firmware files sihpMMMM.dl
 #
 #FWDIR=/lib/firmware
 FWDIR=/usr/share/foo2zjs/firmware
 
 #
 # Program used to determine USB id information
 #
 #USBID=/sbin/usb_printerid
 #USBID=/usr/bin/usb_printerid
 USBID=/usr/local/sbin/usb_printerid
 
 #
 #       Figure out how to log our messages
 #
 if [ -t 1 ]; then
     # Running from a tty...
     log() {
         echo "$0: $@"
     }
 elif [ -x /usr/bin/logger ]; then
     # Have logger...
     log() {
         logger -t "$0" -- "$@"
     }
 else
     # No logger...
     log() {
         echo "$0: $@" >> /var/log/messages
     }
 fi
 
 #
 #       Figure out the model number from the name of this script
 #
 case "$1" in
 1000)
     MODEL=1000
     MODELNAME="hp LaserJet $MODEL"
     ;;
 1005)
     MODEL=1005
     MODELNAME="hp LaserJet $MODEL"
     ;;
 1020)
     MODEL=1020
     MODELNAME="HP LaserJet $MODEL"
     ;;
 *)
     log "Only HP LaserJet 1000, 1005 and 1020 are supported"
     log "You need to supply one of these on the cmdline: $0 10**"
     exit
     ;;
 esac
 
 if [ -z "$DEVNAME" ]; then
     if [ -n "$2" ]; then
         DEVNAME=$2
     else
         log "You need to either have $DEVNAME set in the environment or supply it on the cmdline, like:"
         log "$0 10** /dev/usb/lp0"
         exit 1
     fi
 fi
 
 #
 #       Procedure to load a single device with firmware
 #
 load1() {
     fw="$FWDIR/sihp$MODEL.dl"
     if [ ! -f "$fw" ]; then
         log "Missing HP LaserJet $MODEL firmware file $fw"
         log "...read foo2zjs installation instructions and run ./getweb $MODEL"
         return 1
     fi
 
     log "loading HP LaserJet $MODEL firmware $fw to $DEVNAME ..."
     if cat $fw > $DEVNAME; then
         log "... download successful."
     else
         log "... download failed."
     fi
     return 0
 }
 
 #
 #       OK, now download firmware to any printers that need it
 #
 if [ -x $USBID ]; then
         if $USBID $DEVNAME | grep "$MODELNAME" 2> /dev/null; then
             # This is a LaserJet 100x
             if $USBID $DEVNAME | grep 'FWVER' 2> /dev/null; then
                 log "HP LaserJet $MODEL firmware already loaded into $DEVNAME"
             else
                 # Firmware is not yet loaded
                 load1 "$DEVNAME"
             fi
         else
             log "No supported printer found."
         fi
 else
     log "HP LaserJet $MODEL firmware was not downloaded..."
     log "...couldn't find $USBID"
 fi

Integration to udev:
Create /etc/udev/rules.d/hplj10xx.rules with:

 #Own udev rule for HP Laserjet 1000
 KERNEL="lp*", BUS="usb", SYSFS{idVendor}="03f0", SYSFS{product}="hp LaserJet 1000", NAME="usb/%k", SYMLINK="hplj1000%e", MODE="0666", RUN+="/usr/local/sbin/foo2zjs-loadfw 1000 /dev/usb/%k"
 #Own udev rule for HP Laserjet 1005
 KERNEL="lp*", BUS="usb", SYSFS{idVendor}="03f0", SYSFS{product}="hp LaserJet 1005", NAME="usb/%k", SYMLINK="hplj1005%e", MODE="0666", RUN+="/usr/local/sbin/foo2zjs-loadfw 1005 /dev/usb/%k"
 #Own udev rule for HP Laserjet 1020
 KERNEL="lp*", BUS="usb", SYSFS{idVendor}="03f0", SYSFS{product}="HP LaserJet 1020", NAME="usb/%k", SYMLINK="hplj1020%e", MODE="0666", RUN+="/usr/local/sbin/foo2zjs-loadfw 1020 /dev/usb/%k"