device: catch errors when pinging to try to put device online
This commit is contained in:
parent
4669cad2e1
commit
b2eb039e2d
|
@ -195,7 +195,10 @@ class Device:
|
|||
def name(self):
|
||||
if not self._name:
|
||||
if not self.online: # be very defensive
|
||||
self.ping()
|
||||
try:
|
||||
self.ping()
|
||||
except _base.NoSuchDevice:
|
||||
pass
|
||||
if self.online and self.protocol >= 2.0:
|
||||
self._name = _hidpp20.get_name(self)
|
||||
return self._name or self._codename or ('Unknown device %s' % (self.wpid or self.product_id))
|
||||
|
|
Loading…
Reference in New Issue