tools: allow device 0 in hidconsole

This commit is contained in:
Peter F. Patel-Schneider 2023-08-06 16:26:42 -04:00
parent 21da0a16af
commit 8dd8c8b76f
2 changed files with 4 additions and 5 deletions

View File

@ -114,8 +114,8 @@ def _validate_input(line, hidpp=False):
if data[:1] not in b'\x10\x11':
_error('Invalid HID++ request: first byte must be 0x10 or 0x11')
return None
if data[1:2] not in b'\xFF\x01\x02\x03\x04\x05\x06':
_error('Invalid HID++ request: second byte must be 0xFF or one of 0x01..0x06')
if data[1:2] not in b'\xFF\x00\x01\x02\x03\x04\x05\x06\x07':
_error('Invalid HID++ request: second byte must be 0xFF or one of 0x00..0x07')
return None
if data[:1] == b'\x10':
if len(data) > 7:
@ -154,7 +154,6 @@ def _open(args):
handle = _hid.open_path(device)
if not handle:
sys.exit('!! Failed to open %s, aborting.' % device)
print(
'.. Opened handle %r, vendor %r product %r serial %r.' %
(handle, _hid.get_manufacturer(handle), _hid.get_product(handle), _hid.get_serial(handle))

View File

@ -14,8 +14,8 @@ fi
HIDRAW=$2
do_req() {
"$HC" --hidpp $HIDRAW | grep -v "\[1. .. 8F.. " | grep -B 1 "^>> "
# "$HC" --hidpp $HIDRAW | grep -v "\[1. ${DEVNUMBER} 8F..0[123]" | grep -B 1 "^>> "
## "$HC" $HIDRAW
"$HC" $HIDRAW | grep -v "^<< " | grep -v "\[1. .. 8F.. "
}
req00="$(mktemp --tmpdir req00-XXXXXX)"