tree: fbba137f4b5d43e729e8109e89d5d5648f18db08 [path history] [tgz]
  1. android/
  2. fuzz_corpus/
  3. mojo/
  4. public/
  5. tools/
  6. BUILD.gn
  7. DEPS
  8. fake_usb_device_handle.cc
  9. fake_usb_device_handle.h
  10. mock_usb_device.cc
  11. mock_usb_device.h
  12. mock_usb_device_handle.cc
  13. mock_usb_device_handle.h
  14. mock_usb_service.cc
  15. mock_usb_service.h
  16. OWNERS
  17. README.md
  18. usb_configuration_android.cc
  19. usb_configuration_android.h
  20. usb_context.cc
  21. usb_context.h
  22. usb_context_unittest.cc
  23. usb_descriptors.cc
  24. usb_descriptors.h
  25. usb_descriptors_fuzzer.cc
  26. usb_descriptors_unittest.cc
  27. usb_device.cc
  28. usb_device.h
  29. usb_device_android.cc
  30. usb_device_android.h
  31. usb_device_handle.cc
  32. usb_device_handle.h
  33. usb_device_handle_android.cc
  34. usb_device_handle_android.h
  35. usb_device_handle_impl.cc
  36. usb_device_handle_impl.h
  37. usb_device_handle_unittest.cc
  38. usb_device_handle_usbfs.cc
  39. usb_device_handle_usbfs.h
  40. usb_device_handle_win.cc
  41. usb_device_handle_win.h
  42. usb_device_impl.cc
  43. usb_device_impl.h
  44. usb_device_linux.cc
  45. usb_device_linux.h
  46. usb_device_win.cc
  47. usb_device_win.h
  48. usb_endpoint_android.cc
  49. usb_endpoint_android.h
  50. usb_error.cc
  51. usb_error.h
  52. usb_ids.cc
  53. usb_ids.h
  54. usb_ids_unittest.cc
  55. usb_interface_android.cc
  56. usb_interface_android.h
  57. usb_service.cc
  58. usb_service.h
  59. usb_service_android.cc
  60. usb_service_android.h
  61. usb_service_impl.cc
  62. usb_service_impl.h
  63. usb_service_linux.cc
  64. usb_service_linux.h
  65. usb_service_unittest.cc
  66. usb_service_win.cc
  67. usb_service_win.h
  68. usb_string_read_fuzzer.cc
  69. webusb_descriptors.cc
  70. webusb_descriptors.h
  71. webusb_descriptors_fuzzer.cc
  72. webusb_descriptors_unittest.cc
device/usb/README.md

USB

device/usb abstracts Universal Serial Bus concepts across multiple platforms.

Clients should use the public Mojo interface.

USB ID Repository

/third_party/usb_ids/usb.ids is imported regularly to provide human-readable descriptions of USB devices.

Ongoing Work transitioning away from libusb

UsbService is implemented by UsbServiceImpl based on third_party/libusb.

Work is ongoing to implement each platform directly, without using libusb.

  • UsbServiceAndroid done.
  • UsbServiceLinux done.
  • macOS not started.
  • UsbServiceWin in progress. Enable via chrome://flags/#new-usb-backend

Testing

Unit Tests

Standard use of *_unittest.cc files for must code coverage.

Fuzzers

libFuzzer tests are in *_fuzzer.cc files. They test for bad input from devices, e.g. when parsing device descriptors during device enumeration.

Gadget Tests

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.