diff --git a/lib/logitech_receiver/device.py b/lib/logitech_receiver/device.py index 3bd6618b..601ea329 100644 --- a/lib/logitech_receiver/device.py +++ b/lib/logitech_receiver/device.py @@ -31,6 +31,7 @@ class Device(object): def __init__(self, receiver, number, link_notification=None, info=None): assert receiver or info self.receiver = receiver + self.isDevice = True # some devices act as receiver so we need a property to distinguish them if receiver: assert number > 0 and number <= receiver.max_devices diff --git a/lib/logitech_receiver/receiver.py b/lib/logitech_receiver/receiver.py index f2ccce27..4eb5b749 100644 --- a/lib/logitech_receiver/receiver.py +++ b/lib/logitech_receiver/receiver.py @@ -53,6 +53,7 @@ class Receiver(object): self.handle = handle assert device_info self.path = device_info.path + self.isDevice = False # some devices act as receiver so we need a property to distinguish them # USB product id, used for some Nano receivers self.product_id = device_info.product_id product_info = _product_information(self.product_id) diff --git a/lib/solaar/cli/__init__.py b/lib/solaar/cli/__init__.py index 89db55ef..72722362 100644 --- a/lib/solaar/cli/__init__.py +++ b/lib/solaar/cli/__init__.py @@ -152,10 +152,13 @@ def _find_device(receivers, name): number = None for r in receivers: - if number and number <= r.max_devices: - dev = r[number] - if dev: - return dev + if not r.isDevice: # look for nth device of receiver + if number and number <= r.max_devices: + dev = r[number] + if dev: + return dev + else: # wired device, make a device list from it + r = [r] for dev in r: if ( @@ -185,7 +188,7 @@ def run(cli_args=None, hidraw_path=None): try: c = list(_receivers(hidraw_path)) - if action == 'show': + if action == 'show' or action == 'probe' or action == 'config': c += list(_wired_devices(hidraw_path)) if not c: diff --git a/lib/solaar/cli/probe.py b/lib/solaar/cli/probe.py index 59246490..4e77fd8e 100644 --- a/lib/solaar/cli/probe.py +++ b/lib/solaar/cli/probe.py @@ -22,7 +22,7 @@ from __future__ import absolute_import, division, print_function, unicode_litera from logitech_receiver import base as _base from logitech_receiver import hidpp10 as _hidpp10 from logitech_receiver.common import strhex as _strhex -from solaar.cli.show import _print_receiver +from solaar.cli.show import _print_device, _print_receiver _R = _hidpp10.REGISTERS @@ -38,7 +38,11 @@ def run(receivers, args, find_receiver, _ignore): else: receiver = receivers[0] - assert receiver + assert receiver is not None + + if receiver.isDevice: + _print_device(receiver, 1) + return _print_receiver(receiver)