author | Michael Krelin <hacker@klever.net> | 2007-04-19 17:50:17 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-04-22 23:41:30 (UTC) |
commit | ce0f4181dbecc877171c818a2facc91c88c5f419 (patch) (side-by-side diff) | |
tree | 4ce23c2851a403b217459bd1c7a1ed78329e1f34 /net-print/foo2zjs/files/foo2zjs-udevfwld-20070204.diff | |
parent | 683fcb5949708dace90bc9ca17a40568edce4d6e (diff) | |
download | misc-ce0f4181dbecc877171c818a2facc91c88c5f419.zip misc-ce0f4181dbecc877171c818a2facc91c88c5f419.tar.gz misc-ce0f4181dbecc877171c818a2facc91c88c5f419.tar.bz2 |
net-print/foo2zjs: imported from portage
Diffstat (limited to 'net-print/foo2zjs/files/foo2zjs-udevfwld-20070204.diff') (more/less context) (ignore whitespace changes)
-rw-r--r-- | net-print/foo2zjs/files/foo2zjs-udevfwld-20070204.diff | 191 |
1 files changed, 191 insertions, 0 deletions
diff --git a/net-print/foo2zjs/files/foo2zjs-udevfwld-20070204.diff b/net-print/foo2zjs/files/foo2zjs-udevfwld-20070204.diff new file mode 100644 index 0000000..5935d5e --- a/dev/null +++ b/net-print/foo2zjs/files/foo2zjs-udevfwld-20070204.diff @@ -0,0 +1,191 @@ +diff -Nur foo2zjs.orig/Makefile foo2zjs/Makefile +--- foo2zjs.orig/Makefile 2007-02-11 11:08:50.000000000 +0100 ++++ foo2zjs/Makefile 2007-02-11 11:12:11.000000000 +0100 +@@ -9,6 +9,10 @@ + PREFIX=/usr/local + PREFIX=$(DESTDIR)/usr + ++# USB_PRINTERID is also installed there because it is needed by the FWloader ++FWLOADERDIR=$(DESTDIR)/sbin ++FIRMWAREDIR=$(DESTDIR)/lib/firmware ++ + # Pathnames for this package... + BIN=$(PREFIX)/bin + SHAREZJS=$(PREFIX)/share/foo2zjs +@@ -470,12 +474,12 @@ + fi; \ + done + # foo2zjs Firmware files (if any) +- install $(LPuid) $(LPgid) -m 775 -d $(SHAREZJS)/firmware/ ++ install $(LPuid) $(LPgid) -m 775 -d $(FIRMWAREDIR)/ + for i in sihp*.img; do \ + if [ -f $$i ]; then \ + base=`basename $$i .img`; \ + ./arm2hpdl $$i >$$base.dl; \ +- install -c -m 644 $$base.dl $(SHAREZJS)/firmware/; \ ++ install -c -m 644 $$base.dl $(FIRMWAREDIR)/; \ + fi; \ + done + # foo2oak ICM files (if any) +@@ -548,6 +552,8 @@ + UDEVDIR=$(DESTDIR)/etc/udev/rules.d + RULES=hplj10xx.rules + install-udev: ++ [ -d $(FWLOADERDIR) ] || install -d -m 755 $(FWLOADERDIR)/ ++ install -c -m 755 foo2zjs-loadfw $(FWLOADERDIR)/ + [ -d $(UDEVDIR) ] || install -d -m 755 $(UDEVDIR)/ + install -c -m 644 $(RULES) $(UDEVDIR)/11-$(RULES) + +diff -Nur foo2zjs.orig/foo2zjs-loadfw foo2zjs/foo2zjs-loadfw +--- foo2zjs.orig/foo2zjs-loadfw 1970-01-01 01:00:00.000000000 +0100 ++++ foo2zjs/foo2zjs-loadfw 2007-02-11 11:12:11.000000000 +0100 +@@ -0,0 +1,121 @@ ++#!/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 ++ ++# ++# Program used to determine USB id information ++# ++USBID=/bin/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" ++ ;; ++1018) ++ MODEL=1018 ++ MODELNAME="HP LaserJet $MODEL" ++ ;; ++1020) ++ MODEL=1020 ++ MODELNAME="HP LaserJet $MODEL" ++ ;; ++*) ++ log "Only HP LaserJet 1000, 1005, 1018 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 +diff -Nur foo2zjs.orig/hplj1000 foo2zjs/hplj1000 +--- foo2zjs.orig/hplj1000 2007-02-11 11:02:46.000000000 +0100 ++++ foo2zjs/hplj1000 2007-02-11 11:12:11.000000000 +0100 +@@ -35,7 +35,7 @@ + # + # Directory to find downloadable HP firmware files sihpMMMM.dl + # +-FWDIR=/usr/share/foo2zjs/firmware ++FWDIR=/lib/firmware + + # + # Program used to determine USB id information +diff -Nur foo2zjs.orig/hplj10xx.rules foo2zjs/hplj10xx.rules +--- foo2zjs.orig/hplj10xx.rules 2007-02-11 11:02:46.000000000 +0100 ++++ foo2zjs/hplj10xx.rules 2007-02-11 11:12:11.000000000 +0100 +@@ -1,8 +1,8 @@ + #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+="/etc/hotplug/usb/hplj1000" ++KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="0517", NAME="usb/%k", SYMLINK+="hplj1000%e", MODE="0660", GROUP="lp", RUN+="/sbin/foo2zjs-loadfw 1000" + #Own udev rule for HP Laserjet 1005 +-KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", SYSFS{product}=="hp LaserJet 1005 series", NAME="usb/%k", SYMLINK+="hplj1005%e", MODE="0666", RUN+="/etc/hotplug/usb/hplj1005" ++KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="1317", NAME="usb/%k", SYMLINK+="hplj1005%e", MODE="0660", GROUP="lp", RUN+="/sbin/foo2zjs-loadfw 1005" + #Own udev rule for HP Laserjet 1018 +-KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", SYSFS{product}=="HP LaserJet 1018", NAME="usb/%k", SYMLINK+="hplj1018%e", MODE="0666", RUN+="/etc/hotplug/usb/hplj1018" ++KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="4117", NAME="usb/%k", SYMLINK+="hplj1018%e", MODE="0660", GROUP="lp", RUN+="/sbin/foo2zjs-loadfw 1018" + #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+="/etc/hotplug/usb/hplj1020" ++KERNEL=="lp*", BUS=="usb", SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="2b17", NAME="usb/%k", SYMLINK+="hplj1020%e", MODE="0660", GROUP="lp", RUN+="/sbin/foo2zjs-loadfw 1020" |