Arch-Linux

拔下 USB C 埠後無法使用(直到重新啟動)

  • July 19, 2020

我在筆記型電腦上使用帶有集成 SD 卡插槽以及音頻、乙太網、VGA 和 HDMI 埠的USB C 集線器。通常(我感覺大約有 30% 的時間),在拔掉它之後,直到我重新啟動它才再次被辨識。插入時甚至dmesg什麼都沒有顯示。我發現每次拔出失敗時,都會出現以下幾行dmesg

[33177.368938] xhci_hcd 0000:01:00.0: xHCI host not responding to stop endpoint command.
[33177.369008] xhci_hcd 0000:01:00.0: xHCI host controller not responding, assume dead
[33177.369037] xhci_hcd 0000:01:00.0: HC died; cleaning up
[33177.369197] xhci_hcd 0000:01:00.0: Timeout while waiting for configure endpoint command

重新啟動後,它再次工作了一段時間。

**有沒有辦法可以在不重新啟動的情況下重置 USB 埠?**或者更好的是,**您完全知道可能的修復/解決方法嗎?**我不怕做一些更深入的探勘,如果你能告訴我一個指南(我顯然不知道自己研究這個的正確關鍵字)。


一些系統資訊:

$ uname -a
Linux ws-arch-tux 5.4.50-1-lts #1 SMP Wed, 01 Jul 2020 14:53:03 +0000 x86_64 GNU/Linux
$ lsb_release -a
LSB Version:    1.4
Distributor ID: Arch
Description:    Arch Linux
Release:        rolling
Codename:       n/a

完整(我希望)外掛輸出dmesg(包括連接的滑鼠和鍵盤):

[  994.664432] usb 4-1: new SuperSpeed Gen 1 USB device number 4 using xhci_hcd
[  994.715431] usb 4-1: New USB device found, idVendor=05e3, idProduct=0626, bcdDevice=62.02
[  994.715433] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  994.715434] usb 4-1: Product: USB3.1 Hub
[  994.715435] usb 4-1: Manufacturer: GenesysLogic
[  994.719009] hub 4-1:1.0: USB hub found
[  994.720994] hub 4-1:1.0: 4 ports detected
[  994.853652] usb 3-1: new high-speed USB device number 8 using xhci_hcd
[  995.051420] usb 3-1: New USB device found, idVendor=05e3, idProduct=0610, bcdDevice=62.02
[  995.051425] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  995.051428] usb 3-1: Product: USB2.1 Hub
[  995.051431] usb 3-1: Manufacturer: GenesysLogic
[  995.056085] hub 3-1:1.0: USB hub found
[  995.057415] hub 3-1:1.0: 4 ports detected
[  995.143947] usb 4-1.1: new SuperSpeed Gen 1 USB device number 5 using xhci_hcd
[  995.193083] usb 4-1.1: New USB device found, idVendor=0bda, idProduct=8153, bcdDevice=31.00
[  995.193089] usb 4-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=6
[  995.193093] usb 4-1.1: Product: USB 10/100/1000 LAN
[  995.193096] usb 4-1.1: Manufacturer: Realtek
[  995.193098] usb 4-1.1: SerialNumber: 001000001
[  995.314306] usb 4-1.1: reset SuperSpeed Gen 1 USB device number 5 using xhci_hcd
[  995.473646] usb 3-1.1: new high-speed USB device number 9 using xhci_hcd
[  995.509080] r8152 4-1.1:1.0 eth0: v1.10.11
[  995.557403] r8152 4-1.1:1.0 enp1s0u1u1: renamed from eth0
[  995.643965] usb 3-1.1: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.00
[  995.643966] usb 3-1.1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[  995.643967] usb 3-1.1: Product: USB2.0 HUB
[  995.645494] hub 3-1.1:1.0: USB hub found
[  995.645533] hub 3-1.1:1.0: 4 ports detected
[  995.773595] usb 3-1.2: new low-speed USB device number 10 using xhci_hcd
[  996.015277] usb 3-1.2: New USB device found, idVendor=046d, idProduct=c31c, bcdDevice=64.00
[  996.015282] usb 3-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  996.015285] usb 3-1.2: Product: USB Keyboard
[  996.015288] usb 3-1.2: Manufacturer: Logitech
[  996.024006] input: Logitech USB Keyboard as /devices/pci0000:00/0000:00:1c.0/0000:01:00.0/usb3/3-1/3-1.2/3-1.2:1.0/0003:046D:C31C.0005/input/input29
[  996.094376] hid-generic 0003:046D:C31C.0005: input,hidraw0: USB HID v1.10 Keyboard [Logitech USB Keyboard] on usb-0000:01:00.0-1.2/input0
[  996.100244] input: Logitech USB Keyboard Consumer Control as /devices/pci0000:00/0000:00:1c.0/0000:01:00.0/usb3/3-1/3-1.2/3-1.2:1.1/0003:046D:C31C.0006/input/input30
[  996.173867] input: Logitech USB Keyboard System Control as /devices/pci0000:00/0000:00:1c.0/0000:01:00.0/usb3/3-1/3-1.2/3-1.2:1.1/0003:046D:C31C.0006/input/input31
[  996.174091] hid-generic 0003:046D:C31C.0006: input,hidraw1: USB HID v1.10 Device [Logitech USB Keyboard] on usb-0000:01:00.0-1.2/input1
[  996.203586] usb 3-1.1.1: new full-speed USB device number 11 using xhci_hcd
[  996.512524] usb 3-1.1.1: New USB device found, idVendor=1b3f, idProduct=2008, bcdDevice= 1.00
[  996.512525] usb 3-1.1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  996.512526] usb 3-1.1.1: Product: USB Audio Device
[  996.512527] usb 3-1.1.1: Manufacturer: GeneralPlus
[  996.526911] input: GeneralPlus USB Audio Device as /devices/pci0000:00/0000:00:1c.0/0000:01:00.0/usb3/3-1/3-1.1/3-1.1.1/3-1.1.1:1.3/0003:1B3F:2008.0007/input/input32
[  996.593956] hid-generic 0003:1B3F:2008.0007: input,hidraw2: USB HID v2.01 Device [GeneralPlus USB Audio Device] on usb-0000:01:00.0-1.1.1/input3
[  996.793698] usb 3-1.1.2: new low-speed USB device number 12 using xhci_hcd
[  997.103766] usb 3-1.1.2: New USB device found, idVendor=046d, idProduct=c077, bcdDevice=72.00
[  997.103771] usb 3-1.1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  997.103775] usb 3-1.1.2: Product: USB Optical Mouse
[  997.103778] usb 3-1.1.2: Manufacturer: Logitech
[  997.108047] input: Logitech USB Optical Mouse as /devices/pci0000:00/0000:00:1c.0/0000:01:00.0/usb3/3-1/3-1.1/3-1.1.2/3-1.1.2:1.0/0003:046D:C077.0008/input/input33
[  997.108763] hid-generic 0003:046D:C077.0008: input,hidraw3: USB HID v1.11 Mouse [Logitech USB Optical Mouse] on usb-0000:01:00.0-1.1.2/input0
[  997.303643] usb 3-1.1.3: new high-speed USB device number 13 using xhci_hcd
[  997.547453] usb 3-1.1.3: New USB device found, idVendor=05e3, idProduct=0751, bcdDevice=14.04
[  997.547457] usb 3-1.1.3: New USB device strings: Mfr=3, Product=4, SerialNumber=0
[  997.547461] usb 3-1.1.3: Product: USB Storage
[  997.547463] usb 3-1.1.3: Manufacturer: USB Storage
[  997.551294] usb-storage 3-1.1.3:1.0: USB Mass Storage device detected
[  997.551541] scsi host3: usb-storage 3-1.1.3:1.0
[  998.565178] scsi 3:0:0:0: Direct-Access     Generic  STORAGE DEVICE   1404 PQ: 0 ANSI: 6
[  998.565844] sd 3:0:0:0: Attached scsi generic sg2 type 0
[  998.795068] sd 3:0:0:0: [sdc] Attached SCSI removable disk

