tree: 9dbda30959551616cd78774c1a1b9c5d24859647 [path history] [tgz]
  1. meta/
  2. BUILD.gn
  3. driver.cc
  4. driver.h
  5. README.md
  6. test.cc
  7. tests.json
  8. usb-peripheral-test-info.json
  9. usb_peripheral_test.bind
src/devices/usb/drivers/usb-peripheral-test/README.md

USB Peripheral Test

Overview

This directory contains a test for USB peripheral role functionality in Zircon. It consists of two parts - a Zircon USB function driver and a Linux host test program. The host test (called usb-peripheral-test) tests control requests in both the IN and OUT direction with various payload sizes, receiving data on an interrupt endpoint and finally bulk transfers.

How to Run

DEPRECATED: hikey960 no longer supported

First of all, this test only works with devices that implement USB peripheral role functionality. The hikey960 board is one of those devices, so here we assume you are using a hikey960 board. To run the test, follow these steps:

  1. Connect the Hikey USB-C port to your Linux desktop

  2. In the Hikey's shell, switch to USB peripheral mode and enable the test driver:

usbctl mode peripheral
usbctl peripheral reset
usbctl peripheral init-test
  1. Run the host test:
out/default/host_x64/usb-peripheral-test

If the test succeeds, you should see something like:

CASE usb_peripheral_tests                               [STARTED]
    control_interrupt_test_8                            [RUNNING] [PASSED] (36 ms)
    control_interrupt_test_64                           [RUNNING] [PASSED] (31 ms)
    control_interrupt_test_100                          [RUNNING] [PASSED] (31 ms)
    control_interrupt_test_256                          [RUNNING] [PASSED] (31 ms)
    control_interrupt_test_1000                         [RUNNING] [PASSED] (31 ms)
    bulk_test                                           [RUNNING] [PASSED] (19 ms)
CASE usb_peripheral_tests                               [PASSED]

TODO

Update these instructions to use a different device

Future versions of this test may include:

  • isochronous transfers
  • setting and clearing stall conditions