cli: slight improvement to probe

This commit is contained in:
Peter F. Patel-Schneider 2020-09-01 18:30:31 -04:00
parent 831287ead6
commit 68aebc8c1b
1 changed files with 3 additions and 2 deletions

View File

@ -42,6 +42,7 @@ def run(receivers, args, find_receiver, _ignore):
_print_receiver(receiver) _print_receiver(receiver)
print('')
print(' Register Dump') print(' Register Dump')
rgst = receiver.read_register(_R.notifications) rgst = receiver.read_register(_R.notifications)
print(' Notifications %#04x: %s' % (_R.notifications % 0x100, '0x' + _strhex(rgst) if rgst else 'None')) print(' Notifications %#04x: %s' % (_R.notifications % 0x100, '0x' + _strhex(rgst) if rgst else 'None'))
@ -86,7 +87,7 @@ def run(receivers, args, find_receiver, _ignore):
elif isinstance(rgst, int) and rgst == _hidpp10.ERROR.invalid_value: elif isinstance(rgst, int) and rgst == _hidpp10.ERROR.invalid_value:
continue continue
else: else:
if not isinstance(last, int) and not isinstance(rgst, int) and last != rgst: if not isinstance(last, bytes) or not isinstance(rgst, bytes) or last != rgst:
print( print(
' Register Short %#04x %#04x: %s' % ' Register Short %#04x %#04x: %s' %
(reg, sub, str(rgst) if isinstance(rgst, int) else '0x' + _strhex(rgst)) (reg, sub, str(rgst) if isinstance(rgst, int) else '0x' + _strhex(rgst))
@ -100,7 +101,7 @@ def run(receivers, args, find_receiver, _ignore):
elif isinstance(rgst, int) and rgst == _hidpp10.ERROR.invalid_value: elif isinstance(rgst, int) and rgst == _hidpp10.ERROR.invalid_value:
continue continue
else: else:
if not isinstance(last, int) and not isinstance(rgst, int) and last != rgst: if not isinstance(last, bytes) or not isinstance(rgst, bytes) or last != rgst:
print( print(
' Register Long %#04x %#04x: %s' % ' Register Long %#04x %#04x: %s' %
(reg, sub, str(rgst) if isinstance(rgst, int) else '0x' + _strhex(rgst)) (reg, sub, str(rgst) if isinstance(rgst, int) else '0x' + _strhex(rgst))