forked from drath/libratbag
tools: do a simple name match if we can't find the device
If the specific name isn't the list (e.g. howling-woodrat) do a basic string search on all the device names. For the normal case where users have only one or maybe two devices and they have unique model names, they can do ratbagctl "Logitech G303" info Which is something we can easily support forever as sensible API. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
committed by
Benjamin Tissoires
parent
16daac7311
commit
f3df391d71
@@ -67,6 +67,9 @@ def list_devices(r, args):
|
||||
def find_device(r, args):
|
||||
dev = r[args.device]
|
||||
if dev is None:
|
||||
for d in r.devices:
|
||||
if args.device in d.name:
|
||||
return d
|
||||
print("Unable to find device {}".format(args.device))
|
||||
sys.exit(1)
|
||||
return dev
|
||||
|
||||
Reference in New Issue
Block a user