You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
String features are important for complete support of HID protocol, however they are not handled as regular features, according to USB HID specification. Any string feature stores only integer index of the string, which is the identification of the string descriptor.
Suggested enhancement allows to hide the complexity of handling string descriptors. The sketch code can look as follows:
// SomeHIDDevice can be Mouse, Keyboard, PowerDevice etc and usually is the place where we define the
// HID device descriptor.
#include <SomeHIDDevice.h>
// we store string descriptor index in the var, which will be reported through Feature
const byte bSomeStringFeature = 10;
// the string is stored in PROGMEM to save memory
const char STRING_SOMESTRING[] PROGMEM = "My cool device";
void setup() {
SomeHIDDevice.begin();
// here we call the wrapper of the SetStringFeature method defined in the SomeHIDDevice and pass the
// address of the variable, which will hold the value of the feature, to the HID library
// HID_SOME_STRING corresponds to the HID Report ID and is to be defined in the SomeHIDDevice.h
SomeHIDDevice.SetStringFeature(HID_SOME_STRING, &bSomeStringFeature, STRING_SOMESTRING);
}
void loop() {
//...
}
The text was updated successfully, but these errors were encountered:
abratchik
changed the title
Add string descriptor and feature suypport to HID library
Add string descriptor and string feature support to HID library
Feb 19, 2021
String features are important for complete support of HID protocol, however they are not handled as regular features, according to USB HID specification. Any string feature stores only integer index of the string, which is the identification of the string descriptor.
Suggested enhancement allows to hide the complexity of handling string descriptors. The sketch code can look as follows:
The text was updated successfully, but these errors were encountered: