Search code examples
c#cusblibusb

PING Flow Control for OUT Transactions


Does libusb support PING flow control for OUT transactions?

According to the datasheet for the device I am interfacing with, "A NYET handshake is returned to the Host for each OUT packet. The Host pings the OUT endpoint, when internal processing of the device is complete, an ACK is returned in response to a PING."

Is it possible to achieve this using libusb?


Solution

  • PING is a token packet which is generated by your USB host controller and not the Software. PING tokens are taken care of automatically by your host controller.

    EHCI controller keeps PING status bit for each Queue head (Each Queue head will correspond to each endpoint). Your host controller driver initializes the ping state for each queue head to 0.

    Ping states -

    0B - (Do OUT) - The host controller will use an OUT PID during the next bus transaction to this endpoint.

    1B - ( Do Ping) - The host controller will use a PING PID during the next bus transaction to this endpoint.

    Protocol -

    The host controller will first send the OUT packet. If the response is NAK or NYET, the controller will change the ping state to 1 and start sending PING token. When ACK is returned for the PING token, the host controller changes the pin state back to 0 and re-transmit the OUT token.

    So there is no need for worry for SW developers and you do not need to do anything.