I have the hid-data example working fine when using the included command line testing tool called hidtool.
However, I am using a Java library for communication with a HID http://code.google.com/p/javahidapi/. I have used this successfully before on a project I created in Arduino using a Teensy 2.0 and it's version of a "RawHID" for data transfer.
Anyway I believe I have figured out my issue. When the java library's write() function sends data to the HID it expects to receive in return the number of bytes written. If it doesn't it throws and exception after a timeout. I can wrap it and when it times out go on my merry way, but the timeout is a bit long. So how do I tweak the example code or the V-USB library to return a number of bytes written after receiving data from the host? I guess a second question is, is this a standard procedure or something that should be in the V-USB library already?
hid-data example and hid comm from Java host
Re: hid-data example and hid comm from Java host
Could my issue have anything to do with this setting in the usbconfig.h file? My current circuit doesn't have a crystal at all so I can't really test this and set it to 1. Based on the CRC checks is this the mechanism that is used at the host end to validate that the data was received? Is so is there any chance I could just tweak the code to send the ACK without the CRC check?
#define USB_CFG_CHECK_CRC 0
/* Define this to 1 if you want that the driver checks integrity of incoming
* data packets (CRC checks). CRC checks cost quite a bit of code size and are
* currently only available for 18 MHz crystal clock. You must choose
* USB_CFG_CLOCK_KHZ = 18000 if you enable this option.
*/
#define USB_CFG_CHECK_CRC 0
/* Define this to 1 if you want that the driver checks integrity of incoming
* data packets (CRC checks). CRC checks cost quite a bit of code size and are
* currently only available for 18 MHz crystal clock. You must choose
* USB_CFG_CLOCK_KHZ = 18000 if you enable this option.
*/