Author Topic: HidP_GetUsages in VB  (Read 24254 times)

Pointy

  • Member
  • ***
  • Posts: 11
Re: HidP_GetUsages in VB
« Reply #15 on: February 14, 2014, 10:04:56 am »
Have you tried using breakpoints and examining what you are passing to the API calls and what they are returning? Sometimes that can offer a clue. For example, is the report data returned by ReadFile what you expect? If so, work forward from there to find a parameter that is suspicious.

I have debugged this until I am blue in the face.

If I move the HidP_GetCaps in the code above to after the part that's giving me an error it still works, so surely that means the PreparsedData is OK.

I added SetLastError:=True to the 2 functions and get the following errors...

HidP_MaxDataListLength failed with Error: 87
HidP_GetData failed with Error: 1008

I don't know how that helps me though.

Lastly if I add
Code: [Select]
capsLength =HidP_MaxDataListLength(HidP_Input,pPreparsedData); to the vc++ code linked in the first post, it works as expected with the same USB device which makes me think there is not a problem with the descriptor.

Regards,

Les

Pointy

  • Member
  • ***
  • Posts: 11
Re: HidP_GetUsages in VB
« Reply #16 on: February 14, 2014, 03:45:46 pm »
I am such a doofuss at times!

Sometimes you look a code for so long you don't see the obvious. Both of the declares had ByRef instead of ByVal for pPreparsedData and the HidP_GetData call I had swapped pPresparsedData and DataLength.

DOH!

By George I think I have finally cracked it!

Regards,

Les

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: HidP_GetUsages in VB
« Reply #17 on: February 15, 2014, 08:16:50 am »
Excellent!