PORTS Forum

Ports and Interfaces => USB => Topic started by: karolys on August 25, 2015, 08:29:14 pm

Title: HID Communication on Arduino Leonardo to Windows 10
Post by: karolys on August 25, 2015, 08:29:14 pm
Hello!

I'm cross posting this question in hopes that I run across someone that has more knowledge on the matter than I do. I'm attempting to establish communication over USB HID with an Arduino Leonardo using C# on Windows 10. I have been able to enumerate and retrieve the HidDevice object but I am unable to receive any data. I do receive the appropriate communication event but the bytes that are read are always empty.

My app manifest contains the following piece:

Code: [Select]
<DeviceCapability Name="humaninterfacedevice">
    <Device Id="vidpid:16C0 0486">
      <Function Type="usage:FFAB 0200"/>
    </Device>
</DeviceCapability>

The remainder of my code(initialization and read handling) is very similar to what's available from MSFT resources on the topic. Any insight would be much appreciated!
Title: Re: HID Communication on Arduino Leonardo to Windows 10
Post by: Jan Axelson on August 25, 2015, 09:15:27 pm
"I do receive the appropriate communication event" - what API are you using to read the data? Does the function return an error message?

 

Title: Re: HID Communication on Arduino Leonardo to Windows 10
Post by: karolys on August 26, 2015, 02:08:51 pm
I am using the latest version of .NET targeting Universal Windows(10), specifically using Windows.Devices.HumanInterfaceDevice and related references.

https://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn263133.aspx
Title: Re: HID Communication on Arduino Leonardo to Windows 10
Post by: Jan Axelson on August 26, 2015, 03:27:29 pm
If you are receiving a report, but the values aren't what you expect, a protocol analyzer will show you what the device is sending:

http://janaxelson.com/development_tools.htm#analyzers

A HID will send report data on receiving a token packet on the interrupt IN endpoint, assuming the endpoint has been armed to send data on receiving a token packet.

The Windows HID driver will accept a received report if the amount of data matches the report size in the report descriptor. If the report descriptor uses report IDs, the HID must send a report ID byte preceding the report data. If using the default report ID of zero, the report ID does not travel on the bus.

Title: Re: HID Communication on Arduino Leonardo to Windows 10
Post by: Jan Axelson on August 28, 2015, 08:59:44 am
Maybe this will help:

https://forum.arduino.cc/index.php?topic=339139.0