人们之所以发布这样的问题,是由于令人恐惧的-确实是“ EVIL ”-USB Auto-Suspend“ 功能 ”。
自动挂起将关闭“空闲” USB设备的电源,除非该设备的驱动程序正确支持此功能,否则该设备可能无法连接。因此,打开/关闭USB端口的电源是问题的征兆,而不是问题本身。
我将向您展示如何全局禁用自动挂起,而无需手动打开和关闭USB端口:
简短答案:
你不需要编辑“ autosuspend_delay_ms ”独立:USB autosuspend可全局和禁用持续使用下面的命令:
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="/&usbcore.autosuspend=-1 /' /etc/default/grub
update-grub
systemctl reboot
在“长答案”的结尾处是一个Ubuntu 18.04屏幕截图,它说明了如何实现我的结果。
长答案:
确实,USB Power Management Kernel Documentation(USB电源管理内核文档)指出autosuspend已被弃用,而在原来的位置“ autosuspend_delay_ms ”用于禁用USB autosuspend:
"In 2.6.38 the "autosuspend" file will be deprecated
and replaced by the "autosuspend_delay_ms" file."
无论其我的测试显示设置usbcore.autosuspend=-1中的/ etc /默认/ grub中,如下可以作为一个全球切换为USB autosuspend functionality-你就不要需要编辑个人“ autosuspend_delay_ms ”文件。
上面链接的同一文档指出,值“ 0”已启用,而负值已禁用:
power/autosuspend_delay_ms
0 means to autosuspend
as soon as the device becomes idle, and negative
values mean never to autosuspend. You can write a
number to the file to change the autosuspend
idle-delay time.
在下面带注释的Ubuntu 18.04屏幕截图中,说明了如何实现我的结果(并且可重复),请在autosuspend_delay_ms中将默认值标记为“ 0”(启用)。
然后请注意,仅usbcore.autosuspend=-1在Grub中设置后,重新启动后这些值现在为负(禁用)。这将使我免于编辑各个值的麻烦,并且现在可以编写脚本来禁用USB自动挂起。
希望这可以使禁用USB自动暂停功能更加轻松,并且可以编写更多脚本,