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