Commit Graph

46 Commits (feature-hal-spec-usb-device)

Author SHA1 Message Date
Russ Butler f8864ae307 Applied suggested astyle fixes 2019-01-29 15:45:18 -06:00
Russ Butler 5867e99bc9 Remove inclusion of mbed.h from USB
Remove mbed.h from USB files and fix the build errors this causes.
This is required to pass CI.
2019-01-29 15:31:24 -06:00
Filip Jagodzinski da3b4a9036 Tests: USB: Use astyle to format the test class 2019-01-29 12:27:34 -06:00
Filip Jagodzinski 9ba3df4c30 Tests: USB: Fix 'endpoint halt' test
Abort all endpoint transfers before running the test again.
Use an updated vendor request to explicitly restart device reads.
2019-01-29 12:27:34 -06:00
Filip Jagodzinski 20de382939 Tests: USB: Add a README for Linux users
Explain how to overcome xHCI limitations in kernels prior to v4.17 and
successfully run USB tests.
2019-01-29 12:27:33 -06:00
Filip Jagodzinski aab52fc2a6 Tests: USB: DTR fix for Linux hosts
A DTR line is used to signal that the host has configured a terminal and
is ready to transmit and receive data from the USB CDC/Serial device.
When this test suite is run with the use of a Linux host, a workaround has
to be used to overcome some platform specific DTR line behavior.
Every time the serial port file descriptor is opened, the DTR line is
asserted until the terminal attributes are set.
As a consequence, the device receives a premature DTR signal with a
duration of 200-500 us before the correct, long-lasting DTR signal set by
the host-side test script. (tested on the Linux kernel 4.15.0)

The solution is to wait for the first DTR spike, ignore it, and wait for
the correct DTR signal again.
2019-01-29 12:27:32 -06:00
Russ Butler 23f43ecd58 Remove USB disconnect delay from Serial test
Remove the USB disconnect delay since there is no reason this is
needed. Failures which occur without this indicate a device or host
problem.
2019-01-29 12:27:32 -06:00
Russ Butler 869003ccab Tests: USB: Remove TX_DELAY_MS from serial test
Remove TX_DELAY_MS and all the places it was called since it is not
needed when DTR flow control is used.
2019-01-29 12:27:32 -06:00
Filip Jagodzinski 13ab89337e Tests: USB: Increas the size of RX CDC test data
This ensures the flow control is tested.
2019-01-29 12:27:32 -06:00
Filip Jagodzinski 9387165f8c Tests: USB: Update code comments 2019-01-29 12:27:32 -06:00
Filip Jagodzinski 7684ffd8b9 Tests: USB: Use SN generated by the host machine 2019-01-29 12:27:32 -06:00
Filip Jagodzinski 8801d20fde Tests: USB: Correct reconnect delay
Setting to 1 ms to be on the safe side. The USB spec defines this delay
to be at least 200 us.
2019-01-29 12:27:32 -06:00
Filip Jagodzinski ffaa050a89 Tests: USB: Wait before transmitting data to host
Despite having ECHO and ECHOCTL POSIX lflags disabled by default by
pyserial, a delay is needed for host to properly handle data received
from USB serial/CDC device.
With no delay host would echo 0x00-0x31 characters prefixed with '^'.
2019-01-29 12:27:31 -06:00
Filip Jagodzinski 0f5c285182 Tests: USB: Add Serial test for line coding change 2019-01-29 12:27:31 -06:00
Filip Jagodzinski 30af468d86 Tests: USB: Use the serial number to find device
Use the USB device SN instead of VID & PID to find the device port name
on the host system.
2019-01-29 12:27:31 -06:00
Filip Jagodzinski 9bbbe28796 Tests: USB: Fix USB reconnect tests for Win hosts 2019-01-29 12:27:31 -06:00
Filip Jagodzinski 776167a55f Tests: USB: Add tests for Serial class. 2019-01-29 12:27:31 -06:00
Filip Jagodzinski ba44260fe7 Tests: USB: Add tests for CDC class. 2019-01-29 12:27:31 -06:00
Filip Jagodzinski ea52de6886 Tests: USB: Check ep buffer is released by abort
Validate that endpoint buffer is not used after a transfer has been
aborted.
2019-01-29 12:27:31 -06:00
Filip Jagodzinski 57a35d3e83 Tests: USB: Decrease the max data size for iso ep
Although the USB spec sets the upper limit on FS isochronous endpoint
payloads to 1023 B, this value is hard to test in practice. Moreover,
not all the targets Mbed OS supports (like NUCLEO_F207ZG) are able to
handle all the endpoints set to max.
2019-01-29 12:27:30 -06:00
Russ Butler e1efa8d3e9 Update test to restart reads after unstall
After an endpoint is unstalled any pending transfers are terminated.
This patch re-starts any reads that were ongoing.
2019-01-29 12:27:30 -06:00
Filip Jagodzinski e55142a044 Tests: USB: Update ep callbacks
Endpoint callbacks no longer have endpoint as a param. This update was
introduced in #7267.
2019-01-29 12:27:30 -06:00
Filip Jagodzinski 5b70a263b6 Tests: USB: Add data toggle test 2019-01-29 12:27:30 -06:00
Filip Jagodzinski aad645312d Tests: USB: Update endpoint tests
Fix the host script issues present on Windows machines.
Add 0 B payload size to bulk endpoints test.
Update halt and abort tests according to PR comments.
Add an explicit request to start reading on OUT endpoints.
2019-01-29 12:27:30 -06:00
Filip Jagodzinski d83aa3e80e Tests: USB: Generic: Update documentation 2019-01-29 12:27:30 -06:00
Filip Jagodzinski caaedd50d6 Tests: USB: Generic: Add basic endpoint tests 2019-01-29 12:27:30 -06:00
Filip Jagodzinski b822fbe10d Tests: USB: Add device config files for Zadig
Zadig is a tool used to install generic USB drivers on Windows machines.
These drivers are necessary to run USB device test suite on Windows
hosts.
2019-01-29 12:27:29 -06:00
Russ Butler ddc27cb821 Remove endpoint parameter from USB callbacks
Remove the endpoint parameter from endpoint callbacks. This
information is redundant because endpoints are known at
construction time because they must be in the configuration
descriptor.
2019-01-29 12:27:29 -06:00
Russ Butler 6688857247 Fix various USB warnings
Fix the following warnings:
-[Warning] USBTester.cpp@45,0:  #1299-D: members and base-classes will
    be initialized in declaration order, not in member initialisation
    list order
