From 5ddb71fea80661ff529bb6acba9e74208526a024 Mon Sep 17 00:00:00 2001 From: Eran Date: Wed, 6 Dec 2023 09:15:41 +0200 Subject: [PATCH 1/5] acroname --list no longer has annoying sleep time --- unit-tests/py/rspy/devices.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/unit-tests/py/rspy/devices.py b/unit-tests/py/rspy/devices.py index ab0145f6fb..65fa859952 100644 --- a/unit-tests/py/rspy/devices.py +++ b/unit-tests/py/rspy/devices.py @@ -204,7 +204,7 @@ def map_unknown_ports(): log.debug_unindent() -def query( monitor_changes = True, hub_reset = False ): +def query( monitor_changes=True, hub_reset=False ): """ Start a new LRS context, and collect all devices :param monitor_changes: If True, devices will update dynamically as they are removed/added @@ -219,8 +219,9 @@ def query( monitor_changes = True, hub_reset = False ): if not acroname.hub: acroname.connect( hub_reset ) # MAY THROW! - acroname.disable_ports( sleep_on_change = 5 ) - acroname.enable_ports( sleep_on_change = MAX_ENUMERATION_TIME ) + if monitor_changes: + acroname.disable_ports( sleep_on_change = 5 ) + acroname.enable_ports( sleep_on_change = MAX_ENUMERATION_TIME ) if platform.system() == 'Linux': global _acroname_hubs @@ -797,7 +798,7 @@ def get_phys_port(dev): else: usage() if action == 'list': - query() + query( monitor_changes=False ) for sn in all(): device = get( sn ) print( '{port} {name:30} {sn:20} {handle}'.format( From 491b711ffc88296a4a138f02c8fd2b4ba71b172b Mon Sep 17 00:00:00 2001 From: Eran Date: Wed, 6 Dec 2023 11:05:33 +0200 Subject: [PATCH 2/5] add devices --none --- unit-tests/py/rspy/devices.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/unit-tests/py/rspy/devices.py b/unit-tests/py/rspy/devices.py index 65fa859952..e4704eccee 100644 --- a/unit-tests/py/rspy/devices.py +++ b/unit-tests/py/rspy/devices.py @@ -752,7 +752,7 @@ def _get_port_by_loc( usb_location ): import os, sys, getopt try: opts,args = getopt.getopt( sys.argv[1:], '', - longopts = [ 'help', 'recycle', 'all', 'list', 'port=', 'ports' ]) + longopts = [ 'help', 'recycle', 'all', 'none', 'list', 'port=', 'ports' ]) except getopt.GetoptError as err: print( '-F-', err ) # something like "option -a not recognized" usage() @@ -786,13 +786,17 @@ 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 ) - acroname.enable_ports( ports, disable_other_ports = True, sleep_on_change = MAX_ENUMERATION_TIME ) + acroname.enable_ports( ports, disable_other_ports=False, sleep_on_change=MAX_ENUMERATION_TIME ) elif opt in ('--ports'): printer = get_phys_port elif opt in ('--all'): if not acroname: log.f( 'No acroname available' ) acroname.enable_ports( sleep_on_change = MAX_ENUMERATION_TIME ) + elif opt in ('--none'): + if not acroname: + log.f( 'No acroname available' ) + acroname.disable_ports() elif opt in ('--recycle'): action = 'recycle' else: From b88f77493fc74f730b872079cb26d8e814c556c5 Mon Sep 17 00:00:00 2001 From: Eran Date: Wed, 6 Dec 2023 11:10:40 +0200 Subject: [PATCH 3/5] fix auto return value error grrrrr --- tools/dds/dds-sniffer/rs-dds-sniffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/dds/dds-sniffer/rs-dds-sniffer.cpp b/tools/dds/dds-sniffer/rs-dds-sniffer.cpp index e732eb45d1..360b0a3e52 100644 --- a/tools/dds/dds-sniffer/rs-dds-sniffer.cpp +++ b/tools/dds/dds-sniffer/rs-dds-sniffer.cpp @@ -49,7 +49,7 @@ constexpr uint8_t GUID_PROCESS_LOCATION = 4; static eprosima::fastrtps::rtps::GuidPrefix_t std_prefix; -static inline auto print_guid( realdds::dds_guid const & guid ) +static inline realdds::print_guid print_guid( realdds::dds_guid const & guid ) { return realdds::print_guid( guid, std_prefix ); } From 81ffd36aab2fa0dbf2b40baa3c94a247c16c3127 Mon Sep 17 00:00:00 2001 From: Eran Date: Wed, 6 Dec 2023 11:24:45 +0200 Subject: [PATCH 4/5] remove list after manual devices enable/disable --- unit-tests/py/rspy/devices.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/unit-tests/py/rspy/devices.py b/unit-tests/py/rspy/devices.py index e4704eccee..60de34d3fe 100644 --- a/unit-tests/py/rspy/devices.py +++ b/unit-tests/py/rspy/devices.py @@ -786,17 +786,20 @@ 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 ) - acroname.enable_ports( ports, disable_other_ports=False, sleep_on_change=MAX_ENUMERATION_TIME ) + acroname.enable_ports( ports, disable_other_ports=False ) + action = 'none' elif opt in ('--ports'): printer = get_phys_port elif opt in ('--all'): if not acroname: log.f( 'No acroname available' ) - acroname.enable_ports( sleep_on_change = MAX_ENUMERATION_TIME ) + acroname.enable_ports() + action = 'none' elif opt in ('--none'): if not acroname: log.f( 'No acroname available' ) acroname.disable_ports() + action = 'none' elif opt in ('--recycle'): action = 'recycle' else: From 9eb78300a018d0907eae067906e914a2cefc3721 Mon Sep 17 00:00:00 2001 From: Eran Date: Wed, 6 Dec 2023 18:40:39 +0200 Subject: [PATCH 5/5] devices.query( recycle_ports=True ) --- unit-tests/py/rspy/devices.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/unit-tests/py/rspy/devices.py b/unit-tests/py/rspy/devices.py index 60de34d3fe..f0a2578171 100644 --- a/unit-tests/py/rspy/devices.py +++ b/unit-tests/py/rspy/devices.py @@ -204,10 +204,13 @@ def map_unknown_ports(): log.debug_unindent() -def query( monitor_changes=True, hub_reset=False ): +def query( monitor_changes=True, hub_reset=False, recycle_ports=True ): """ Start a new LRS context, and collect all devices :param monitor_changes: If True, devices will update dynamically as they are removed/added + :param recycle_ports: True to recycle all ports before querying devices; False to leave as-is + :param hub_reset: Whether we want to reset the Acroname hub - this might be an better way to + recycle the ports in certain cases that leave the ports in a bad state """ global rs if not rs: @@ -219,7 +222,7 @@ def query( monitor_changes=True, hub_reset=False ): if not acroname.hub: acroname.connect( hub_reset ) # MAY THROW! - if monitor_changes: + if recycle_ports: acroname.disable_ports( sleep_on_change = 5 ) acroname.enable_ports( sleep_on_change = MAX_ENUMERATION_TIME ) @@ -805,7 +808,7 @@ def get_phys_port(dev): else: usage() if action == 'list': - query( monitor_changes=False ) + query( monitor_changes=False, recycle_ports=False ) for sn in all(): device = get( sn ) print( '{port} {name:30} {sn:20} {handle}'.format(