hid-data example and hid comm from Java host

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
barney
Posts: 6
Joined: Thu Feb 21, 2013 4:03 am

hid-data example and hid comm from Java host

Post by barney » Sat Feb 23, 2013 8:58 pm

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?

barney
Posts: 6
Joined: Thu Feb 21, 2013 4:03 am

Re: hid-data example and hid comm from Java host

Post by barney » Sun Feb 24, 2013 5:47 am

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.
*/

Post Reply