我在 Ubuntu 16.04 中使用 USB3 闪存驱动器时遇到了一些问题。它们不断进入 U1/U2 模式(浏览此处获取更多信息),偶尔会导致 I/O 错误。我已经通过将其放入以下位置禁用了传统的(软件控制的)USB 电源管理/etc/rc.local
(是的,它是多余的):
for i in /sys/bus/usb/devices/*/power/autosuspend_delay_ms;
do echo -1 > $i;
done
for foo in /sys/bus/usb/devices/*/power/control;
do echo on > $foo;
done
我也尝试了内核启动选项usbcore.autosuspend=-1
。但是,根据dmesg
,闪存驱动器仍然进入 U1/U2 模式。文档说可以使用禁用 USB3 LPM /sys/bus/usb/devices/.../(hub interface)/portX/usb3_lpm_permit
,但在我的计算机上的任何 USB 设备上都不存在此文件,至少find /sys -iname "*usb3*"
没有显示它。找到什么做显示这些只读文件:
/sys/devices/pci0000:00/0000:00:14.0/usb2/2-1/power/usb3_hardware_lpm_u1
/sys/devices/pci0000:00/0000:00:14.0/usb2/2-1/power/usb3_hardware_lpm_u2
/sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/power/usb3_hardware_lpm_u1
/sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/power/usb3_hardware_lpm_u2
/sys/devices/pci0000:00/0000:00:14.0/usb2/2-3/power/usb3_hardware_lpm_u1
/sys/devices/pci0000:00/0000:00:14.0/usb2/2-3/power/usb3_hardware_lpm_u2
/sys/devices/pci0000:00/0000:00:14.0/usb2/2-4/power/usb3_hardware_lpm_u1
/sys/devices/pci0000:00/0000:00:14.0/usb2/2-4/power/usb3_hardware_lpm_u2
/sys/devices/pci0000:00/0000:00:14.0/usb2/power/usb3_hardware_lpm_u1
/sys/devices/pci0000:00/0000:00:14.0/usb2/power/usb3_hardware_lpm_u2
前八个包含字符串“enabled”,只有最后两个(我猜是集线器)显示“disabled”。
我该如何覆盖此问题并彻底禁用所有四个设备的 USB3 LPM?我试过了,写入这些文件不起作用。
这是我的系统信息:HP Chromebox
# lsusb
Bus 002 Device 009: ID 05dc:a838 Lexar Media, Inc.
Bus 002 Device 006: ID 05dc:a838 Lexar Media, Inc.
Bus 002 Device 010: ID 05dc:a838 Lexar Media, Inc.
Bus 002 Device 008: ID 05dc:a838 Lexar Media, Inc.
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 0cf3:311e Atheros Communications, Inc.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
核心:
# uname -a
Linux FileserverA112 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
# lspci -knn 00:00.0 Host bridge [0600]: Intel Corporation Haswell-ULT DRAM Controller [8086:0a04] (rev 0b) Subsystem: Google, Inc. Haswell-ULT DRAM Controller [1ae0:c000] Kernel driver in use: hsw_uncore 00:02.0 VGA compatible controller [0300]: Intel Corporation Haswell-ULT Integrated Graphics Controller [8086:0a06] (rev 0b) Subsystem: Google, Inc. Haswell-ULT Integrated Graphics Controller [1ae0:c000] Kernel driver in use: i915 Kernel modules: i915 00:03.0 Audio device [0403]: Intel Corporation Haswell-ULT HD Audio Controller [8086:0a0c] (rev 0b) Subsystem: Google, Inc. Haswell-ULT HD Audio Controller [1ae0:c000] Kernel driver in use: snd_hda_intel Kernel modules: snd_hda_intel 00:14.0 USB controller [0c03]: Intel Corporation 8 Series USB xHCI HC [8086:9c31] (rev 04) Subsystem: Google, Inc. 8 Series USB xHCI HC [1ae0:c000] Kernel driver in use: xhci_hcd 00:16.0 Communication controller [0780]: Intel Corporation 8 Series HECI #0 [8086:9c3a] (rev 04) Subsystem: Google, Inc. 8 Series HECI [1ae0:c000] Kernel driver in use: mei_me Kernel modules: mei_me 00:1b.0 Audio device [0403]: Intel Corporation 8 Series HD Audio Controller [8086:9c20] (rev 04) Subsystem: Google, Inc. 8 Series HD Audio Controller [1ae0:c000] Kernel driver in use: snd_hda_intel Kernel modules: snd_hda_intel 00:1c.0 PCI bridge [0604]: Intel Corporation 8 Series PCI Express Root Port 3 [8086:9c14] (rev e4) Kernel driver in use: pcieport Kernel modules: shpchp 00:1c.1 PCI bridge [0604]: Intel Corporation 8 Series PCI Express Root Port 4 [8086:9c16] (rev e4) Kernel driver in use: pcieport Kernel modules: shpchp 00:1c.2 PCI bridge [0604]: Intel Corporation 8 Series PCI Express Root Port 5 [8086:9c18] (rev e4) Kernel driver in use: pcieport Kernel modules: shpchp 00:1f.0 ISA bridge [0601]: Intel Corporation 8 Series LPC Controller [8086:9c45] (rev 04) Subsystem: Google, Inc. 8 Series LPC Controller [1ae0:c000] Kernel driver in use: lpc_ich Kernel modules: lpc_ich 00:1f.2 SATA controller [0106]: Intel Corporation 8 Series SATA Controller 1 [AHCI mode] [8086:9c03] (rev 04) Subsystem: Google, Inc. 8 Series SATA Controller 1 [AHCI mode] [1ae0:c000] Kernel driver in use: ahci Kernel modules: ahci 00:1f.3 SMBus [0c05]: Intel Corporation 8 Series SMBus Controller [8086:9c22] (rev 04) Subsystem: Google, Inc. 8 Series SMBus Controller [1ae0:c000] Kernel modules: i2c_i801 00:1f.6 Signal processing controller [1180]: Intel Corporation 8 Series Thermal [8086:9c24] (rev 04) Subsystem: Google, Inc. 8 Series Thermal [1ae0:c000] 01:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 0c) Subsystem: Realtek Semiconductor Co., Ltd. RTL8111/8168 PCI Express Gigabit Ethernet controller [10ec:8168] Kernel driver in use: r8169 Kernel modules: r8169 02:00.0 Network controller [0280]: Qualcomm Atheros AR9462 Wireless Network Adapter [168c:0034] (rev 01) Subsystem: Hewlett-Packard Company AR9462 Wireless Network Adapter [103c:1864] Kernel driver in use: ath9k Kernel modules: ath9k
答案1
我知道这是一个非常老的问题,但如果有人仍然感兴趣,我有一个不错的解决方法 - 虽然仍然不是一个完整的解决方案。因为此补丁,Linux 有一个名为的命令行参数usbcore.quirks
,可以针对每个设备禁用 LPM。因此,如果您有一个已知的设备列表(由其 VID 和 PID 标识,即 所示的一对 4 位十六进制数字lsusb
),并且想要在没有 LPM 的情况下使用,请将以下内核参数添加到您的引导加载程序中:
usbcore.quirks=<vid1>:<pid1>:k,<vid2>:<pid2>,k
代表k
禁用 LPM,不要问我为什么。您可以列出任意数量的设备。对于问题中提到的特定 Lexar Media 闪存驱动器,添加usbcore.quirks=05dc:a838:k
- 它将应用于该设备的所有实例。