On Mon, 16 Sep 2013, Scott Talbert wrote:
>> OK, here's a (hopefully) final version.
>>
>> There's a few autoconf/automake tweaks for MacOSX since the last version.
>> Removed some debug code, and updated the Linux and Mac docs.
>>
>> Have you had any success making hidapi-raw work on Windows?
>
> No, I have not. I haven't tried yet - I will, though. Ideally, I would
> like to get the Windows build working through MinGW, so we could easily
> cross compile the Windows build from Linux.
Well, tried hidapi on Windows, and I actually got it to build with MinGW.
Yay! So, I think I will probably make that the official way to build the
Windows version.
>> +int HID_WriteReport(const uint8_t *data)
>> +{
>> + int err = hid_write(h_dev, data, USB_PACKET_LENGTH);
>> + if (err < 0) {
>> + debug("Failed to write to device: %d (%s)", err, hid_error(h_dev));
>> + return err;
>> + }
>> +
>> + return 0;
>> +}
>
> I found a pretty substantial bug here. It turns out that hid_write
> requires that you pass it a 'Report ID' as the first byte - so we actually
> need to pass in a buffer of USB_PACKET_LENGTH + 1, and set the first byte
> to zero. So, here we'll probably have to copy the input data into a
> larger buffer, and pass that on. Because of the way hid_write() works,
> this bug is only seen when we send a packet that starts with 0x00. (See
> the hidapi.h header file for more info on the 'Report ID' requirement.)
Yep, the Windows version of hidapi wouldn't work at all unless I fixed
this bug by doing:
int HID_WriteReport(const uint8_t *data)
{
uint8_t newdata[USB_PACKET_LENGTH + 1];
newdata[0] = 0x00;
memcpy(&newdata[1], data, USB_PACKET_LENGTH);
int err = hid_write(h_dev, newdata, USB_PACKET_LENGTH + 1);
if (err < 0) {
debug("Failed to write to device: %d (%ls)", err, hid_error(h_dev));
return err;
}
return 0;
}
------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
concordance-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/concordance-devel