Skip to content

Handle GetOverlappedResult blocking forever on read/write #128

Closed

Description

@CristianGlavana

Hello,

We were investigating a blocking issue when write command GetOverlappedResult is blocking forever. It is a follow up from signal11/hidapi#88

This occurs when maximal speed of USB HID is reached, e.g. 1000 frames per second. If target is just sending data at this rate, it is ok. Some frames are still lost due to computer speed, windows management and other USB frames requested by windows checking target status.
Problem cames when communication goes both ways. When sending commands from the computer if line IO_PENDING flag is true, there is not enought bandwidth and GetOverlappedResult is blocking forever.
We experienced with 64bytes frame data in/out.

Solution from signal11/hidapi#88 was implemented in hid.c file and sucessfully tested. When ERROR_IO_PENDING is detected write function waits until previous transaction is complete. Also limit maximal transfer frames rate to 1000 (1000 read or 1000 write or 500 read/write)

Here is attached hid.c file:
hid.zip

Activity

  1. added
    Windows
    on Dec 3, 2019
  2. Youw commented on Dec 3, 2019

    @Youw
    Member

    Hi @CristianGlavana,

    Thank's for opening this ticket.
    It seems like signal11/hidapi#88 does suggest a solution (developed by Alan Ott) itself.

    Do you feel like preparing a PR to fix this issue?

  3. Youw commented on Oct 14, 2020

    @Youw
    Member

    Fix applied, currently in master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Windows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions