Author Topic: Blank USB Input Reports on Specific Ports  (Read 17548 times)

SeaLyon

  • Member
  • ***
  • Posts: 4
Blank USB Input Reports on Specific Ports
« on: June 21, 2010, 11:41:07 am »
Thank you for your detailed examples and books. I have found them very useful. I had a perplexing issue however that I thought you may know a quick answer to. I am using a HID interface to communicate to a uC. Everything runs well when the HID is connected to one of my USB ports or to a hub. However two other USB ports (located at a different spot on the PC) will drop the read packet on occasion with no error message being reported. I have tried setting the number of read packets higher but it does not seem to correct the issue. I have looked through the FAQs and other sources but have not found an answer to the lost read data packets (I don't ever seem to loose packets being written out, just ones being read in). Is there a simple answer as to why it may be doing this?
 
Thanks

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Blank USB Input Reports on Specific Ports
« Reply #1 on: June 21, 2010, 12:28:02 pm »
Thank you for posting your question to the forum.

If it's a bandwidth issue, you can try increasing the size of the ReadFile buffer to read multiple reports, when available, at once and thus allow greater throughput.

Jan

SeaLyon

  • Member
  • ***
  • Posts: 4
Re: Blank USB Input Reports on Specific Ports
« Reply #2 on: June 21, 2010, 05:06:28 pm »
I have tried changing the report buffer with the following command:

MyHID.SetNumberOfInputBuffers(HIDHandle, 32)

I have changed it up to 511 and have seen no difference in the way it is operating (still drops read packets).

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Blank USB Input Reports on Specific Ports
« Reply #3 on: June 21, 2010, 05:45:13 pm »
SetNumberOfInputBuffers sets the number of reports the HID driver can store. If your application can't read the reports fast enough, the buffer will still overflow, just not as quickly.

ReadFile returns as many reports as are available and will fit in the buffer passed to it. So for example, if the report is 8 bytes + report ID, the ReadFile buffer is 90 bytes, and the HID driver has stored 10 reports, ReadFile will return all ten reports at once.

It's also possible that some other issue is causing the dropped reports.
Jan 

tosa

  • Member
  • ***
  • Posts: 2
Re: Blank USB Input Reports on Specific Ports
« Reply #4 on: May 13, 2011, 12:07:14 am »
Does this mean that the buffer passed to ReadFile should be as big as the ReadFile buffer, not just the size of the Report? What happens if the number of reports currently in the ReadFile buffer changes?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Blank USB Input Reports on Specific Ports
« Reply #5 on: May 13, 2011, 09:09:54 am »