Connecting an HP LJ 1010/1015/1018/1020 Printer on Linux Debian (Ubuntu) with CUPS 1.4 or later

    When updating the CUPS version, there was a problem of its incompatibility with the loaded usbpl module, which is necessary for downloading firmware to the printer. When they work simultaneously, there is a conflict on the usb bus (simultaneous access), which is reflected in the logs of the / var / log / syslog system as follows: A solution to this problem: - Download the module immediately after turning on the printer - Unload the module immediately after loading filmware To do this, do the following : 0 ) Turn off the printer 1) Install the necessary packages
    -----------------------
    Jul 1 02:18:57 kernel: [ 3115.009361] usb 1-2.5: usbfs: interface 0 claimed by usblp while 'usb' sets config #1
    -----------------------










     aptitude install cupsys gs-esp foomatic-bin foo2zjs cups-pdf   
    

    2) Download the required filmware for the printer, convert it and place it in the appropriate folders:
     wget http://foo2zjs.rkkda.com/firmware/sihp1018.tar.gz
     tar xvzf sihp1018.tar.gz
     arm2hpdl sihp1018.img > sihp1018.dl
     cp sihp1018.dl /usr/share/foo2zjs/firmware
     cp sihp1018.img /usr/share/foo2zjs/firmware
     cp sihp1018.dl /lib/firmware/hp
     cp sihp1018.img /lib/firmware/hp
    

    3) Create a rule for the udev device manager to load the module when the printer is turned on.
     vi /etc/udev/rules.d/11-hplj10xx.rules
    

    Specify the Vid and Pid of your printer! An example is given for 1018.
    #Own udev rule for HP Laserjet 1018
    SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="4117", RUN+="modprobe usblp"
    


    4) Restart udev device manager
     /etc/init.d/udev restart
    

    5) We edit the foo2zjs script that runs when a printer is detected (we disable the usbpl kernel module immediately after loading the firmware). The file name depends on the model of your printer! (For 1000/1005/1018/1020 - / usr / sbin / hplj1018)
     vi /usr/sbin/hplj1018
    

    We are looking for and adjusting the firmware download process
    #
    #       Procedure to load a single device with firmware
    #
    load1() {
        _dev="$1"
        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 $_dev ..."
        # There is a timeout problem with udev and FC4, so spin it off.
        (
            if cat $fw > $_dev; then
                log "... download successful."
                sleep 15
                rmmod usblp                     # Отключаем usblp 
                log " ... kernel module usblp disable now... "
            else
                log "... download failed."
            fi
        ) &
        return 0
    }
    #
    #       OK, now download firmware to any printers that need it
    #
    if [ "$DEV" != "" ]; then
        #
        # force downloading to a specific device
        #
        load1 "$DEV"
    elif [ -x $PRINTERID ]; then
        #
        # Sniff around for printers that need a firmware download
        #
        usblps=`find /dev/usb -name 'lp*'`" "`find /dev -name 'usblp*'`
        for dev in $usblps; do
            status=`$PRINTERID $dev 2>/dev/null | grep -y "hp LaserJet $MODEL"`
            if [ "$status" != "" ]; then
                # This is a LaserJet 100x
                chmod 0666 $dev
                status=`$PRINTERID $dev | grep 'FWVER'`
                if [ "$status" = "" ]; then
                    # Firmware is not yet loaded
                    load1 "$dev"
                else
                    log "HP LaserJet $MODEL firmware already loaded into $dev"
                    sleep 15
                    rmmod usblp                     # Отключаем usblp 
                    log " ... kernel module usblp disable now... "
                fi
     fi
        done
    else
        log "HP LaserJet $MODEL firmware was not downloaded..."
        log "...couldn't find $PRINTERID and DEV is not set"
    fi
    


    change comes down to adding rows
                    sleep 15
                    rmmod usblp
                    log " ... kernel module usblp disable now... "
    


    6) Turn on the printer and look at the logs
     tail -f  /var/log/syslog
    

    if they work correctly, they will have the following:
    --------------------
    Jul 1 01:56:12 kernel: [ 1749.871946] CE: hpet increased min_delta_ns to 20113 nsec
    Jul 1 02:18:39 kernel: [ 3097.400294] usb 1-2.5: new high speed USB device number 8 using ehci_hcd
    Jul 1 02:18:40 kernel: [ 3097.512010] usb 1-2.5: New USB device found, idVendor=03f0, idProduct=4117
    Jul 1 02:18:40 kernel: [ 3097.512084] usb 1-2.5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    Jul 1 02:18:40 kernel: [ 3097.512098] usb 1-2.5: Product: HP LaserJet 1018
    Jul 1 02:18:40 kernel: [ 3097.512109] usb 1-2.5: Manufacturer: Hewlett-Packard
    Jul 1 02:18:40 kernel: [ 3097.512120] usb 1-2.5: SerialNumber: KP03QAY
    Jul 1 02:18:40 mtp-probe: checking bus 1, device 8: "/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2.5"
    Jul 1 02:18:40 mtp-probe: bus: 1, device: 8 was not an MTP device
    Jul 1 02:18:40 udev-configure-printer: add /devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2.5/1-2.5:1.0
    Jul 1 02:18:40 udev-configure-printer: parent devpath is /devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2.5
    Jul 1 02:18:40 udev-configure-printer: Device vendor/product is 03F0:4117
    Jul 1 02:18:40 udev-configure-printer: MFG:Hewlett-Packard MDL:HP LaserJet 1018 SERN:- serial:KP03QAY
    Jul 1 02:18:40 kernel: [ 3097.779667] usblp1: USB Bidirectional printer dev 8 if 0 alt 0 proto 2 vid 0x03F0 pid 0x4117
    Jul 1 02:18:40 kernel: [ 3097.781597] usbcore: registered new interface driver usblp
    Jul 1 02:18:40 udev-configure-printer: add /devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2.5/1-2.5:1.0/usb/lp1
    Jul 1 02:18:41 kernel: [ 3098.989429] usb 1-2.5: usbfs: interface 0 claimed by usblp while 'usb' sets config #1
    Jul 1 02:18:43 /usr/sbin/hplj1018: foo2zjs: loading HP LaserJet 1018 firmware /lib/firmware/hp/sihp1018.dl to /dev/usb/lp1 ...
    Jul 1 02:18:43 /usr/sbin/hplj1018: foo2zjs: ... download successful.
    Jul 1 02:18:56 udev-configure-printer: parent devpath is /devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2.5
    Jul 1 02:18:56 udev-configure-printer: MFG:Hewlett-Packard MDL:HP LaserJet 1018 SERN:- serial:KP03QAY
    Jul 1 02:18:57 kernel: [ 3115.009361] usb 1-2.5: usbfs: interface 0 claimed by usblp while 'usb' sets config #1
    Jul 1 02:18:58 kernel: [ 3116.139386] usbcore: deregistering interface driver usblp
    Jul 1 02:18:58 kernel: [ 3116.139675] usblp1: removed
    Jul 1 02:18:58 /usr/sbin/hplj1018: foo2zjs: ... kernel module usblp disable now...
    --------------------

    Also popular now: