debug: add warning statements to determine reason for feature request failure
This commit is contained in:
parent
189a50e926
commit
74181125fe
|
|
@ -706,6 +706,14 @@ class Device:
|
|||
long_message=long,
|
||||
protocol=self.protocol,
|
||||
)
|
||||
if logger.isEnabledFor(logging.WARN):
|
||||
logger.warning(
|
||||
"%s: request failure for device %s %s %s",
|
||||
self,
|
||||
self.handle,
|
||||
self.receiver,
|
||||
self.receiver._devices if self.receiver else None,
|
||||
)
|
||||
|
||||
def feature_request(self, feature, function=0x00, *params, no_reply=False):
|
||||
if self.protocol >= 2.0:
|
||||
|
|
@ -730,6 +738,8 @@ class Device:
|
|||
if sub_idx is not None:
|
||||
return self.centurion_bridge_request(sub_idx, function, *params, no_reply=no_reply)
|
||||
return hidpp20.feature_request(self, feature, function, *params, no_reply=no_reply)
|
||||
if logger.isEnabledFor(logging.WARN):
|
||||
logger.warning("%s: feature request failure for device with protocol %s", self, self.protocol)
|
||||
|
||||
# Max sub-message bytes in the first bridge fragment (for 0x51):
|
||||
# 64 - 1 (report ID) - 1 (cpl_len) - 1 (flags) - 2 (bridge prefix) - 2 (bridge hdr) = 57;
|
||||
|
|
|
|||
|
|
@ -1756,6 +1756,10 @@ def feature_request(device, feature, function=0x00, *params, no_reply=False):
|
|||
if feature in device.features:
|
||||
feature_index = device.features[feature]
|
||||
return device.request((feature_index << 8) + (function & 0xFF), *params, no_reply=no_reply)
|
||||
if logger.isEnabledFor(logging.WARN):
|
||||
logger.warning(
|
||||
"%s: feature request failure for device online %s and features %s", device, device.online, device.features
|
||||
)
|
||||
|
||||
|
||||
class Hidpp20:
|
||||
|
|
|
|||
|
|
@ -96,6 +96,8 @@ class _ThreadedHandle:
|
|||
def __str__(self):
|
||||
if self._local:
|
||||
return str(int(self))
|
||||
else:
|
||||
return "None"
|
||||
|
||||
def __repr__(self):
|
||||
return f"<_ThreadedHandle({self.path})>"
|
||||
|
|
|
|||
|
|
@ -171,6 +171,8 @@ class Receiver:
|
|||
self.pairing = Pairing()
|
||||
self.initialize(product_info)
|
||||
hidpp10.set_configuration_pending_flags(self, 0xFF)
|
||||
if logger.isEnabledFor(logging.INFO):
|
||||
logger.info("%s: init receiver: handle %s, path %s, serial %s", self, self.handle, self.path, self.serial)
|
||||
|
||||
def initialize(self, product_info: dict):
|
||||
# read the receiver information subregister, so we can find out max_devices
|
||||
|
|
@ -185,6 +187,8 @@ class Receiver:
|
|||
self.max_devices = product_info.get("max_devices", 1)
|
||||
|
||||
def close(self):
|
||||
if logger.isEnabledFor(logging.INFO):
|
||||
logger.info("%s: closing - handle %s %s", self, type(self.handle), self.handle)
|
||||
handle, self.handle = self.handle, None
|
||||
for _n, d in self._devices.items():
|
||||
if d:
|
||||
|
|
@ -599,9 +603,10 @@ receiver_class_mapping = {
|
|||
|
||||
def create_receiver(low_level: LowLevelInterface, device_info, setting_callback=None) -> Optional[Receiver]:
|
||||
"""Opens a Logitech Receiver found attached to the machine, by Linux device path."""
|
||||
|
||||
try:
|
||||
handle = low_level.open_path(device_info.path)
|
||||
if logger.isEnabledFor(logging.INFO):
|
||||
logger.info("create receiver %s %s", handle, device_info)
|
||||
if handle:
|
||||
usb_id = device_info.product_id
|
||||
if isinstance(usb_id, str):
|
||||
|
|
|
|||
Loading…
Reference in New Issue