On Mon, 9 Sep 2013, Phil Dibowitz 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.

Okay, so I did some review and testing of your latest patch.  Comments 
below.

> Note that on Linux you can use libhidapi-hidraw (the raw internal
> implementation), or libhidapi-libusb (uses libusb internally), but we
> use libusb becuase the hidraw is unstable at this point. On other
> platforms, only the respective native HID implementations are

I don't think the hidraw implementation is necessarily buggy on Linux - I 
think it would just have required kernel changes to make it work with our 
devices.

> -AC_CONFIG_HEADERS([config.h])

Any particular reason why you removed this from libconcord/configure.ac? 
Not that I noticed a problem - I just noticed that there are a bunch more 
-Dxxyyzz arguments on compilation commands (vice having all the defines 
written to config.h).  Just curious, mainly.

> +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.)

> +   debug("Failed to write to device: %d (%s)", err, hid_error(h_dev));
> +   debug("Failed to read from device: %d (%s)", err, hid_error(h_dev));

I think both of these should actually use %ls instead of %s because 
hid_error returns a wchar_t*.

Scott

------------------------------------------------------------------------------
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
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel

Reply via email to