Skip to content

Where is HID_::getShortName called from? #20

@forderud

Description

@forderud

I see that the UPS.ino sample contain a const char STRING_SERIAL[] PROGMEM = "UPS10" string that is correctly picked up as BatterySerialNumber in Windows. This seem to work in practice, but I'm struggling to understand why & how it works.

The only place where STRING_SERIAL string is accessed is in the PowerDevice.setSerial(STRING_SERIAL) call that assigns the string to HID_::serial. The HID_::serial pointer is furthermore only read & returned from HID_::getShortName. The weird thing is that the HID_::getShortName method appears to be dead code that is not called from anywhere. Still, the STRING_SERIAL string still somehow manages to be propagated to Windows, which seems like a mystery to me. Modifying HID_::getShortName will also change the battery serial number reported by Windows.

Is the HID_::getShortName method automatically called by some external Arduino code, or is there some other mechanism in play here that I don't understand?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions