Ubuntu 20.04 usb_modeswitch failure

Solution 1:


Update #1: The following worked until I deleted the HP USB printer definition in the Printer Settings panel, and tried to re-add the HP USB printer. The HP USB port was not seen. I had to un-comment my fix, below, and reboot. Then I could add the HP USB printer back.


I found the problem!

usb_modeswitch was trying to flip my HP printer!

Here's the clue...

$ systemctl --failed

  UNIT                           LOAD      ACTIVE SUB    DESCRIPTION           
● [email protected] loaded    failed failed USB_ModeSwitch_1-1.3.2

The 1-1.3.2 is the USB address of the failing device. So which device is that?

$ lsusb -tv

/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
        ID 0bda:0411 Realtek Semiconductor Corp. 
        |__ Port 4: Dev 3, If 0, Class=Hub, Driver=hub/4p, 5000M
            ID 0bda:0411 Realtek Semiconductor Corp. 
            |__ Port 4: Dev 4, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
                ID 0480:a00c Toshiba America Inc 
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/9p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        ID 0bda:5411 Realtek Semiconductor Corp. 
        |__ Port 4: Dev 4, If 0, Class=Hub, Driver=hub/4p, 480M
            ID 0bda:5411 Realtek Semiconductor Corp. 
    |__ Port 2: Dev 3, If 2, Class=Human Interface Device, Driver=usbhid, 12M
        ID 046d:c52b Logitech, Inc. Unifying Receiver
    |__ Port 2: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 12M
        ID 046d:c52b Logitech, Inc. Unifying Receiver
    |__ Port 2: Dev 3, If 1, Class=Human Interface Device, Driver=usbhid, 12M
        ID 046d:c52b Logitech, Inc. Unifying Receiver
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
        ID 8087:8000 Intel Corp. 
        |__ Port 3: Dev 3, If 0, Class=Hub, Driver=hub/4p, 480M
            ID 05e3:0607 Genesys Logic, Inc. Logitech G110 Hub
            |__ Port 3: Dev 6, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
                ID 051d:0002 American Power Conversion Uninterruptible Power Supply
            |__ Port 4: Dev 7, If 2, Class=Human Interface Device, Driver=usbhid, 12M
                ID 046d:0a0e Logitech, Inc. 
            |__ Port 4: Dev 7, If 0, Class=Audio, Driver=snd-usb-audio, 12M
                ID 046d:0a0e Logitech, Inc. 
            |__ Port 4: Dev 7, If 1, Class=Audio, Driver=snd-usb-audio, 12M
                ID 046d:0a0e Logitech, Inc. 
            |__ Port 2: Dev 5, If 1, Class=Vendor Specific Class, Driver=, 480M
                ID 03f0:032a HP, Inc 
            |__ Port 2: Dev 5, If 0, Class=Printer, Driver=usblp, 480M
                ID 03f0:032a HP, Inc 
        |__ Port 5: Dev 8, If 0, Class=Wireless, Driver=btusb, 12M
            ID 8087:07dc Intel Corp. 
        |__ Port 5: Dev 8, If 1, Class=Wireless, Driver=btusb, 12M
            ID 8087:07dc Intel Corp. 
        |__ Port 8: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M
            ID 04ca:7017 Lite-On Technology Corp. 
        |__ Port 8: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M
            ID 04ca:7017 Lite-On Technology Corp

lsusb -tv shows that device 1-1.3.2 is my HP printer!

        |__ Port 2: Dev 5, If 0, Class=Printer, Driver=usblp, 480M
            ID 03f0:032a HP, Inc 

From lsusb we can see that my HP printer is device code:

Bus 001 Device 019: ID 03f0:032a HP, Inc 

So now we go to /lib/udev/rules.d/40-usb_modeswitch.rules and we find:

# HP LaserJet Professional P1102w
ATTR{idVendor}=="03f0", ATTR{idProduct}=="032a", RUN+="usb_modeswitch '/%k'"

which matches the device code of the HP printer.

We comment out the second line...

# HP LaserJet Professional P1102w
#ATTR{idVendor}=="03f0", ATTR{idProduct}=="032a", RUN+="usb_modeswitch '/%k'"

We reboot, and it's all fixed! usb_modeswitch no longer fails when trying to flip my HP printer!