VID and PID types

Sep 21, 2013 at 7:32 AM
Hello there. I've been using your library with some success. I really like the HID Manager approach to things. It is very useful for populating a comboBox to select the right device.

I just wanted to pass on a little issue that I've run into while using your library.

The VID and PID are declared as short instead of ushort. This may or may not be a problem depending on your implementation, but I ran into this problem when trying to find a device with a VID that was 0xC49D. Notice the msb is set. That will cause a sign extend when a short is cast to an int which will be represented as 0xFFFFC49D. So If I try to compare HIDInforSet.VID with 0xC4AD, then the comparison will not match. I'm still a bit of a noob to the C# world but I've been writing C/C++ apps for years. Certain things in C# are still a little magical to me (there's a lot that happens behind the scenes).

Just wanted to point that out for others that may be trying to use this library. Keep up the good work. Hope to see an update soon when you get more of this fleshed out.

Cheers!
Jason
Coordinator
Sep 21, 2013 at 8:41 AM
Hi jgurley30,

Thanks for reporting this bug. Can I ask you for a favor? If I add you as a team member, will you fix this bug?

mrtn
Sep 23, 2013 at 4:11 PM
Thank you mrtn,
You don't have to add me as a team member I'll gladly send you the modified code. Files attached.

Best Regards,
Jason