particle-iot / particle-usb

A library for accessing Particle USB devices
Apache License 2.0
5 stars 1 forks source link

add support for controlOutTransfersRequireDataStage quirk #50

Closed avtolstoy closed 2 years ago

avtolstoy commented 2 years ago

Some platforms have non-compliant behavior where control OUT (Host to Device) transfers over EP0 always require a data stage to be present even if setup request has wLength=0, otherwise the request does not complete and times out.

@sergeuz Any suggestions on unit tests for this?

See also https://github.com/particle-iot-inc/device-constants/pull/12

sergeuz commented 2 years ago

@avtolstoy Given that the issue is platform-specific and that we don't have unit tests for the node-usb backend at the moment, how about we add an integration test for this fix instead?

avtolstoy commented 2 years ago

@sergeuz I was more thinking of using fake-usb and validating that when this quirk is set the requests that should not have a data stage do have one.

I'll need to double-check, I think this quirk should work just fine on any platform, so perhaps adding an integration tests is also a solution here.

sergeuz commented 2 years ago

I was more thinking of using fake-usb and validating that when this quirk is set the requests that should not have a data stage do have one

That would work if the fix was implemented in DeviceBase, but it's implemented in the USB backend classes that are mocked by fake-usb.

avtolstoy commented 2 years ago

Added integration test for the quirk. Works on all devices if forced.