rs-enum: use media-ctl for Tegra stream type identification#14908
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates rs-enum.sh’s Tegra/Jetson stream-type identification to prefer media-ctl media-graph entity names (e.g., D4XX depth, D4XX rgb) over pixel-format heuristics, with a fallback to the existing heuristic when media-ctl data is unavailable.
Changes:
- Add
discover_stream_types()to infer depth/color/ir/imu ordering from cachedmedia-ctl --print-dotoutput per I2C address. - Update Tegra device processing to use discovered stream types when available, falling back to
identify_dev_type()otherwise. - Cache Tegra
media-ctlDOT output once to avoid repeatedmedia-ctlinvocations per device.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b0047c5 to
5b799de
Compare
ejgoldik
approved these changes
Apr 9, 2026
Nir-Az
added a commit
that referenced
this pull request
Apr 29, 2026
Nir-Az
added a commit
that referenced
this pull request
Apr 29, 2026
…ats + media-ctl Tegra stream type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace pixel format heuristics with media-ctl entity name discovery for identifying stream types on Tegra/Jetson.
Problem
The previous approach identified streams by pixel format (Z16=depth, GREY=ir, etc.). This is fragile:
Solution
Parse D4XX entity names from the media controller graph (
media-ctl --print-dot). The driver registers entities likeD4XX depth,D4XX rgb,D4XX ir,D4XX imuwhich unambiguously identify the stream type.Changes
get_stream_types()— new function replacingidentify_dev_type(). Queries media-ctl for D4XX entity names and their DS5 mux port connections. Returns stream types in port order. Handles multi-cam on single deserializer by discovering all I2C addresses on the same bus.process_rs_video_devices()— usesget_stream_types()for positional stream type assignment (streaming nodes only, skipping metadata). On Tegra, individual/dev/videoNnodes aren't linked to specific D4XX entities in the media graph — the driver creates them in deterministic DS5 mux port order.create_dfu_link()— fixed DFU device matching by I2C address instead of alphabeticallsorder, which could swap DFU assignments when bus numbers don't sort lexically (e.g. bus 10 before bus 9).Adding new stream types (e.g. safety)
When the driver registers a new entity (e.g.
D4XX safety), support requires:scripts/rs-enum.sh: Add the mapping tocamera_names(e.g.[safety]=safety), add a counter (safety_dev_counter), and updateget_dev_num()/increment_dev_num(). The media-ctl discovery picks up the new entity automatically.src/linux/backend-v4l2.cpp: Add"safety"to thevideo_sensorsvector inget_mipi_rs_enum_nodes()(line 1282) and set the appropriateinfo.mivalue.Test plan
Test results
D457 on single Intel Des

FangZhu with 2 cam on 1 des
● Both cameras enumerated correctly:
FungZhu 2 cam each on a different des
