Bug#630228: foo2zjs: Firmware upload is not compatible with cups

2011-06-14 Thread Till Kamppeter

Small fix done on the patch ...

   Till
Index: foo2zjs-20110210dfsg/hplj1000
===
--- foo2zjs-20110210dfsg.orig/hplj1000	2011-06-14 16:30:59.331940282 +0200
+++ foo2zjs-20110210dfsg/hplj1000	2011-06-14 16:31:26.151976656 +0200
@@ -48,6 +48,12 @@
 DEV=""
 
 #
+# Path to the USB CUPS backend. We use this backend to upload the firmware
+# into the printer when we are on a CUPS/libusb-based system.
+#
+USB_BACKEND=/usr/lib/cups/backend/usb
+
+#
 # Directory to find downloadable HP firmware files sihp.dl
 #
 FWDIR=/lib/firmware/hp
@@ -195,7 +201,7 @@
 esac
  
 #
-#	Procedure to load a single device with firmware
+#	Procedures to load a single device with firmware
 #
 load1() {
 _dev="$1"
@@ -218,6 +224,33 @@
 return 0
 }
 
+load2() {
+fw="$FWDIR/sihp$FWMODEL.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 CUPS USB device ..."
+# There is a timeout problem with udev and FC4, so spin it off.
+(
+	device_found=0
+	for uri in `$USB_BACKEND 2> /dev/null | grep -i 'HP.*LaserJet.*'"$MODEL" | grep -v FWVER | cut -d ' ' -f 2`; do
+	device_found=1
+	if DEVICE_URI="$uri" $USB_BACKEND 1 1 1 1 '' $fw 2> /dev/null; then
+		log "$uri... download successful."
+	else
+		log "$uri... download failed."
+	fi
+	done
+	if [ $device_found = 0 ]; then
+	log "... no devices which need firmware found."
+	fi
+) &
+return 0
+}
+
 #
 #	OK, now download firmware to any printers that need it
 #
@@ -226,6 +259,13 @@
 # force downloading to a specific device
 #
 load1 "$DEV"
+elif [ -x $USB_BACKEND ]; then
+#
+# If we have CUPS installed, use the CUPS "usb" backend, as then we do
+# not need to care whether the system uses the usblp kernel module or
+# libusb
+#
+load2
 elif [ -x $PRINTERID ]; then
 #
 # Sniff around for printers that need a firmware download
@@ -247,5 +287,5 @@
 done
 else
 log "HP LaserJet $MODEL firmware was not downloaded..."
-log "...couldn't find $PRINTERID and DEV is not set"
+log "...couldn't find $PRINTERID, DEV is not set, and CUPS not installed."
 fi


Bug#630228: foo2zjs: Firmware upload is not compatible with cups

2011-06-14 Thread Till Kamppeter
I have now updated the Ubuntu package (20110210dfsg-1ubuntu4) applying 
the attached patch. The patch modifies the firmware upload script 
hplj1000. It adds support for douing the firmware upload through the 
"usb" backend of CUPS. This makes the upload independent of the presence 
of usblp. It works also with the new libusb-based CUPS package.


   Till
Index: foo2zjs-20110210dfsg/hplj1000
===
--- foo2zjs-20110210dfsg.orig/hplj1000	2011-06-14 16:30:59.331940282 +0200
+++ foo2zjs-20110210dfsg/hplj1000	2011-06-14 16:31:26.151976656 +0200
@@ -48,6 +48,12 @@
 DEV=""
 
 #
+# Path to the USB CUPS backend. We use this backend to upload the firmware
+# into the printer when we are on a CUPS/libusb-based system.
+#
+USB_BACKEND=/usr/lib/cups/backend/usb
+
+#
 # Directory to find downloadable HP firmware files sihp.dl
 #
 FWDIR=/lib/firmware/hp
@@ -195,7 +201,7 @@
 esac
  
 #
-#	Procedure to load a single device with firmware
+#	Procedures to load a single device with firmware
 #
 load1() {
 _dev="$1"
@@ -218,6 +224,33 @@
 return 0
 }
 
+load2() {
+fw="$FWDIR/sihp$FWMODEL.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 CUPS USB device ..."
+# There is a timeout problem with udev and FC4, so spin it off.
+(
+	device_found=0
+	for uri in `$USB_BACKEND 2> /dev/null | grep -i 'HP.*LaserJet.*'"$MODEL" | grep -v FWVER | cut -d ' ' -f 2`; do
+	device_found=1
+	if DEVICE_URI="$uri" /usr/lib/cups/backend/usb 1 1 1 1 '' $fw 2> /dev/null; then
+		log "$uri... download successful."
+	else
+		log "$uri... download failed."
+	fi
+	done
+	if [ $device_found = 0 ]; then
+	log "... no devices which need firmware found."
+	fi
+) &
+return 0
+}
+
 #
 #	OK, now download firmware to any printers that need it
 #
@@ -226,6 +259,13 @@
 # force downloading to a specific device
 #
 load1 "$DEV"
+elif [ -x $USB_BACKEND ]; then
+#
+# If we have CUPS installed, use the CUPS "usb" backend, as then we do
+# not need to care whether the system uses the usblp kernel module or
+# libusb
+#
+load2
 elif [ -x $PRINTERID ]; then
 #
 # Sniff around for printers that need a firmware download
@@ -247,5 +287,5 @@
 done
 else
 log "HP LaserJet $MODEL firmware was not downloaded..."
-log "...couldn't find $PRINTERID and DEV is not set"
+log "...couldn't find $PRINTERID, DEV is not set, and CUPS not installed."
 fi


Bug#630228: foo2zjs: Firmware upload is not compatible with cups

2011-06-12 Thread Till Kamppeter

