From 76afec5c824ffc37057926f97e057cbce6b1ef24 Mon Sep 17 00:00:00 2001 From: "Peter F. Patel-Schneider" Date: Sat, 20 Aug 2022 12:34:15 -0400 Subject: [PATCH] cli: show features versions in solaar show (#1709) --- lib/logitech_receiver/hidpp20.py | 2 +- lib/solaar/cli/show.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/logitech_receiver/hidpp20.py b/lib/logitech_receiver/hidpp20.py index 87173791..89916e6b 100644 --- a/lib/logitech_receiver/hidpp20.py +++ b/lib/logitech_receiver/hidpp20.py @@ -287,7 +287,7 @@ class FeaturesArray(dict): def get_feature_version(self, feature): if self[feature]: - return self.version[feature] + return self.version.get(feature, 0) __bool__ = __nonzero__ = _check diff --git a/lib/solaar/cli/show.py b/lib/solaar/cli/show.py index 794a375b..529c5c27 100644 --- a/lib/solaar/cli/show.py +++ b/lib/solaar/cli/show.py @@ -134,7 +134,9 @@ def _print_device(dev, num=None): flags = dev.request(0x0000, feature.bytes(2)) flags = 0 if flags is None else ord(flags[1:2]) flags = _hidpp20.FEATURE_FLAG.flag_names(flags) - print(' %2d: %-22s {%04X} %s' % (index, feature, feature, ', '.join(flags))) + version = dev.features.get_feature_version(int(feature)) + version = version if version else 0 + print(' %2d: %-22s {%04X} V%s %s ' % (index, feature, feature, version, ', '.join(flags))) if feature == _hidpp20.FEATURE.HIRES_WHEEL: wheel = _hidpp20.get_hires_wheel(dev) if wheel: