Skip to content

add multiple hubs support - #13978

Merged
Nir-Az merged 3 commits into
realsenseai:developmentfrom
AviaAv:multiple_hubs
May 6, 2025
Merged

add multiple hubs support#13978
Nir-Az merged 3 commits into
realsenseai:developmentfrom
AviaAv:multiple_hubs

Conversation

@AviaAv

@AviaAv AviaAv commented May 4, 2025

Copy link
Copy Markdown
Contributor

Tracked on: [LRS-1223]

@AviaAv
AviaAv requested a review from Nir-Az May 4, 2025 12:26
run_time_stopwatch = Stopwatch()
run_time_threshold = 5 if is_dds else 2 # currently, DDS devices take longer time to complete rs_enumerate_devices
p = subprocess.run( [rs_enumerate_devices],
p = subprocess.run( [rs_enumerate_devices, "--no-dds" if not is_dds else ""],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should somehow align the test for DDS devices also somehow?
It's a good test for D555 too
Please add it to the adding tests for D555 ticket

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is already aligned for DDS devices and passes there

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But once you turn on DDS is_dds will always be true no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, is_dds is true only if the connection type is DDS, for USB it should still be False

Comment thread unit-tests/py/rspy/combined_hub.py Outdated
return self.hub_port_to_virtual_port[(name, int(port))]
return None

# recycle_ports inherited; uses ports(), disable_ports(), enable_ports()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this comment means?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Old comment, I will remove

return unifi_hub
active_hubs.append(unifi_hub)

if len(active_hubs) > 1:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not working always with the combined hub?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to simplify when it's not needed - if there's one hub we can do:

devices -> hub

instead of

devices -> combined hub -> hub

self._is_dds = False

self._usb_location = None
self._location = None # might be either usb location or mac address

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will happen on GMSL?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently it will hold None, but will fixed as I said on the other comment

Comment thread unit-tests/py/rspy/devices.py Outdated
try:
self._usb_location = _get_usb_location(self._physical_port)
if self._is_dds:
self._location = get_mac_address(dev)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GMSL handling?
Today we always get this error
image
Maybe you an handle it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll call _get_usb_location(self._physical_port) only if the connection type is "USB", otherwise I'll print it's GMSL

# Get all devices, and store by serial-number
global _device_by_sn, _context, _port_to_sn
settings = {}
settings = {'dds' : { 'enabled' : True }} # explicitly enable dds in case there's an issue with the config file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will happen in the private branch when BUILD_WITH_DDS=OFF?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried checking locally with this flag off and seeing no issue, so should be fine there too

print( ' --enable Enable all ports' )
print( ' --disable Disable all ports' )
print( ' --recycle Recycle all ports' )
print( ' --enable=<ports> Enable <ports>' )

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add an example how you need ports to be transferred?
With spaces? commas?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print( ' <ports> is a comma-separated list of port numbers, or empty for all ports' )

a few lines after this, need to add an example here too?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed it, maybe shift it up after the last argument that accept ports? your call

@Nir-Az Nir-Az left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great overall, nice work.
I approve but added a few comments for you to consider.
Once you update all comments we can merge it

@Nir-Az
Nir-Az merged commit 019851f into realsenseai:development May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants