device: pass protocol to base request so that SW ID can be done right
This commit is contained in:
parent
a7ddb3efdd
commit
c02a1b820b
|
@ -381,7 +381,7 @@ def acquire_timeout(lock, handle, timeout):
|
||||||
|
|
||||||
|
|
||||||
# a very few requests (e.g., host switching) do not expect a reply, but use no_reply=True with extreme caution
|
# a very few requests (e.g., host switching) do not expect a reply, but use no_reply=True with extreme caution
|
||||||
def request(handle, devnumber, request_id, *params, no_reply=False, return_error=False, long_message=False):
|
def request(handle, devnumber, request_id, *params, no_reply=False, return_error=False, long_message=False, protocol=1.0):
|
||||||
"""Makes a feature call to a device and waits for a matching reply.
|
"""Makes a feature call to a device and waits for a matching reply.
|
||||||
:param handle: an open UR handle.
|
:param handle: an open UR handle.
|
||||||
:param devnumber: attached device number.
|
:param devnumber: attached device number.
|
||||||
|
@ -395,7 +395,7 @@ def request(handle, devnumber, request_id, *params, no_reply=False, return_error
|
||||||
|
|
||||||
with acquire_timeout(handle_lock(handle), handle, 10.):
|
with acquire_timeout(handle_lock(handle), handle, 10.):
|
||||||
assert isinstance(request_id, int)
|
assert isinstance(request_id, int)
|
||||||
if devnumber != 0xFF and request_id < 0x8000:
|
if (devnumber != 0xFF or protocol >= 2.0) and request_id < 0x8000:
|
||||||
# For HID++ 2.0 feature requests, randomize the SoftwareId to make it
|
# For HID++ 2.0 feature requests, randomize the SoftwareId to make it
|
||||||
# easier to recognize the reply for this request. also, always set the
|
# easier to recognize the reply for this request. also, always set the
|
||||||
# most significant bit (8) in SoftwareId, to make notifications easier
|
# most significant bit (8) in SoftwareId, to make notifications easier
|
||||||
|
|
|
@ -433,7 +433,6 @@ class Device(object):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def request(self, request_id, *params, no_reply=False):
|
def request(self, request_id, *params, no_reply=False):
|
||||||
|
|
||||||
if self:
|
if self:
|
||||||
return _base.request(
|
return _base.request(
|
||||||
self.handle or self.receiver.handle,
|
self.handle or self.receiver.handle,
|
||||||
|
@ -441,7 +440,8 @@ class Device(object):
|
||||||
request_id,
|
request_id,
|
||||||
*params,
|
*params,
|
||||||
no_reply=no_reply,
|
no_reply=no_reply,
|
||||||
long_message=self.bluetooth or self.protocol >= 2.0
|
long_message=self.bluetooth or self.protocol >= 2.0,
|
||||||
|
protocol=self.protocol
|
||||||
)
|
)
|
||||||
|
|
||||||
def feature_request(self, feature, function=0x00, *params, no_reply=False):
|
def feature_request(self, feature, function=0x00, *params, no_reply=False):
|
||||||
|
|
Loading…
Reference in New Issue