/xhci_hcd-rebind

A service for monitoring xhci_hcd bus, restart if bus failure

Primary LanguageRustGNU General Public License v3.0GPL-3.0

xhci_hcd-rebind

Users should migrate to journald-broker

This software is created to temporarily fix the error of "USB 3.0 to ethernet adapter" on xhci_hcd bus.

The example of error message:
[ 1179.475926] kernel: xhci_hcd 0000:04:00.0: WARN: TRB error for slot 1 ep 5 on endpoint
[ 1179.607026] kernel: xhci_hcd 0000:04:00.0: WARN waiting for error on ep to be cleared
[ 1179.607049] kernel: xhci_hcd 0000:04:00.0: WARN waiting for error on ep to be cleared
[ 1179.607054] kernel: xhci_hcd 0000:04:00.0: WARN waiting for error on ep to be cleared
[ 1179.607058] kernel: xhci_hcd 0000:04:00.0: WARN waiting for error on ep to be cleared

When these errors occur, the device stop functioning until reconnect or rebind. This software will automatically detect these error messages and then rebind the device.

Disclaimer

🔥
DO NOT USE THIS SOFTWARE FOR ANY STORAGE DEVICES THAT CONNECT TO XHCI_HCD BUS. This software is meant for temporary solution to the problem of "USB 3.0 to ethernet adapter" on xhci_hcd bus only.

Installation

Arch Linux

To build and install arch package from GIT source:

$ git clone https://github.com/bpetlert/xhci_hcd-rebind.git
$ cd xhci_hcd-rebind
$ makepkg -p PKGBUILD.local
$ pacman -U xhci_hcd-rebind-x.x.x.rx.gxxxxxxx-1-x86_64.pkg.tar.zst

Then enable/start xhci_hcd-rebind.service

$ systemctl enable xhci_hcd-rebind.service
$ systemctl start xhci_hcd-rebind.service

Configuration

The configuration is placed in /etc/systemd/xhci_hcd-rebind.toml file.

Example of configurations
# Use `lspci -kD` to find bus id of xhci_pci
# e.g.
#   ...
#   0000:04:00.0 USB controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 04)
#           Subsystem: Dell Device 0446
#           Kernel driver in use: xhci_hcd
#           Kernel modules: xhci_pci
#   ...
#
bus-id = "0000:04:00.0"

# Bus rebind delay (seconds)
#
# bus-rebind-delay = 3

# Next bus fail check delay (seconds)
#
# next-fail-check-delay = 300

# Script to run once after bus failure is found (run before unbind bus)
#
# pre-unbind-script = "/usr/local/bin/xhci_hcd-rebind-sysinfo.sh"

# Script to run once after rebind bus
#
# post-rebind-script = ""

The bus-id is required, other settings are optional.

License