From 4cfa90474dec309892a16edf28af0ad43074d430 Mon Sep 17 00:00:00 2001 From: Eran Date: Fri, 24 May 2024 22:22:07 +0300 Subject: [PATCH] add devices.py --PORT <#> to disable others --- unit-tests/py/rspy/devices.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unit-tests/py/rspy/devices.py b/unit-tests/py/rspy/devices.py index cbf175ef516..fc3121592d4 100644 --- a/unit-tests/py/rspy/devices.py +++ b/unit-tests/py/rspy/devices.py @@ -698,7 +698,7 @@ def _get_usb_location( physical_port ): try: opts,args = getopt.getopt( sys.argv[1:], '', - longopts = [ 'help', 'recycle', 'all', 'none', 'list', 'port=', 'ports' ]) + longopts = [ 'help', 'recycle', 'all', 'none', 'list', 'port=', 'PORT=', 'ports' ]) except getopt.GetoptError as err: print( '-F-', err ) # something like "option -a not recognized" usage() @@ -718,7 +718,7 @@ def get_phys_port(dev): for opt,arg in opts: if opt in ('--list'): action = 'list' - elif opt in ('--port'): + elif opt in ('--port','--PORT'): if not hub: log.f( 'No hub available' ) all_ports = hub.all_ports() @@ -726,7 +726,7 @@ def get_phys_port(dev): ports = [int(port) for port in str_ports if port.isnumeric() and int(port) in all_ports] if len(ports) != len(str_ports): log.f( 'Invalid ports', str_ports ) - hub.enable_ports( ports, disable_other_ports=False ) + hub.enable_ports( ports, disable_other_ports=(opt == '--PORT') ) action = 'none' elif opt in ('--ports'): printer = get_phys_port