cli: show features versions in solaar show (#1709)

This commit is contained in:
Peter F. Patel-Schneider 2022-08-20 12:34:15 -04:00 committed by GitHub
parent d4d4574b3f
commit 76afec5c82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -287,7 +287,7 @@ class FeaturesArray(dict):
def get_feature_version(self, feature): def get_feature_version(self, feature):
if self[feature]: if self[feature]:
return self.version[feature] return self.version.get(feature, 0)
__bool__ = __nonzero__ = _check __bool__ = __nonzero__ = _check

View File

@ -134,7 +134,9 @@ def _print_device(dev, num=None):
flags = dev.request(0x0000, feature.bytes(2)) flags = dev.request(0x0000, feature.bytes(2))
flags = 0 if flags is None else ord(flags[1:2]) flags = 0 if flags is None else ord(flags[1:2])
flags = _hidpp20.FEATURE_FLAG.flag_names(flags) 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: if feature == _hidpp20.FEATURE.HIRES_WHEEL:
wheel = _hidpp20.get_hires_wheel(dev) wheel = _hidpp20.get_hires_wheel(dev)
if wheel: if wheel: