tree: beabaf43b842f1172be6dde42562b833ed3af198 [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. scoped_libusb_device_handle.cc
  19. scoped_libusb_device_handle.h
  20. scoped_libusb_device_ref.cc
  21. scoped_libusb_device_ref.h
  22. scoped_winusb_handle.cc
  23. scoped_winusb_handle.h
  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.