diff --git a/lib/solaar/cli/show.py b/lib/solaar/cli/show.py index 284bb39be..b7fcd0093 100644 --- a/lib/solaar/cli/show.py +++ b/lib/solaar/cli/show.py @@ -16,6 +16,7 @@ ## with this program; if not, write to the Free Software Foundation, Inc., ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +from logitech_receiver import base as _base from logitech_receiver import hidpp10 as _hidpp10 from logitech_receiver import hidpp20 as _hidpp20 from logitech_receiver import receiver as _receiver @@ -81,8 +82,12 @@ def _battery_line(dev): def _print_device(dev, num=None): assert dev is not None - # check if the device is online - dev.ping() + # try to ping the device to see if it actually exists and to wake it up + try: + dev.ping() + except _base.NoSuchDevice: + print(' %d: Device not found' % num or dev.number) + return print(' %d: %s' % (num or dev.number, dev.name)) print(' Device path :', dev.path)