device: allow return device 00 for BT device ff

This commit is contained in:
Peter F. Patel-Schneider 2023-09-14 20:15:29 -04:00
parent 8537708ec2
commit 37e303163c
1 changed files with 2 additions and 2 deletions

View File

@ -439,7 +439,7 @@ def request(handle, devnumber, request_id, *params, no_reply=False, return_error
if reply:
report_id, reply_devnumber, reply_data = reply
if reply_devnumber == devnumber:
if reply_devnumber == devnumber or reply_devnumber == devnumber ^ 0xff: # BT device returning 0x00
if report_id == HIDPP_SHORT_MESSAGE_ID and reply_data[:1] == b'\x8F' and reply_data[1:3] == request_data[:2
]:
error = ord(reply_data[3:4])
@ -524,7 +524,7 @@ def ping(handle, devnumber, long_message=False):
reply = _read(handle, _PING_TIMEOUT)
if reply:
report_id, reply_devnumber, reply_data = reply
if reply_devnumber == devnumber:
if reply_devnumber == devnumber or reply_devnumber == devnumber ^ 0xff: # BT device returning 0x00
if reply_data[:2] == request_data[:2] and reply_data[4:5] == request_data[-1:]:
# HID++ 2.0+ device, currently connected
return ord(reply_data[2:3]) + ord(reply_data[3:4]) / 10.0