gary-rowe / hid4java

A cross-platform Java Native Access (JNA) wrapper for the libusb/hidapi library. Works out of the box on Windows/Mac/Linux.
MIT License
229 stars 71 forks source link

About HID Feature Reports #100

Closed Laivindur closed 3 years ago

Laivindur commented 3 years ago

Disclaimer: This is an issue of support.

Hi @gary-rowe

Before anything else, apologise if this is not the right "forum" where to ask for insights about some of the HID base concepts. Feel free to redirect me to the right channel if you deem it appropriate.

I have been inspecting hid4java API for me to know what features I have at hand. Inspecting HidDevice I found getFeatureReport and setFeatureReport . I have been researching about HID reports and I have found that these are a sort of descriptors for hosts to know how to communicate with the device. A sort of self-described protocol. Am I right?

The question is, what can we (java developers) do with these featureReports? In other words, what can we do with HidDevice.getFeatureReport and HidDevice.setFeatureRepor? Can we change / enhance the communication java - device?

Thank you in advance!

gary-rowe commented 3 years ago

HI @Laivindur,

I'd suggest that the Telegram group chat is the better forum for these kinds of discussions mainly because more people will see the question and be able to respond in a timely manner. I tend to visit issues on GH infrequently because of my work schedule.

That said, a USB HID feature report is an item of data that can be sent to or from the host machine and the attached device. An example of a feature report would be anything that you'd like to set and then read as part of configuring a device. These feature reports are usually provided in the technical description of the device you're working with and each has a reportId to indicate what it is you're adjusting. Of course, some devices have hidden reportId values that unlock special behaviours when using a manufacturer's own device driver rather than a generic one (think gaming mice or enhanced keyboard functions).

Since this is a general support issue, I'll close it now but I am thinking of creating a USB HID wiki/resource so perhaps I'll include more details there.