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?
I see that the
UPS.inosample contain aconst 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_SERIALstring is accessed is in thePowerDevice.setSerial(STRING_SERIAL)call that assigns the string toHID_::serial. TheHID_::serialpointer is furthermore only read & returned fromHID_::getShortName. The weird thing is that theHID_::getShortNamemethod appears to be dead code that is not called from anywhere. Still, theSTRING_SERIALstring still somehow manages to be propagated to Windows, which seems like a mystery to me. ModifyingHID_::getShortNamewill also change the battery serial number reported by Windows.Is the
HID_::getShortNamemethod automatically called by some external Arduino code, or is there some other mechanism in play here that I don't understand?