Dolos: Add support for multi-battery configs
Adds support for identifying the correct battery associated with
a HWID. Configs can encode a mapping of HWID's battery_field
revision_id and bits. This allows the programming utility find
the correct battery associated with the HWID. A register can be
mapped either as common to all batteries or identified as specific
to one battery index.
Configs which do not have a battery index support will be unchanged.
These are treated as if every field is shared.
If a register is identified as a multi-battery register then we use
the battery index extracted from the HWID to obtain it's result.
When no HWID is present, we assume battery index is 0.
BUG=b:394097732
TEST=Programed dolos using the '-id' option using ID's and configs
the unittest examples to verify end-to-end functionality.
TEST=pytest
Change-Id: I6783f4c8ef0064c600a77770e92f209b3533755c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dolos/+/6265488
Reviewed-by: Ćukasz Hajec <hajec@google.com>
Tested-by: Brian Nemec <bnemec@google.com>
Reviewed-by: Keith Haddow <haddowk@chromium.org>
Commit-Queue: Brian Nemec <bnemec@google.com>
7 files changed