強制的にUSB接続を解除/再接続

強制的にUSB接続を解除/再接続

私の外付けハードドライブドックには、USBケーブルを接続することが最後の手順(ドライブの挿入、電源投入、接続など)である必要がある残念なインストール手順が必要です。

これでうまくいきましたが、ケーブルにアクセスするのは簡単ではなく、頻繁に接続して抜くとケーブルが損傷するのではないかと心配しました。

そこでUSBケーブルを接続した状態で機器の電源を入れてみました。時には動作しますが、時には動作しません。機能しない場合は、次のメッセージが表示されます(dmesg)。

[372734.412683] xhci_hcd 0000:00:14.0: Command completion event does not match command
[372734.412686] xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command
[372739.622686] xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command
[372739.826432] usb 3-5: device not accepting address 21, error -62

lsusb -v は以下を提供します。

Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.00
  bDeviceClass            9 Hub
  bDeviceSubClass         0 Unused
  bDeviceProtocol         3 
  bMaxPacketSize0         9
  idVendor           0x1d6b Linux Foundation
  idProduct          0x0003 3.0 root hub
  bcdDevice            4.02
  iManufacturer           3 Linux 4.2.0-0.bpo.1-amd64 xhci-hcd
  iProduct                2 xHCI Host Controller
  iSerial                 1 0000:00:14.0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           31
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         9 Hub
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0 Full speed (or root) hub
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval              12
        bMaxBurst               0
Hub Descriptor:
  bLength              12
  bDescriptorType      42
  nNbrPorts             6
  wHubCharacteristic 0x000a
    No power switching (usb 1.0)
    Per-port overcurrent protection
  bPwrOn2PwrGood       10 * 2 milli seconds
  bHubContrCurrent      0 milli Ampere
  bHubDecLat          0.0 micro seconds
  wHubDelay             0 nano seconds
  DeviceRemovable    0x00
 Hub Port Status:
   Port 1: 0000.02a0 5Gbps power Rx.Detect
   Port 2: 0000.02a0 5Gbps power Rx.Detect
   Port 3: 0000.02a0 5Gbps power Rx.Detect
   Port 4: 0000.02a0 5Gbps power Rx.Detect
   Port 5: 0000.02e0 5Gbps power Polling
   Port 6: 0000.02a0 5Gbps power Rx.Detect

だから私が正しく理解したなら、内部USBハブメモリにいくつかのエラーがあるのです。

それで、USBケーブルを操作せずに一種のリセットをシミュレートし、デバイスを再登録する方法があるかどうか疑問に思いました。

これは、たとえば機器のリモートインストールにも役立ちます。

ありがとう

ベストアンサー1

少し古いですが、答えが必要なので、他の場所で見つけました。

まず、エラーメッセージからハブデバイス名をコピーします。あなたに関する限り、0000:00:14.0

次に、ルートとして次のことを行います。

echo 0000:00:14.0 >> /sys/bus/pci/drivers/xhci_hcd/unbind
echo 0000:00:14.0 >> /sys/bus/pci/drivers/xhci_hcd/bind

まもなく:ハブがリセットされ、引き続き使用できます。

私は長年このエラーを処理してきました。これがカーネル問題かハードウェア問題かはわかりません(私の主な疑い)。しかし、少なくとも今はUSBハブをリセットするために再起動する必要はありません。

おすすめ記事