I'm not sure if it's the same issue, but I'm also seeing firmware failing
to load on my LaserJet 1020 using foo2zjs. My guess is that there's a
conflict between the firmware loading script and udev-configure-printer
trying to access the printer at the same time.

Here is a snippet from journalctl when the printer was turned on:

  May 11 18:02:34 cyclops kernel: usb 2-14: new high-speed USB device
number 14 using xhci_hcd
  May 11 18:02:34 cyclops kernel: usb 2-14: New USB device found,
idVendor=03f0, idProduct=2b17, bcdDevice= 1.00
  May 11 18:02:34 cyclops kernel: usb 2-14: New USB device strings: Mfr=1,
Product=2, SerialNumber=3
  May 11 18:02:34 cyclops kernel: usb 2-14: Product: HP LaserJet 1020
  May 11 18:02:34 cyclops kernel: usb 2-14: Manufacturer: Hewlett-Packard
  May 11 18:02:34 cyclops kernel: usb 2-14: SerialNumber: JL1K941
  May 11 18:02:34 cyclops kernel: usblp 2-14:1.0: usblp1: USB Bidirectional
printer dev 14 if 0 alt 0 proto 2 vid 0x03F0 pid 0x2B17
  May 11 18:02:40 cyclops kernel: usblp1: removed
  May 11 18:02:40 cyclops /lib/udev/hplj1020[162068]: foo2zjs: loading HP
LaserJet 1020 firmware /lib/firmware/hp/sihp1020.dl to CUPS USB device ...
  May 11 18:02:40 cyclops kernel: usblp 2-14:1.0: usblp1: USB Bidirectional
printer dev 14 if 0 alt 0 proto 2 vid 0x03F0 pid 0x2B17
  May 11 18:02:40 cyclops kernel: usblp1: removed
  May 11 18:02:40 cyclops systemd[1]: Started Configure Plugged-In Printer.
  May 11 18:02:40 cyclops udev-configure-printer[162071]: add usb-002-014
  May 11 18:02:40 cyclops udev-configure-printer[162071]: device devpath is
/devices/pci0000:00/0000:00:14.0/usb2/2-14
  May 11 18:02:40 cyclops udev-configure-printer[162071]: Device
vendor/product is 03F0:2B17
  May 11 18:02:41 cyclops udev-configure-printer[162071]: failed to claim
interface
  May 11 18:02:41 cyclops systemd[1]: configure-printer@usb-002-014.service:
Main process exited, code=exited, status=1/FAILURE
  May 11 18:02:41 cyclops systemd[1]: configure-printer@usb-002-014.service:
Failed with result 'exit-code'.

And here's a snippet of the same scenario with a work-around in place:

  May 11 17:58:15 cyclops kernel: usb 2-14: new high-speed USB device
number 13 using xhci_hcd
  May 11 17:58:15 cyclops kernel: usb 2-14: New USB device found,
idVendor=03f0, idProduct=2b17, bcdDevice= 1.00
  May 11 17:58:15 cyclops kernel: usb 2-14: New USB device strings: Mfr=1,
Product=2, SerialNumber=3
  May 11 17:58:15 cyclops kernel: usb 2-14: Product: HP LaserJet 1020
  May 11 17:58:15 cyclops kernel: usb 2-14: Manufacturer: Hewlett-Packard
  May 11 17:58:15 cyclops kernel: usb 2-14: SerialNumber: JL1K941
  May 11 17:58:15 cyclops kernel: usblp 2-14:1.0: usblp1: USB Bidirectional
printer dev 13 if 0 alt 0 proto 2 vid 0x03F0 pid 0x2B17
  May 11 17:58:21 cyclops kernel: usblp1: removed
  May 11 17:58:21 cyclops kernel: usblp 2-14:1.0: usblp1: USB Bidirectional
printer dev 13 if 0 alt 0 proto 2 vid 0x03F0 pid 0x2B17
  May 11 17:58:21 cyclops /lib/udev/hplj1020[161939]: foo2zjs: loading HP
LaserJet 1020 firmware /lib/firmware/hp/sihp1020.dl to CUPS USB device ...
  May 11 17:58:21 cyclops kernel: usblp1: removed
  May 11 17:58:31 cyclops kernel: usblp 2-14:1.0: usblp1: USB Bidirectional
