Topic: Questions about HID Sharp
I am attempting to write a Library around Zer's HidSharp code to talk to a USB device for a project I am working on.
My question is:
What is the proper way to setup the HIDStream to allow for asynchronous communication from both ends (PC or USB device can send a message @ any time).
Right now I have back to back stream.BeginReads that will continuously poll the stream for data and then use stream.BeginWrite to send data when I receive it from my application.
What I have noticed is that after about 5 failed reads (long period of no messages) the HIDStream becomes unreliable and I stop receiving any data packets.
My current solution is to simply restart the HIDStream after 5 failed reads, but I was hoping for a more elegant solution.
Thanks.