device/usb abstracts Universal Serial Bus concepts across multiple platforms.
Clients should use the public Mojo interface.
/third_party/usb_ids/usb.ids is imported regularly to provide human-readable descriptions of USB devices.
libusbUsbService is implemented by UsbServiceImpl based on third_party/libusb.
Work is ongoing to implement each platform directly, without using libusb.
UsbServiceAndroid done.UsbServiceLinux done.UsbServiceWin in progress. Enable via chrome://flags/#new-usb-backendStandard use of *_unittest.cc files for must code coverage.
libFuzzer tests are in *_fuzzer.cc files. They test for bad input from devices, e.g. when parsing device descriptors during device enumeration.
USB/HID API Testing with Gadgets describes a framework for testing the Chrome USB, HID and serial device APIs with real devices on generally accessible hardware.
Unit tests using the gadget can be run manually with a hardware “gadget”. These unit tests all call UsbTestGadget::Claim.