Page 1 of 1

Need some help understanding usbFunctionWriteOut()

Posted: Thu Oct 06, 2016 9:38 am
by lunar
I've been trying to create a composite device using Arduino UNO R3. The main goal was to "emulate" the Logitech's G15 keyboard LCD display using Arduino.
The device consist of vendor-defined device, and a keyboard. I've got the descriptors and the keyboad part right - on windows the device is recognized properly by the driver, and reacts for control-out packets properly - I can tell that by using the Logitech's software to set the brightness and contrast levels of the display.

The problem starts with interrupt-out transfers, or rather, getting the total packet length. The function usbFunctionWriteOut() receives the data in chunks of 8 bytes as it should, but I have no idea how to check/verify if the total packet have been received or not. I know that, for an example for a ReportID = 2, the packet total length is 7 bytes, and for the ReportID = 3 the length is 992 bytes, but I'm wondering, if there is a way to tell this before actually attempting to read the packet data, or at least, after I read the packet, so I know when to reset my received bytes counter.

If someone tried to already receive bigger data through the interrupt-out endpoints, I'd appreciate some code example on how to read the expected total packet length.

That's my first project using V-USB library, so I'd appreciate any help, and I'm sorry for any inconvenience caused if the question was already answered, or I misunderstood something form the documentations, but I coulndn't find any good examples showing how to achieve my goal.

Re: Need some help understanding usbFunctionWriteOut()

Posted: Tue Jun 27, 2017 4:40 pm
by ulao
normally you just keep a counter as shown in the examples but you can also...

use the After-the-fact CRC checking
http://vusb.wikidot.com/examples