device: check device is active before performing request and don't replace empty settings
This commit is contained in:
parent
3fb197b78c
commit
985ebd46cd
|
@ -231,7 +231,9 @@ class Device(object):
|
||||||
if self.online and self.protocol >= 2.0:
|
if self.online and self.protocol >= 2.0:
|
||||||
ids = _hidpp20.get_ids(self)
|
ids = _hidpp20.get_ids(self)
|
||||||
if ids:
|
if ids:
|
||||||
self._unitId, self._modelId, self._tid_map = _hidpp20.get_ids(self)
|
self._unitId, self._modelId, self._tid_map = ids
|
||||||
|
if _log.isEnabledFor(_INFO) and self._serial and self._serial != self._unitId:
|
||||||
|
_log.info('%s: unitId %s does not match serial %s', self, self._unitId, self._serial)
|
||||||
return self._modelId
|
return self._modelId
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -240,7 +242,9 @@ class Device(object):
|
||||||
if self.online and self.protocol >= 2.0:
|
if self.online and self.protocol >= 2.0:
|
||||||
ids = _hidpp20.get_ids(self)
|
ids = _hidpp20.get_ids(self)
|
||||||
if ids:
|
if ids:
|
||||||
self._unitId, self._modelId, self._tid_map = _hidpp20.get_ids(self)
|
self._unitId, self._modelId, self._tid_map = ids
|
||||||
|
if _log.isEnabledFor(_INFO) and self._serial and self._serial != self._unitId:
|
||||||
|
_log.info('%s: unitId %s does not match serial %s', self, self._unitId, self._serial)
|
||||||
return self._tid_map
|
return self._tid_map
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -330,10 +334,9 @@ class Device(object):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def settings(self):
|
def settings(self):
|
||||||
if self._settings is None:
|
if not self._settings:
|
||||||
self._settings = []
|
self._settings = []
|
||||||
if self.descriptor and self.descriptor.settings and self.persister:
|
if self.persister and self.descriptor and self.descriptor.settings:
|
||||||
self._settings = []
|
|
||||||
for s in self.descriptor.settings:
|
for s in self.descriptor.settings:
|
||||||
try:
|
try:
|
||||||
setting = s(self)
|
setting = s(self)
|
||||||
|
@ -427,14 +430,16 @@ 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):
|
||||||
return _base.request(
|
|
||||||
self.handle or self.receiver.handle,
|
if self:
|
||||||
self.number,
|
return _base.request(
|
||||||
request_id,
|
self.handle or self.receiver.handle,
|
||||||
*params,
|
self.number,
|
||||||
no_reply=no_reply,
|
request_id,
|
||||||
long_message=self.bluetooth or self.protocol >= 2.0
|
*params,
|
||||||
)
|
no_reply=no_reply,
|
||||||
|
long_message=self.bluetooth or self.protocol >= 2.0
|
||||||
|
)
|
||||||
|
|
||||||
def feature_request(self, feature, function=0x00, *params, no_reply=False):
|
def feature_request(self, feature, function=0x00, *params, no_reply=False):
|
||||||
if self.protocol >= 2.0:
|
if self.protocol >= 2.0:
|
||||||
|
|
Loading…
Reference in New Issue