Repository navigation
Read FreeBSD USB devices from devinfo -v instead of lshal - #3826
Conversation
getUsbDevices() on FreeBSD parsed lshal, which went with HAL and is absent from current FreeBSD, so it returned nothing. devinfo -v prints the same device tree without privileges. The tree comes from the indentation. A usbus node's parent is the controller, whose children become the root hub and what hangs from it, the shape the lshal code built. A device's name is its description less the ", class ..." suffix, its IDs come from vendor= and product= (or device= for a PCI controller), and its serial from sernum=. A USB device is listed once per interface driver, each with the same ugen= location field, which identifies the device. Drivers beneath a device that have no ugen name of their own, such as a HID bus, are not USB devices and are left out. Verified on cfarm430 (FreeBSD 16.0-CURRENT) in both backends: eight controllers with their root hubs and QEMU's tablet with its serial. The Arm Morello board (cfarm240) has no JDK; its devinfo output, a BeagleBone Black behind XHCI listed under three interface drivers, is the test fixture.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📜 Recent review details
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
DragonFly's hardware layer extends FreeBSD's and so reads USB devices with FreeBsdUsbDevice, which oshi#3826 moved to devinfo -v. FreeBSD's devinfo prints a <description> on each line; DragonFly's prints none: uhci0 pnpinfo vendor=0x8086 device=0x7020 ... at slot=1 function=2 usbus0 uhub0 so every DragonFly USB device had a blank name, failing UsbDeviceTest in the DragonFly job of Unix CI on master. Where there is no description, name the device by its driver instance (uhci0, uhub0), which devinfo always prints. The fixture is DragonFly 6.4.2's devinfo -v from CI. Unix CI dispatched on the fork for this branch passes on all six VMs, DragonFly included.
…3830) DragonFly's hardware layer extends FreeBSD's and so reads USB devices with FreeBsdUsbDevice, which #3826 moved to devinfo -v. FreeBSD's devinfo prints a <description> on each line; DragonFly's prints none: uhci0 pnpinfo vendor=0x8086 device=0x7020 ... at slot=1 function=2 usbus0 uhub0 so every DragonFly USB device had a blank name, failing UsbDeviceTest in the DragonFly job of Unix CI on master. Where there is no description, name the device by its driver instance (uhci0, uhub0), which devinfo always prints. The fixture is DragonFly 6.4.2's devinfo -v from CI. Unix CI dispatched on the fork for this branch passes on all six VMs, DragonFly included.
getUsbDevices()on FreeBSD parsedlshal. That tool went away with HAL and isn't present on current FreeBSD, so the method returned nothing. Neither cfarm430 (16.0-CURRENT) nor the Arm Morello board (cfarm240) haslshal, and the report's USB section was empty on both.Change
devinfo -vprints the same device tree, and needs no privileges:usbusnode's parent becomes the controller, and the root hub and devices hang beneath it. That's the same shape thelshalcode produced., class ...suffix. Its IDs come fromvendor=andproduct=, ordevice=for a PCI controller, and its serial number fromsernum=.ugen=location field. That field identifies the device, so it appears once, and it serves as the unique device ID.ugenname of their own, such as a tablet'sHID busandhmsmouse driver, aren't USB devices and are left out.Verification
On cfarm430 (FreeBSD 16.0-CURRENT VM), both backends:
That device is shown along with seven other controllers and their root hubs. Before this change, the list was empty.
The Morello board has no JDK, so its real
devinfo -voutput is the test fixture: one BeagleBone Black with vendor1d6b, product0104, serial1234BBBK5678and IDugen0.2, though three interface drivers list it. Other fixtures cover controllers with only root hubs, the tablet's child drivers, and PCI functions without a driver, whichdevinfonamesunknown.Limits
devinfogives one description combining manufacturer and product, so the vendor-name field is now empty.lshalused to supply it separately.devinfo. Onlyusbconfiglists those, and it needs root.FreeBsdSoundCardalso readslshal, and is left for a separate change, because no machine available to me has a FreeBSD sound device to test against.Summary by CodeRabbit