greatscottgadgets/luna

Standard request handler should implement CLEAR_FEATURE request

martinling opened this issue · 0 comments

There are a number of standard requests not currently implemented, but in particular, we should implement the CLEAR_FEATURE request with feature selector ENDPOINT_HALT.

This request should clear any halt condition on the target endpoint, and clear the data toggle bit. The host will usually only send this when recovering from a stall or error condition, but the request is allowed at any time.

Not handling this request led to bug greatscottgadgets/hackrf#1052, which was caused by the data toggle bits on host and device becoming out of sync.

On MacOS versions before 10.5, it was necessary to send this request after calling AbortPipe for an endpoint, because that function had the side effect of clearing the data toggle bit on the host.

At present, libusb on Darwin still sends this request as part of libusb_cancel_transfer, though that may be changed soon.