tree: b9225db0e7a0c28410c858fe44ad4c3fe30aada4 [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_winusb_handle.cc
  18. scoped_winusb_handle.h
  19. tools/
  20. usb_configuration_android.cc
  21. usb_configuration_android.h
  22. usb_context.cc
  23. usb_context.h
  24. usb_context_unittest.cc
  25. usb_descriptors.cc
  26. usb_descriptors.h
  27. usb_descriptors_fuzzer.cc
  28. usb_descriptors_unittest.cc
  29. usb_device.cc
  30. usb_device.h
  31. usb_device_android.cc
  32. usb_device_android.h
  33. usb_device_handle.cc
  34. usb_device_handle.h
  35. usb_device_handle_android.cc
  36. usb_device_handle_android.h
  37. usb_device_handle_impl.cc
  38. usb_device_handle_impl.h
  39. usb_device_handle_unittest.cc
  40. usb_device_handle_usbfs.cc
  41. usb_device_handle_usbfs.h
  42. usb_device_handle_win.cc
  43. usb_device_handle_win.h
  44. usb_device_impl.cc
  45. usb_device_impl.h
  46. usb_device_linux.cc
  47. usb_device_linux.h
  48. usb_device_win.cc
  49. usb_device_win.h
  50. usb_endpoint_android.cc
  51. usb_endpoint_android.h
  52. usb_error.cc
  53. usb_error.h
  54. usb_ids.cc
  55. usb_ids.h
  56. usb_ids_unittest.cc
  57. usb_interface_android.cc
  58. usb_interface_android.h
  59. usb_service.cc
  60. usb_service.h
  61. usb_service_android.cc
  62. usb_service_android.h
  63. usb_service_impl.cc
  64. usb_service_impl.h
  65. usb_service_linux.cc
  66. usb_service_linux.h
  67. usb_service_unittest.cc
  68. usb_service_win.cc
  69. usb_service_win.h
  70. usb_string_read_fuzzer.cc
  71. webusb_descriptors.cc
  72. webusb_descriptors.h
  73. webusb_descriptors_fuzzer.cc
  74. 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.