On 06/12/2011 05:29 PM, Roger Leigh wrote:

Why is this not being done at a lower level, e.g. via udev or other
existing hotplug mechanisms?  Firmware-loading for /any/ device is
not the remit of cups, and it's really not cups' call to disable
any module loading.


Do you know a tool which can send the firmware file to a raw libusb 
device, so that using the CUPS backend for this is not necessary?


Note that upstream CUPS is only to be able to access the USB printers 
with one method, either usblp or libusb, not both. I suggested to use my 
patch for getting a hybrid usb backend upstream but Mike Sweet do not 
want to use it, he tells, usblp should be deprecated and only libusb 
should be used.


libusb is also the better method for modern multi-function devices. 
Especially HP uses libusb in their "hp" CUPS backend. So for a better 
consistency it is better to use only libusb in CUPS environments.


Therefore I want to deprecate usblp and switch software which still use 
it to use libusb.


   Till




--
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#630228: Info received (Bug#630228: foo2zjs: Firmware upload is not compatible with cups)

2011-06-12 Thread Roger Leigh
On Sun, Jun 12, 2011 at 04:55:49PM +0200, Till Kamppeter wrote:
> The fix is simple. The firmware uploader script needs to determine
> whether usblp is loaded or not, and if it is not loaded and the CUPS
> filter /usr/lib/cups/filter/usb exists, it should run a command line
> like this ("1020" replaced by actual model number):
> 
> for uri in `sudo /usr/lib/cups/backend/usb | grep -i
> 'HP.*LaserJet.*1020' | grep -v FWVER | cut -d ' ' -f 2`; do echo
> $uri; sudo DEVICE_URI="$uri" /usr/lib/cups/backend/usb 1 1 1 1 ''
> /lib/firmware/hp/sihp1020.dl; done
> 
> This goes through all devices of the given model which do not have
> firmware loaded yet and load the firmware into them using the "usb"
> CUPS backend. As the usblp module is blacklisted by the CUPS
> package, this is sufficient to solve the problem.

Why is this not being done at a lower level, e.g. via udev or other
existing hotplug mechanisms?  Firmware-loading for /any/ device is
not the remit of cups, and it's really not cups' call to disable
any module loading.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?   http://gutenprint.sourceforge.net/
   `-GPG Public Key: 0x25BFB848   Please GPG sign your mail.


signature.asc
Description: Digital signature


Bug#630228: Info received (Bug#630228: foo2zjs: Firmware upload is not compatible with cups)

2011-06-12 Thread Till Kamppeter
The fix is simple. The firmware uploader script needs to determine 
whether usblp is loaded or not, and if it is not loaded and the CUPS 
filter /usr/lib/cups/filter/usb exists, it should run a command line 
like this ("1020" replaced by actual model number):


for uri in `sudo /usr/lib/cups/backend/usb | grep -i 
'HP.*LaserJet.*1020' | grep -v FWVER | cut -d ' ' -f 2`; do echo $uri; 
sudo DEVICE_URI="$uri" /usr/lib/cups/backend/usb 1 1 1 1 '' 
/lib/firmware/hp/sihp1020.dl; done


This goes through all devices of the given model which do not have 
firmware loaded yet and load the firmware into them using the "usb" CUPS 
backend. As the usblp module is blacklisted by the CUPS package, this is 
sufficient to solve the problem.


   Till



--
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#630228: foo2zjs: Firmware upload is not compatible with cups

2011-06-12 Thread Till Kamppeter

On 06/12/2011 04:03 PM, Didier Raboud wrote:

I'm hereby CC'ing the CUPS maintainers; opinions ?


I know about that problem and I will update the firmware upload script 
in the foo2zjs package soon, so that it also works with libusb.


   Till




--
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#630228: foo2zjs: Firmware upload is not compatible with cups

2011-06-12 Thread Didier Raboud
Le dimanche, 12 juin 2011 15.40:09, Peter De Wachter a écrit :
> Package: foo2zjs
> Version: 20110210dfsg-2
> Severity: serious
> 
> The latest cups upload blacklisted the usblp kernel module, but foo2zjs'
> firmware upload scripts need that module to function. Would it be difficult
> to rewrite the firmware scripts to use raw usb devices?

I'm hereby CC'ing the CUPS maintainers; opinions ?

Cheers,

-- 
OdyX



--
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#630228: foo2zjs: Firmware upload is not compatible with cups

2011-06-12 Thread Peter De Wachter
Package: foo2zjs
Version: 20110210dfsg-2
Severity: serious

The latest cups upload blacklisted the usblp kernel module, but foo2zjs'
firmware upload scripts need that module to function. Would it be difficult
to rewrite the firmware scripts to use raw usb devices?

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.38-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=nl_BE.UTF-8, LC_CTYPE=nl_BE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages foo2zjs depends on:
ii  cups  1.4.6-8Common UNIX Printing System(tm) - 
ii  cups-client   1.4.6-8Common UNIX Printing System(tm) - 
ii  dc1.06.95-2  The GNU dc arbitrary precision rev
ii  foomatic-filters  4.0.7-1OpenPrinting printer support - fil
ii  libc6 2.13-6 Embedded GNU C Library: Shared lib
ii  libcups2  1.4.6-8Common UNIX Printing System(tm) - 

Versions of packages foo2zjs recommends:
ii  foomatic-db-engine4.0.7-2OpenPrinting printer support - pro
ii  unzip 6.0-4  De-archiver for .zip files
ii  wget  1.12-3.1   retrieves files from the web

Versions of packages foo2zjs suggests:
pn  hannah-foo2zjs (no description available)
ii  psutils   1.17-29A collection of PostScript documen
pn  tix(no description available)
pn  tk8.4  (no description available)

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org