如何软删除 USB 端口?

如何软删除 USB 端口?

一个 USB 端口已映射到我想要释放的中断......

cat /proc/interrupts | grep 16:
16:         31          0          0          0          0          0          0          0  IR-IO-APIC  16-fasteoi   ehci_hcd:usb3

如何正确删除 ehci_hcd:usb3 设备?

root@blackserver:/sys/devices/pci0000:00/0000:00:1a.0/usb3# echo -n 1 > remove

出现错误“bash: echo: write error: Invalid param”,但 dmesg 输出显示“usb 3-1: USB disconnect, device number 2”,但设备仍在使用中断。这是错误还是我的方法错误?

编辑:

Bus 004 Device 002: ID 8087:8001 Intel Corp. 
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 8087:8009 Intel Corp. 
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 004: ID 2109:0812 VIA Labs, Inc. VL812 Hub
Bus 002 Device 003: ID 2109:0812 VIA Labs, Inc. VL812 Hub
Bus 002 Device 002: ID 174c:3074 ASMedia Technology Inc. ASM1074 SuperSpeed hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 001 Device 009: ID 045e:0745 Microsoft Corp. Nano Transceiver v1.0 for Bluetooth
Bus 001 Device 008: ID 046d:0826 Logitech, Inc. HD Webcam C525
Bus 001 Device 007: ID 2109:2812 VIA Labs, Inc. VL812 Hub
Bus 001 Device 006: ID 045e:02d1 Microsoft Corp. XBOX One Controller for Windows
Bus 001 Device 004: ID 2109:2812 VIA Labs, Inc. VL812 Hub
Bus 001 Device 003: ID 174c:2074 ASMedia Technology Inc. ASM1074 High-Speed hub
Bus 001 Device 002: ID 0b05:17cb ASUSTek Computer, Inc. Broadcom BCM20702A0 Bluetooth
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

编辑:所以我相信该设备本身是一个 ECHI 控制器,它被分配到总线 003 下。

kelvin@blackserver:~$ dmesg | grep :1a
[    0.178287] pci 0000:00:1a.0: [8086:8cad] type 00 class 0x0c0320
[    0.178310] pci 0000:00:1a.0: reg 0x10: [mem 0xefd3b000-0xefd3b3ff]
[    0.178369] pci 0000:00:1a.0: PME# supported from D0 D3hot D3cold
[    0.178403] pci 0000:00:1a.0: System wakeup disabled by ACPI
[    0.675933] DMAR: Setting identity map for device 0000:00:1a.0 [0xade98000 - 0xadea6fff]
[    0.676154] iommu: Adding device 0000:00:1a.0 to group 7
[    0.837462] ehci-pci 0000:00:1a.0: EHCI Host Controller
[    0.837481] ehci-pci 0000:00:1a.0: new USB bus registered, assigned bus number 3
[    0.837509] ehci-pci 0000:00:1a.0: debug port 2
[    0.842160] ehci-pci 0000:00:1a.0: cache line size of 64 is not supported
[    0.842174] ehci-pci 0000:00:1a.0: irq 16, io mem 0xefd3b000
[    0.853306] ehci-pci 0000:00:1a.0: USB 2.0 started, EHCI 1.00
[    0.857162] usb usb3: SerialNumber: 0000:00:1a.0

已解决:将命令移回上一级......

root@blackserver:/sys/devices/pci0000:00/0000:00:1a.0# echo -n 1 > remove

dmesg 现在输出...

[65207.355668] ehci-pci 0000:00:1a.0: remove, state 4
[65207.355680] usb usb3: USB disconnect, device number 1
[65207.355682] usb 3-1: USB disconnect, device number 2
[65207.360110] ehci-pci 0000:00:1a.0: USB bus 3 deregistered
[65207.475341] iommu: Removing device 0000:00:1a.0 from group 7

没有其他错误消息,并且 USB 控制器不再列在 lspci 中或 lsusb 中显示的设备中。

答案1

已解决:将命令移回上一级......

root@blackserver:/sys/devices/pci0000:00/0000:00:1a.0# echo -n 1 > remove

dmesg 现在输出...

[65207.355668] ehci-pci 0000:00:1a.0: remove, state 4
[65207.355680] usb usb3: USB disconnect, device number 1
[65207.355682] usb 3-1: USB disconnect, device number 2
[65207.360110] ehci-pci 0000:00:1a.0: USB bus 3 deregistered
[65207.475341] iommu: Removing device 0000:00:1a.0 from group 7

没有其他错误消息,并且 USB 控制器不再列在 lspci 中或 lsusb 中显示的设备中。

相关内容