printer dev 13 if 0 alt 0 proto 2 vid 0x03F0 pid 0x2B17
  May 11 17:58:31 cyclops /lib/udev/hplj1020[161944]: foo2zjs:
usb://HP/LaserJet%201020?serial=JL1K941... download successful.
  May 11 17:58:31 cyclops systemd[1]: Started Configure Plugged-In Printer.
  May 11 17:58:31 cyclops udev-configure-printer[161953]: add usb-002-013
  May 11 17:58:31 cyclops udev-configure-printer[161953]: device devpath is
/devices/pci0000:00/0000:00:14.0/usb2/2-14
  May 11 17:58:31 cyclops udev-configure-printer[161953]:
MFG:Hewlett-Packard MDL:HP LaserJet 1020 SERN:- serial:JL1K941
  May 11 17:58:36 cyclops kernel: usblp1: removed
  May 11 17:58:36 cyclops kernel: usblp 2-14:1.0: usblp1: USB Bidirectional
printer dev 13 if 0 alt 0 proto 2 vid 0x03F0 pid 0x2B17
  May 11 17:58:37 cyclops kernel: usblp1: removed
  May 11 17:58:37 cyclops kernel: usblp 2-14:1.0: usblp1: USB Bidirectional
printer dev 13 if 0 alt 0 proto 2 vid 0x03F0 pid 0x2B17
  May 11 17:58:38 cyclops udev-configure-printer[161953]: URI contains USB
serial number
  May 11 17:58:38 cyclops udev-configure-printer[161953]: URI match:
usb://HP/LaserJet%201020?serial=JL1K941
  May 11 17:58:38 cyclops udev-configure-printer[161953]: URI of detected
printer: usb://HP/LaserJet%201020?serial=JL1K941, normalized: laserjet 1020
serial jl1k941
  May 11 17:58:38 cyclops udev-configure-printer[161953]: URI of print
queue: usb://HP/LaserJet%201020?serial=JL1K941, normalized: laserjet 1020
serial jl1k941
  May 11 17:58:38 cyclops udev-configure-printer[161953]: Queue
ipp://localhost/printers/HP_LaserJet_1020 has matching device URI
  May 11 17:58:38 cyclops udev-configure-printer[161953]: Re-enabled
printer ipp://localhost/printers/HP_LaserJet_1020
  May 11 17:58:38 cyclops systemd[1]: configure-printer@usb-002-013.service:
Succeeded.

The key things that distinguish working from not working are:

1. When it works, the printer initially makes noise for a few seconds, then
pauses for a few seconds, then makes the noises again for a few more
seconds. The noises don't resume in the non-working case. This is typical
for this printer: it makes those noises during firmware loading, so the
lack of the second round of noise indicates that the firmware did not load.

2. In the working case, there are two messages from hplj1020. In the
non-working case, the second message does not appear:

  May 11 17:58:21 cyclops /lib/udev/hplj1020[161939]: foo2zjs: loading HP
LaserJet 1020 firmware /lib/firmware/hp/sihp1020.dl to CUPS USB device ...
  May 11 17:58:31 cyclops /lib/udev/hplj1020[161944]: foo2zjs:
usb://HP/LaserJet%201020?serial=JL1K941... download successful.

3.  In the non-working case, these log messages appear:

  May 11 18:02:41 cyclops udev-configure-printer[162071]: failed to claim
interface
  May 11 18:02:41 cyclops systemd[1]: configure-printer@usb-002-014.service:
Main process exited, code=exited, status=1/FAILURE
  May 11 18:02:41 cyclops systemd[1]: configure-printer@usb-002-014.service:
Failed with result 'exit-code'.

To me it looks like the problem is that udev is running hplj1020 to load
the firmware, but hplj1020 (which is just a symlink to hpjs1000) loads the
firmware this way:

  load_cups() {
      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

      # 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
              log "loading HP LaserJet $MODEL firmware $fw to CUPS USB
device ..."
              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
      )  &
      return 0
  }

Note the comment, and the & near the end. It looks like the firmware
loading is performed in the background to work around some old issue, while
the main script exits. This seems to allow udev-configure-printer to start
up, and it also tries to access the printer. I'm guessing that the
simultaneous access is the cause of the "failed to claim interface"
message, and the failure of the firmware loading process.

When I removed the & from the load_cups function, the printer started
working (after a power-cycle).

Reply via email to