[Nut-upsdev] What is the arduino sub-driver intended to be used for?
Greg Troxel
gdt at lexort.com
Wed Nov 15 16:52:07 GMT 2023
Kelly Byrd <kbyrd at memcpy.com> writes:
> Making progress on this PR. I have question about storing and checking
> state in a subdriver
> HID Power Devices can a "UPS.PowerSummary.CapacityMode" value. According to
> the spec, the values are:
> 0: maH
> 1: mwH
> 2: percent (%)
> 3: Boolean support only (OK or failed)
Looking at HID code briefly (my UPS devices have serial ports..), I see
the fundamental issue is that the code is structured as a mapping table
where there are essentially pairs of HID names and nut names. That
presumes fixed semantics for each HID variable.
This is a bug in the HID spec; having a mode is an unnecessary
architectural complication vs just having 4 sets of variables some of
which might or might not be there.
So, I think the thing to do is for you not to worry for now, and that we
should open a bug that the nut mapping scheme is unsound. Probably
the mapping code needs to learn to check mode, and to rewrite the
variable name or use some other flag, so that you can write mappings
that go from each logical variable restricted to the expected mode to a
nut variable.
This change is not reasonable to impose as a requirement for a new
driver that is not doing this any worse than the already-existing
drivers.
More information about the Nut-upsdev
mailing list