c++ - How To Read HID Output Reports Cross Platform -


i have custom atmel chip firmware uses lufa driving usb. can read , write output reports on windows existing software in .net using pinvoke.

i want develop cross platform desktop app shared codebase communicating device.

i can write output reports device on mac using both hidapi in c++ preferred library hidsharp in c# via mono.

however, unable read hid reports. both platforms give me timeout when call equivalent .read() method.

my relevant lufa code looks this:

bool callback_hid_device_createhidreport(usb_classinfo_hid_device_t* const hidinterfaceinfo,                                      uint8_t* const reportid,                                      const uint8_t reporttype,                                      void* reportdata,                                      uint16_t* const reportsize) {     if(reporttype == hid_report_item_in && reportid != null && *reportid != 0) {     if(debug) {         serial_write_str_p(pstr("usb in packet: "));         serial_write_uint8(reportid == null ? 0xff : *reportid, 10);     } 

i able "usb in packet: " , read reports in .net using this:

[dllimport("hid.dll", setlasterror = true)] static extern boolean hidd_getinputreport(intptr hfilehandle, byte[] reportbuffer, uint reportbufferlength);  byte[] buffer = new byte[packetsize]; buffer[0] = my_control_packet; hidd_getinputreport(_filehandle.dangerousgethandle(), buffer, (uint)buffer.length) 

on mac or pc using hidsharp or hidapi libraries can never break "usb in packet:" line, , timeout. hidsharp code looks this:

hidstream stream; device.tryopen(out stream);     using (stream) {     var bytes = new byte[37];     bytes[0] = my_report_id;     stream.read(bytes) } 

what doing wrong wrong in hidsharp? if hidsharp broken how accomplish in hidapi? if hidapi broken other options have?


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -