I’m trying to implement a custom HID Joystick ontop of USBHID
, and I need to set the Manufacturer/Product/Serial strings.
What I tried:
class HIDJoystick: public USBHID {
//...
protected: // USBDevice declares them public, but USBHID overrides the product protected, so figured I se that too
virtual const uint8_t *string_imanufacturer_desc(); // those are *literally* copypasted from USBHID
virtual const uint8_t *string_iproduct_desc();
virtual const uint8_t *string_iserial_desc();
//...
};
const uint8_t *HIDJoystick::string_imanufacturer_desc()
{
static const uint8_t string_imanufacturer_descriptor[] = {
11+2,
STRING_DESCRIPTOR,
'.', 0, 'd', 0, 'e', 0, '.', 0, 'n', 0, 'o', 0, 'n', 0, 'c', 0, 'h', 0, 'i', 0, 'p', 0,
};
return string_imanufacturer_descriptor;
}
//and so on
given USBHID
also just overrides that virtual function from USBDevice
, I would expect this to work, but when connecting my host sees:
[506805.228843] usb 1-11: Product: HID DEVICE
[506805.228845] usb 1-11: Manufacturer: mbed.org
the HID DEVICE
is what USBHID
overrides (USBDevice
defines the string USB DEVICE
), the mbed.org
comes from USBDevice
, and nothing I set in my class has any effect.