完全拔出/故障輸出dmesg

[33171.844814] usb 3-1: USB disconnect, device number 8
[33171.844821] usb 3-1.1: USB disconnect, device number 9
[33171.844825] usb 3-1.1.1: USB disconnect, device number 11
[33171.932552] r8152 4-1.1:1.0 enp1s0u1u1: Stop submitting intr, status -71
[33172.009610] usb 3-1.1.2: USB disconnect, device number 12
[33172.170046] usb 3-1.1.3: USB disconnect, device number 13
[33172.668961] usb 4-1: USB disconnect, device number 4
[33172.668966] usb 4-1.1: USB disconnect, device number 5
[33177.368938] xhci_hcd 0000:01:00.0: xHCI host not responding to stop endpoint command.
[33177.369008] xhci_hcd 0000:01:00.0: xHCI host controller not responding, assume dead
[33177.369037] xhci_hcd 0000:01:00.0: HC died; cleaning up
[33177.369197] xhci_hcd 0000:01:00.0: Timeout while waiting for configure endpoint command
[33177.370176] usb 3-1.2: USB disconnect, device number 10

SlightResult指出了關於r/linuxquestions的解決方法:https ://www.reddit.com/r/linuxquestions/comments/htwo8n/usb_c_port_becomes_unusable_after_unplugging/fyjwk2p

作為根:

cd /sys/bus/pci/drivers/xhci_hcd
echo 0000:01:00.0 > unbind
echo 0000:01:00.0 > bind

它從驅動程序中刪除 PCI 設備(USB 控制器)並將其添加回來。

非常感謝SlightResult

如果您閱讀了本文並有其他資訊要填寫,請隨時分享!

引用自:https://unix.stackexchange.com/questions/598094