Ubuntu 20.04 usb_modeswitch 故障

Ubuntu 20.04 usb_modeswitch 故障

我正在排除usb_modeswitchUbuntu 20.04 上的故障。

以下是各种命令的输出。它们都没有详细说明失败的原因。

您知道如何修复吗usb_modeswitch

$ systemctl --failed

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

$ systemctl 状态[电子邮件保护]

[email protected] - USB_ModeSwitch_1-1.3.2
     Loaded: loaded (/lib/systemd/system/[email protected]; static; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2020-10-28 12:15:13 PDT; 25min ago
       Docs: man:usb_modeswitch_dispatcher(1)
    Process: 3680020 ExecStart=/usr/sbin/usb_modeswitch_dispatcher --switch-mode 1-1.3.2 (code=exited, status=1/FAILURE)
   Main PID: 3680020 (code=exited, status=1/FAILURE)

Oct 28 12:15:13 Satellite-E55 systemd[1]: Starting USB_ModeSwitch_1-1.3.2...
Oct 28 12:15:13 Satellite-E55 systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE
Oct 28 12:15:13 Satellite-E55 systemd[1]: [email protected]: Failed with result 'exit-code'.
Oct 28 12:15:13 Satellite-E55 systemd[1]: Failed to start USB_ModeSwitch_1-1.3.2.

$ grep 模式切换 /var/log/syslog

Oct 28 11:46:05 Satellite-E55 systemd[1]: Starting USB_ModeSwitch_1-1.3.2...
Oct 28 11:46:05 Satellite-E55 systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE
Oct 28 11:46:05 Satellite-E55 systemd[1]: [email protected]: Failed with result 'exit-code'.
Oct 28 11:46:05 Satellite-E55 systemd[1]: Failed to start USB_ModeSwitch_1-1.3.2.

$ sudo systemctl 启动[电子邮件保护]

Job for [email protected] failed because the control process exited with error code.
See "systemctl status [email protected]" and "journalctl -xe" for details.

$ journalctl-xe

Oct 28 12:15:13 Satellite-E55 systemd[1]: Starting USB_ModeSwitch_1-1.3.2...
-- Subject: A start job for unit [email protected] has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit [email protected] has begun execution.
-- 
-- The job identifier is 50559.
Oct 28 12:15:13 Satellite-E55 systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- An ExecStart= process belonging to unit [email protected] has exited.
-- 
-- The process' exit code is 'exited' and its exit status is 1.
Oct 28 12:15:13 Satellite-E55 systemd[1]: [email protected]: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit [email protected] has entered the 'failed' state with result 'exit-code'.
Oct 28 12:15:13 Satellite-E55 systemd[1]: Failed to start USB_ModeSwitch_1-1.3.2.
-- Subject: A start job for unit [email protected] has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit [email protected] has finished with a failure.
-- 
-- The job identifier is 50559 and the job result is failed.
Oct 28 12:15:13 Satellite-E55 sudo[3680017]: pam_unix(sudo:session): session closed for user root

$ lsusb

Bus 001 Device 004: ID 04ca:7017 Lite-On Technology Corp. 
Bus 001 Device 008: ID 8087:07dc Intel Corp. 
Bus 001 Device 020: ID 046d:0a0e Logitech, Inc. 
Bus 001 Device 021: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 001 Device 019: ID 03f0:032a HP, Inc 
Bus 001 Device 018: ID 05e3:0607 Genesys Logic, Inc. Logitech G110 Hub
Bus 001 Device 002: ID 8087:8000 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 026: ID 0480:a00c Toshiba America Inc 
Bus 003 Device 025: ID 0bda:0411 Realtek Semiconductor Corp. 
Bus 003 Device 024: ID 0bda:0411 Realtek Semiconductor Corp. 4-Port USB 3.0 Hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 005: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 002 Device 007: ID 0bda:5411 Realtek Semiconductor Corp. 
Bus 002 Device 006: ID 0bda:5411 Realtek Semiconductor Corp. 4-Port USB 2.0 Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

答案1


更新 #1:以下操作有效,直到我删除了“打印机设置”面板中的 HP USB 打印机定义,并尝试重新添加 HP USB 打印机。没有看到 HP USB 端口。我不得不取消注释下面的修复,然后重新启动。然后我就可以重新添加 HP USB 打印机了。


我发现问题了!

usb_modeswitch正试图翻转我的 HP 打印机!

这是线索...

$ systemctl --failed

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

1-1.3.2 是故障设备的 USB 地址。那么,它是哪个设备?

$ 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显示设备1-1.3.2是我的HP打印机!

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

从中lsusb我们可以看到我的HP打印机的设备代码是:

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

现在我们去/lib/udev/rules.d/40-usb_modeswitch.rules发现:

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

与 HP 打印机的设备代码相匹配。

我们注释掉第二行......

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

我们重新启动,一切都解决了!usb_modeswitch尝试翻转我的 HP 打印机时不再失败!

答案2

由于这是 Google 中的第一批结果之一,因此我将在这里留下我的解决方案,即使它不是完全相同的问题。

就我而言,问题实际上在于 usb_modeswitch 本身的一个错误,可以在这里找到:https://bugs.launchpad.net/ubuntu/+source/usb-modeswitch/+bug/1866926?comments=all

由于 ubuntu 20 附带了2.5.2modeswitch 版本,解决方案已在版本上提交2.6.0,因此升级应该可以解决问题。

这个错误显然会影响树莓派/USB 集线器和其他操作系统。

相关内容