USB: comprehensive xhcid drivers.toml — all 7 class drivers

Cross-referenced with Linux 7.1 drivers/usb/core/driver.c:usb_device_match().

xhcid already has a built-in event-driven hotplug system:
attach_device() → spawn_drivers() reads the embedded drivers.toml
at enumeration time and spawns matching class drivers.  This is
equivalent to Linux's hub_port_connect() → usb_new_device() →
device_add() → driver binding.

Extended drivers.toml from 2 entries (hub + HID) to 7 entries
covering all Red Bear USB class drivers:

  class=8 subclass=6  → usbscsid    (was commented out: "causes XHCI errors")
  class=9             → usbhubd
  class=3             → usbhidd
  class=2 subclass=2  → redbear-acmd   (CDC ACM)
  class=2 subclass=6  → redbear-ecmd   (CDC ECM)
  class=1             → redbear-usbaudiod (USB Audio)
  class=255           → redbear-ftdi   (FTDI serial)

Drivers receive , , / template args.
Subclass matching: exact match (2,6) or wildcard (-1 = any).

This eliminates the need for a separate userspace hotplug daemon —
xhcid's event-driven attach_device() path provides interrupt-level
hotplug response (not polling-based).  Linux 7.1 equivalence:
hub_irq() → port_event() → hub_port_connect_change() →
hub_port_connect() → usb_new_device() → device_add() → driver probe.
This commit is contained in:
Red Bear OS
2026-07-07 16:40:41 +03:00
parent ea2219148e
commit 7efa83d6bd
+43 -9
View File
@@ -1,18 +1,52 @@
#TODO: causes XHCI errors
#[[drivers]]
#name = "SCSI over USB"
#class = 8 # Mass Storage class
#subclass = 6 # SCSI transparent command set
#command = ["usbscsid", "$SCHEME", "$PORT", "$IF_PROTO"]
# xhcid built-in USB class driver configuration.
# Cross-referenced with Linux 7.1 drivers/usb/core/driver.c:usb_device_match().
#
# Drivers are spawned by xhcid's attach_device() after device enumeration
# completes (dev_desc available, port_state populated). For each interface
# on the device, xhcid matches class+subclass against this table and spawns
# the corresponding driver with $SCHEME / $PORT / $IF_NUM / $IF_PROTO
# template variables.
#
# subclass = -1 means "match any subclass" (wildcard).
[[drivers]]
name = "USB HUB"
class = 9 # HUB class
name = "USB Mass Storage"
class = 8
subclass = 6 # SCSI transparent command set
command = ["usbscsid", "$SCHEME", "$PORT", "$IF_PROTO"]
[[drivers]]
name = "USB Hub"
class = 9
subclass = -1
command = ["usbhubd", "$SCHEME", "$PORT", "$IF_NUM"]
[[drivers]]
name = "USB HID"
class = 3 # HID class
class = 3
subclass = -1
command = ["usbhidd", "$SCHEME", "$PORT", "$IF_NUM"]
[[drivers]]
name = "USB CDC ACM"
class = 2
subclass = 2 # Abstract Control Model
command = ["redbear-acmd", "$SCHEME", "$PORT", "$IF_NUM"]
[[drivers]]
name = "USB CDC ECM"
class = 2
subclass = 6 # Ethernet Control Model
command = ["redbear-ecmd", "$SCHEME", "$PORT", "$IF_NUM"]
[[drivers]]
name = "USB Audio Class"
class = 1
subclass = -1
command = ["redbear-usbaudiod", "$SCHEME", "$PORT", "$IF_NUM"]
[[drivers]]
name = "FTDI USB Serial"
class = 255 # Vendor-specific
subclass = -1
command = ["redbear-ftdi", "$SCHEME", "$PORT", "$IF_NUM"]