-[Warning] USBTester.h@41,0:  #1300-D: ~USBTester inherits implicit
    virtual
-[Warning] USBAudio.cpp@345,0:  #1035-D: single-precision operand
    implicitly converted to double-precision
-[Warning] USBHID.cpp@29,0:  #1300-D: ~AsyncSend inherits implicit
    virtual
-[Warning] USBHID.cpp@61,0:  #1300-D: ~AsyncRead inherits implicit
    virtual
-[Warning] USBHID.cpp@93,0:  #1300-D: ~AsyncWait inherits implicit
    virtual
-[Warning] EndpointResolver.cpp@125,26: '<<' in boolean context, did
    you mean '<' ? [-Wint-in-bool-context]
2019-01-29 12:27:28 -06:00
Maciej Bocianski 6959485857 USB basic test documentation update 2019-01-29 12:27:27 -06:00
Maciej Bocianski 8df154bfe5 USB basic test update
disable suspend/resume test
disable sync frame test
improve reset test
2019-01-29 12:27:26 -06:00
Maciej Bocianski 1d82a78bed Update usb test to connect and block itself
Update the basic usb test so it does blocking itself since blocking
connect was removed from USBDevice.
2019-01-29 12:27:26 -06:00
Russ Butler f1c21c1796 Fix typo in USBTester.h
Fix the spelling of product_release.
2019-01-29 12:27:26 -06:00
Maciej Bocianski 54f21c3526 Extend USB test class configuration 2019-01-29 12:27:25 -06:00
Russ Butler af5c99d5c1 Explicitly specify USBPhy used for testing
Add a parameter to the USBPhy class so mock or wrapper USBPhy classes
can be used.
2019-01-29 12:27:25 -06:00
Russ Butler da46ea2b9c Make USB disconnect + connect time explicit
Create the define MIN_DISCONNECT_TIME_US to be used as the amount of
time that must pass between connect and disconnect for the host to
reliably detect reconnection. Replace the wait calls delaying for this
value to wait_us to indicate the precision required. Finally, remove
the unnecessary calls to wait_ms in
repeated_construction_destruction_test.
2019-01-29 12:27:25 -06:00
Maciej Bocianski 5d40f34c33 code formatting fixes 2019-01-29 12:27:25 -06:00
Maciej Bocianski e515a52ffa USBDevice - add multiconfiguration support 2019-01-29 12:27:25 -06:00
Maciej Bocianski bfa3dc4962 USBDevice - add support for deconfiguration 2019-01-29 12:27:24 -06:00
Maciej Bocianski 2cacae9411 USB reset test fix 2019-01-29 12:27:24 -06:00
Russ Butler c85f0dc249 Skip USB reset tests on OSX
OSX machines don't allow you to reset USB devices. Skip this test on
OSX so testing can still be used.
2019-01-29 12:27:24 -06:00
Russ Butler 4b4cea9f59 Update USBTester product name
Change the name reported by USBTester from CDC DEVICE to
MBED TEST DEVICE.
2019-01-29 12:27:24 -06:00
Maciej Bocianski 5f4e84a726 USB generic tests 2019-01-29 12:27:23 -06:00
Russ Butler 9b09f43f04 Update USBTester for the new USB API
Update the class USBTester so it works with the new zero-copy
USBDevice API.
2019-01-29 12:27:22 -06:00
Russ Butler 2c202ac224 Update USBTester for simplified read handling
Remove read_start and replace read_finish with read to match the new
USBDevice API.
2019-01-29 12:27:21 -06:00
Russ Butler a9dccd4c94 Add USBDevice test code
Add a USB test and the class USBTester.cpp to go along with it.
2019-01-29 12:27:21 -06:00