device: allow return device 00 for BT device ff
This commit is contained in:
parent
8537708ec2
commit
37e303163c
|
@ -439,7 +439,7 @@ def request(handle, devnumber, request_id, *params, no_reply=False, return_error
|
||||||
|
|
||||||
if reply:
|
if reply:
|
||||||
report_id, reply_devnumber, reply_data = 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
|
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])
|
error = ord(reply_data[3:4])
|
||||||
|
@ -524,7 +524,7 @@ def ping(handle, devnumber, long_message=False):
|
||||||
reply = _read(handle, _PING_TIMEOUT)
|
reply = _read(handle, _PING_TIMEOUT)
|
||||||
if reply:
|
if reply:
|
||||||
report_id, reply_devnumber, reply_data = 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:]:
|
if reply_data[:2] == request_data[:2] and reply_data[4:5] == request_data[-1:]:
|
||||||
# HID++ 2.0+ device, currently connected
|
# HID++ 2.0+ device, currently connected
|
||||||
return ord(reply_data[2:3]) + ord(reply_data[3:4]) / 10.0
|
return ord(reply_data[2:3]) + ord(reply_data[3:4]) / 10.0
|
||||||
|
|
Loading…
Reference in New Issue