Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: allow device 0 in hidconsole #2112

Merged
merged 1 commit into from
Aug 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions lib/hidapi/hidconsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -154,7 +154,6 @@ def matchfn(bid, vid, pid, _a, _b):
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))
Expand Down
4 changes: 2 additions & 2 deletions tools/scan-registers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down