[fpc-pascal] USB Human Interface Devices

James Richters james at productionautomation.net
Fri Aug 16 17:11:48 CEST 2019


>>Remember that interrupt reads are  blocking so the way to deal with them is to put them away from the main thread, in their own thread. The moment something is available from the device, then the main thread of your application is signaled to read a buffer with the device report data. So, I can see some thread programming in your future or,

Can I even do threads in a console program?   Is there another way to do a read that has a timeout?

>You got it. Report type can be input, output or feature, just choose the 
>appropriate constant. Report number, for me was a lot of guesses, trial 
>and error combined with other examples of similar devices, etc.

>Just make hidOutData[0]=Report_id (i.e., the first byte of your array) 
>and cross your fingers that the report id is correct.

So reportID is the same as the first byte, so then I have to repeat it like this:
         libusbhid_set_report(device_context, HID_REPORT_TYPE_FEATURE, hidOutData[0] , 7, hidOutData[ 0.. 6] );               ?

James


More information about the fpc-pascal mailing list