Skip to content

usb_hid.c doesn't receive outgoing reports correctly #897

@davidgiven

Description

@davidgiven

In usb_hid.c:hidUSBDataSetup(), there's this code:

[code]
usb_generic_control_rx_setup(buffer->buffer, buffer->bufferSize, &(buffer->state));
buffer->state = HID_BUFFER_UNREAD;
[/code]

As far as I can tell, that assignment to buffer->state shouldn't be there. usb_generic_control_rx_setup() will set the state itself if the retrieval completes, and sometimes it doesn't. If it doesn't, hidUSBDataSetup() will be called again. However, if the assignment above is present, then the buffer will be marked as unread twice (and so picked up by the application twice).

It seems that just removing the assignment fixes things.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions