diff --git a/0001-Jetson-Orin-JP6-install.patch b/0001-Jetson-Orin-JP6-install.patch new file mode 100644 index 00000000000..71bf8279540 --- /dev/null +++ b/0001-Jetson-Orin-JP6-install.patch @@ -0,0 +1,44 @@ +From 13de8e8afacb1a56c63875cf978f5070c6d05a61 Mon Sep 17 00:00:00 2001 +From: Dmitry Perchanov +Date: Mon, 18 Mar 2024 11:54:03 +0200 +Subject: [PATCH] Jetson-Orin-JP6-install + +Signed-off-by: Dmitry Perchanov +--- + doc/installation_jetson.md | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/doc/installation_jetson.md b/doc/installation_jetson.md +index b1c4febd2..22095737d 100644 +--- a/doc/installation_jetson.md ++++ b/doc/installation_jetson.md +@@ -8,12 +8,15 @@ + + ### 1. Prerequisites + +-* Nvidia® **Jetson Nano™**, **Jetson TX2™** and **Jetson AGX Xavier™** board (may also work on other Jetson devices) ++* Nvidia® **Jetson Nano™**, **Jetson TX2™**, **Jetson AGX Xavier™** and **Jetson Orin** board (may also work on other Jetson devices) + * RealSense **D415**, **D435**, **D435i**, **D455** and **L515** Camera devices. + + ### 2. Establish Developer's Environment + +-Follow [official instructions](https://developer.nvidia.com/embedded/learn/getting-started-jetson) to get your board ready. This guide will assume you are using **Nvidia® L4T Ubuntu 16.04/18.04/20.04** image with kernels 4.9/5.10. Note that in most cases it is necessary to install a toll named "SDK Manager" to flash and install **Jetson** boards with both the L4T (Linux for Tegra) and Nvidia-specific software packages (CUDA, Tensor Flow, AI, etc.) ++Follow [official instructions](https://developer.nvidia.com/embedded/learn/getting-started-jetson) to get your board ready. This guide will assume you are using **Nvidia® L4T Ubuntu 16.04/18.04/20.04/22.04** image with kernels 4.9/5.10/5.15. Note that in most cases it is necessary to install a toll named "SDK Manager" to flash and install **Jetson** boards with both the L4T (Linux for Tegra) and Nvidia-specific software packages (CUDA, Tensor Flow, AI, etc.) ++ ++For **Jetson Orin™** with JetPack 6.0 you will need to follow build for MIPI driver as Nvidia released Kernel 5.15 default configuration with disabled HID: [Intel® RealSense™ camera driver for GMSL* interface](https://github.com/IntelRealSense/realsense_mipi_platform_driver) ++ + For **Jetson Nano™** we strongly recommend enabling the Barrel Jack connector for extra power (See [jetsonhacks.com/jetson-nano-use-more-power/](https://www.jetsonhacks.com/2019/04/10/jetson-nano-use-more-power/) to learn how) + + ![Jetson Nano](./img/jetson.jpg) +@@ -94,6 +97,8 @@ The method was verified with **Jetson AGX** boards with JetPack **4.2.3**[L4T 32 + + The method has not yet been verified on the **Jetson Nano** board. + ++This method incompatible for board **Jetson Orin™** with JetPack 6.0, checkout [Intel® RealSense™ camera driver for GMSL* interface](https://github.com/IntelRealSense/realsense_mipi_platform_driver) ++ + * **Prerequisite** + + * Verify the board type and Jetpack versions compatibility. +-- +2.34.1 + diff --git a/0001-backend-mipi-dfu-default-nodes.patch b/0001-backend-mipi-dfu-default-nodes.patch new file mode 100644 index 00000000000..0f435008d76 --- /dev/null +++ b/0001-backend-mipi-dfu-default-nodes.patch @@ -0,0 +1,38 @@ +From 85631659a87f9ecaabc5d6290db5c311770a2da3 Mon Sep 17 00:00:00 2001 +From: Dmitry Perchanov +Date: Tue, 12 Mar 2024 14:12:24 +0200 +Subject: [PATCH] backend: mipi dfu default nodes + +Tracked-by: [RSDSO-19611] + +Signed-off-by: Dmitry Perchanov +--- + src/linux/backend-v4l2.cpp | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/src/linux/backend-v4l2.cpp b/src/linux/backend-v4l2.cpp +index 6455a6f26..974827d48 100644 +--- a/src/linux/backend-v4l2.cpp ++++ b/src/linux/backend-v4l2.cpp +@@ -886,7 +886,17 @@ namespace librealsense + // assign unique id for mipi by appending camera id to bus_info (bus_info is same for each mipi port) + // Note - jetson can use only bus_info, as card is different for each sensor and metadata node. + info.unique_id = bus_info + "-" + std::to_string(cam_id); // use bus_info as per camera unique id for mipi +- info.dfu_device_path = "/dev/d4xx-dfu504"; // Use legacy DFU device node used in firmware_update_manager ++ // Get DFU node for MIPI camera ++ std::array dfu_device_paths = {"/dev/d4xx-dfu504", "/dev/d4xx-dfu-30-0010"}; ++ for (const auto& dfu_device_path: dfu_device_paths) { ++ int vfd = open(dfu_device_path.c_str(), O_RDONLY | O_NONBLOCK); ++ if (vfd >= 0) { ++ // Use legacy DFU device node used in firmware_update_manager ++ info.dfu_device_path = dfu_device_path; ++ ::close(vfd); // file exists, close file and continue to assign it ++ break; ++ } ++ } + info.conn_spec = usb_specification; + info.uvc_capabilities = get_dev_capabilities(dev_name).device_caps; + +-- +2.34.1 + diff --git a/0001-l4t-uvc-patch-fix-localversion.patch b/0001-l4t-uvc-patch-fix-localversion.patch new file mode 100644 index 00000000000..39efac8af17 --- /dev/null +++ b/0001-l4t-uvc-patch-fix-localversion.patch @@ -0,0 +1,26 @@ +From 677c571238452c72331e35a864e957511ebbc04d Mon Sep 17 00:00:00 2001 +From: Dmitry Perchanov +Date: Tue, 26 Mar 2024 14:43:26 +0200 +Subject: [PATCH] l4t: uvc patch fix localversion + +Signed-off-by: Dmitry Perchanov +--- + scripts/patch-realsense-ubuntu-L4T.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/patch-realsense-ubuntu-L4T.sh b/scripts/patch-realsense-ubuntu-L4T.sh +index e58a2c79a..4205bc6b2 100755 +--- a/scripts/patch-realsense-ubuntu-L4T.sh ++++ b/scripts/patch-realsense-ubuntu-L4T.sh +@@ -140,7 +140,7 @@ if [ "4.4" = "$PATCHES_REV" ]; then + sed -i '/CONFIG_HID_SENSOR_GYRO_3D/c\CONFIG_HID_SENSOR_GYRO_3D=m' .config + sed -i '/CONFIG_HID_SENSOR_IIO_COMMON/c\CONFIG_HID_SENSOR_IIO_COMMON=m\nCONFIG_HID_SENSOR_IIO_TRIGGER=m' .config + fi +-make ARCH=arm64 prepare modules_prepare -j$(($(nproc)-1)) ++make ARCH=arm64 prepare modules_prepare LOCALVERSION='' -j$(($(nproc)-1)) + + #Remove previously applied patches + git reset --hard +-- +2.34.1 + diff --git a/media-ctl_print-dot.txt b/media-ctl_print-dot.txt new file mode 100644 index 00000000000..cd93677b122 --- /dev/null +++ b/media-ctl_print-dot.txt @@ -0,0 +1,111 @@ +digraph board { + rankdir=TB + n00000001 [label="{{ 0} | 13e10000.host1x:nvcsi@15a00000-\n/dev/v4l-subdev0 | { 1}}", shape=Mrecord, style=filled, fillcolor=green] + n00000001:port1 -> n0000002f + n00000004 [label="{{ 0} | 13e10000.host1x:nvcsi@15a00000-\n/dev/v4l-subdev1 | { 1}}", shape=Mrecord, style=filled, fillcolor=green] + n00000004:port1 -> n0000006b + n00000007 [label="{{ 0} | 13e10000.host1x:nvcsi@15a00000-\n/dev/v4l-subdev2 | { 1}}", shape=Mrecord, style=filled, fillcolor=green] + n00000007:port1 -> n00000097 + n0000000a [label="{{ 0} | 13e10000.host1x:nvcsi@15a00000-\n/dev/v4l-subdev3 | { 1}}", shape=Mrecord, style=filled, fillcolor=green] + n0000000a:port1 -> n000000bf + n0000000d [label="{{ 0} | 13e10000.host1x:nvcsi@15a00000-\n/dev/v4l-subdev4 | { 1}}", shape=Mrecord, style=filled, fillcolor=green] + n0000000d:port1 -> n000000e7 + n00000010 [label="{{ 0} | 13e10000.host1x:nvcsi@15a00000-\n/dev/v4l-subdev5 | { 1}}", shape=Mrecord, style=filled, fillcolor=green] + n00000010:port1 -> n00000113 + n00000013 [label="{{ 0} | 13e10000.host1x:nvcsi@15a00000-\n/dev/v4l-subdev6 | { 1}}", shape=Mrecord, style=filled, fillcolor=green] + n00000013:port1 -> n0000013f + n00000016 [label="{{ 0} | 13e10000.host1x:nvcsi@15a00000-\n/dev/v4l-subdev7 | { 1}}", shape=Mrecord, style=filled, fillcolor=green] + n00000016:port1 -> n00000167 + n00000019 [label="{{ 1 | 2 | 3 | 4} | DS5 mux 30-001a\n/dev/v4l-subdev12 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n00000019:port0 -> n00000001:port0 + n0000001f [label="{{} | D4XX depth 30-001a\n/dev/v4l-subdev8 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n0000001f:port0 -> n00000019:port1 [style=bold] + n00000023 [label="{{} | D4XX ir 30-001a\n/dev/v4l-subdev9 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n00000023:port0 -> n00000019:port3 [style=bold] + n00000027 [label="{{} | D4XX rgb 30-001a\n/dev/v4l-subdev10 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n00000027:port0 -> n00000019:port2 [style=bold] + n0000002b [label="{{} | D4XX imu 30-001a\n/dev/v4l-subdev11 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n0000002b:port0 -> n00000019:port4 [style=bold] + n0000002f [label="vi-output, DS5 mux 30-001a\n/dev/video4", shape=box, style=filled, fillcolor=yellow] + n00000037 [label="tegra-capture-vi-metadata-0\n/dev/video5", shape=box, style=filled, fillcolor=yellow] + n00000055 [label="{{ 1 | 2 | 3 | 4} | DS5 mux 31-001a\n/dev/v4l-subdev17 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n00000055:port0 -> n00000004:port0 + n0000005b [label="{{} | D4XX depth 31-001a\n/dev/v4l-subdev13 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n0000005b:port0 -> n00000055:port1 [style=bold] + n0000005f [label="{{} | D4XX ir 31-001a\n/dev/v4l-subdev14 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n0000005f:port0 -> n00000055:port3 [style=bold] + n00000063 [label="{{} | D4XX rgb 31-001a\n/dev/v4l-subdev15 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n00000063:port0 -> n00000055:port2 [style=bold] + n00000067 [label="{{} | D4XX imu 31-001a\n/dev/v4l-subdev16 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n00000067:port0 -> n00000055:port4 [style=bold] + n0000006b [label="vi-output, DS5 mux 31-001a\n/dev/video6", shape=box, style=filled, fillcolor=yellow] + n00000073 [label="tegra-capture-vi-metadata-0\n/dev/video7", shape=box, style=filled, fillcolor=yellow] + n00000081 [label="{{ 1 | 2 | 3 | 4} | DS5 mux 32-001a\n/dev/v4l-subdev22 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n00000081:port0 -> n00000007:port0 + n00000087 [label="{{} | D4XX depth 32-001a\n/dev/v4l-subdev18 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n00000087:port0 -> n00000081:port1 [style=bold] + n0000008b [label="{{} | D4XX ir 32-001a\n/dev/v4l-subdev19 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n0000008b:port0 -> n00000081:port3 [style=bold] + n0000008f [label="{{} | D4XX rgb 32-001a\n/dev/v4l-subdev20 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n0000008f:port0 -> n00000081:port2 [style=bold] + n00000093 [label="{{} | D4XX imu 32-001a\n/dev/v4l-subdev21 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n00000093:port0 -> n00000081:port4 [style=bold] + n00000097 [label="vi-output, DS5 mux 32-001a\n/dev/video8", shape=box, style=filled, fillcolor=yellow] + n000000a9 [label="{{ 1 | 2 | 3 | 4} | DS5 mux 33-001a\n/dev/v4l-subdev27 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n000000a9:port0 -> n0000000a:port0 + n000000af [label="{{} | D4XX depth 33-001a\n/dev/v4l-subdev23 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n000000af:port0 -> n000000a9:port1 [style=bold] + n000000b3 [label="{{} | D4XX ir 33-001a\n/dev/v4l-subdev24 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n000000b3:port0 -> n000000a9:port3 [style=bold] + n000000b7 [label="{{} | D4XX rgb 33-001a\n/dev/v4l-subdev25 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n000000b7:port0 -> n000000a9:port2 [style=bold] + n000000bb [label="{{} | D4XX imu 33-001a\n/dev/v4l-subdev26 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n000000bb:port0 -> n000000a9:port4 [style=bold] + n000000bf [label="vi-output, DS5 mux 33-001a\n/dev/video9", shape=box, style=filled, fillcolor=yellow] + n000000d1 [label="{{ 1 | 2 | 3 | 4} | DS5 mux 34-001b\n/dev/v4l-subdev32 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n000000d1:port0 -> n0000000d:port0 + n000000d7 [label="{{} | D4XX depth 34-001b\n/dev/v4l-subdev28 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n000000d7:port0 -> n000000d1:port1 [style=bold] + n000000db [label="{{} | D4XX ir 34-001b\n/dev/v4l-subdev29 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n000000db:port0 -> n000000d1:port3 [style=bold] + n000000df [label="{{} | D4XX rgb 34-001b\n/dev/v4l-subdev30 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n000000df:port0 -> n000000d1:port2 [style=bold] + n000000e3 [label="{{} | D4XX imu 34-001b\n/dev/v4l-subdev31 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n000000e3:port0 -> n000000d1:port4 [style=bold] + n000000e7 [label="vi-output, DS5 mux 34-001b\n/dev/video10", shape=box, style=filled, fillcolor=yellow] + n000000ef [label="tegra-capture-vi-metadata-0\n/dev/video11", shape=box, style=filled, fillcolor=yellow] + n000000fd [label="{{ 1 | 2 | 3 | 4} | DS5 mux 35-001b\n/dev/v4l-subdev37 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n000000fd:port0 -> n00000010:port0 + n00000103 [label="{{} | D4XX depth 35-001b\n/dev/v4l-subdev33 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n00000103:port0 -> n000000fd:port1 [style=bold] + n00000107 [label="{{} | D4XX ir 35-001b\n/dev/v4l-subdev34 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n00000107:port0 -> n000000fd:port3 [style=bold] + n0000010b [label="{{} | D4XX rgb 35-001b\n/dev/v4l-subdev35 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n0000010b:port0 -> n000000fd:port2 [style=bold] + n0000010f [label="{{} | D4XX imu 35-001b\n/dev/v4l-subdev36 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n0000010f:port0 -> n000000fd:port4 [style=bold] + n00000113 [label="vi-output, DS5 mux 35-001b\n/dev/video12", shape=box, style=filled, fillcolor=yellow] + n0000011b [label="tegra-capture-vi-metadata-0\n/dev/video13", shape=box, style=filled, fillcolor=yellow] + n00000129 [label="{{ 1 | 2 | 3 | 4} | DS5 mux 36-001b\n/dev/v4l-subdev42 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n00000129:port0 -> n00000013:port0 + n0000012f [label="{{} | D4XX depth 36-001b\n/dev/v4l-subdev38 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n0000012f:port0 -> n00000129:port1 [style=bold] + n00000133 [label="{{} | D4XX ir 36-001b\n/dev/v4l-subdev39 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n00000133:port0 -> n00000129:port3 [style=bold] + n00000137 [label="{{} | D4XX rgb 36-001b\n/dev/v4l-subdev40 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n00000137:port0 -> n00000129:port2 [style=bold] + n0000013b [label="{{} | D4XX imu 36-001b\n/dev/v4l-subdev41 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n0000013b:port0 -> n00000129:port4 [style=bold] + n0000013f [label="vi-output, DS5 mux 36-001b\n/dev/video14", shape=box, style=filled, fillcolor=yellow] + n00000151 [label="{{ 1 | 2 | 3 | 4} | DS5 mux 37-001b\n/dev/v4l-subdev47 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n00000151:port0 -> n00000016:port0 + n00000157 [label="{{} | D4XX depth 37-001b\n/dev/v4l-subdev43 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n00000157:port0 -> n00000151:port1 [style=bold] + n0000015b [label="{{} | D4XX ir 37-001b\n/dev/v4l-subdev44 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n0000015b:port0 -> n00000151:port3 [style=bold] + n0000015f [label="{{} | D4XX rgb 37-001b\n/dev/v4l-subdev45 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n0000015f:port0 -> n00000151:port2 [style=bold] + n00000163 [label="{{} | D4XX imu 37-001b\n/dev/v4l-subdev46 | { 0}}", shape=Mrecord, style=filled, fillcolor=green] + n00000163:port0 -> n00000151:port4 [style=bold] + n00000167 [label="vi-output, DS5 mux 37-001b\n/dev/video15", shape=box, style=filled, fillcolor=yellow] +} diff --git a/rs-enum.sh b/rs-enum.sh new file mode 100755 index 00000000000..87a8c1be9af --- /dev/null +++ b/rs-enum.sh @@ -0,0 +1,244 @@ +#!/bin/bash +# Create symbolic links for video nodes and for metadata nodes - /dev/video-rs-[|-md]-[camera-index] +# This script intended for mipi devices on Jetson and IPU6. +# After running this script in enumeration mode, it will create links as follow for example: +# Example of the output: +# +# Jetson: +# $ ./rs-enum.sh +# Bus Camera Sensor Node Type Video Node RS Link +# mipi 0 depth Streaming /dev/video0 /dev/video-rs-depth-0 +# mipi 0 depth Metadata /dev/video1 /dev/video-rs-depth-md-0 +# mipi 0 color Streaming /dev/video2 /dev/video-rs-color-0 +# mipi 0 color Metadata /dev/video3 /dev/video-rs-color-md-0 +# mipi 0 ir Streaming /dev/video4 /dev/video-rs-ir-0 +# mipi 0 imu Streaming /dev/video5 /dev/video-rs-imu-0 +# +# Alderlake: +#$ ./rs-enum.sh +#Bus Camera Sensor Node Type Video Node RS Link +# ipu6 0 depth Streaming /dev/video4 /dev/video-rs-depth-0 +# ipu6 0 depth Metadata /dev/video5 /dev/video-rs-depth-md-0 +# ipu6 0 ir Streaming /dev/video8 /dev/video-rs-ir-0 +# ipu6 0 imu Streaming /dev/video9 /dev/video-rs-imu-0 +# ipu6 0 color Streaming /dev/video6 /dev/video-rs-color-0 +# ipu6 0 color Metadata /dev/video7 /dev/video-rs-color-md-0 +# i2c 0 d4xx Firmware /dev/d4xx-dfu-a /dev/d4xx-dfu-0 +# ipu6 2 depth Streaming /dev/video36 /dev/video-rs-depth-2 +# ipu6 2 depth Metadata /dev/video37 /dev/video-rs-depth-md-2 +# ipu6 2 ir Streaming /dev/video40 /dev/video-rs-ir-2 +# ipu6 2 imu Streaming /dev/video41 /dev/video-rs-imu-2 +# ipu6 2 color Streaming /dev/video38 /dev/video-rs-color-2 +# ipu6 2 color Metadata /dev/video39 /dev/video-rs-color-md-2 +# i2c 2 d4xx Firmware /dev/d4xx-dfu-c /dev/d4xx-dfu-2 + +# Dependency: v4l-utils +v4l2_util=$(which v4l2-ctl) +media_util=$(which media-ctl) +if [ -z ${v4l2_util} ]; then + echo "v4l2-ctl not found, install with: sudo apt install v4l-utils" + exit 1 +fi +metadata_enabled=1 +# +# parse command line parameters +# for '-i' parameter, print links only +while [[ $# -gt 0 ]]; do + case $1 in + -i|--info) + info=1 + shift + ;; + -q|--quiet) + quiet=1 + shift + ;; + -m|--mux) + shift + mux_param=$1 + shift + ;; + -n|--no-metadata) + metadata_enabled=0 + shift + ;; + -f|--file) + shift + dot=$(cat $1) + shift + ;; + *) + info=0 + quiet=0 + shift + ;; + esac +done +#set -x +if [[ $info -eq 0 ]]; then + if [ "$(id -u)" -ne 0 ]; then + echo "Please run as root." >&2 + exit 1 + fi +fi + +mux_list=${mux_param:-'a b c d e f g h'} + +declare -A camera_idx=( [a]=0 [b]=1 [c]=2 [d]=3 [e]=4 [f]=5 [g]=6 [h]=7) +declare -A d4xx_vc_named=([depth]=1 [rgb]=3 [ir]=5 [imu]=6) +declare -A camera_names=( [depth]=depth [rgb]=color [ir]=ir [imu]=imu ) + +camera_vid=("depth" "depth-md" "color" "color-md" "ir" "imu") + + +#mdev=$(${v4l2_util} --list-devices | grep -A1 tegra | grep media) +mdev="tegra" +# For Jetson we have `simple` method +if [ -n "${mdev}" ]; then +# cache media-ctl output +if [ -z "${dot}" ]; then + dot=$(${media_util} -d ${mdev} --print-dot) +fi +vid_dev_idx=$(echo "${dot}" | grep "DS5 mux" | grep "vi-output" | tr '\\n' '\n' | grep video | awk -F'"' '{print $1}' | grep -Po "\\d+") +[[ -z ${vid_dev_idx} ]] && exit 0 +[[ $quiet -eq 0 ]] && printf "Bus\tCamera\tSensor\tNode Type\tVideo Node\tRS Link\n" +vid_dev_idx_arr=($(echo $vid_dev_idx | tr " " "\n")) +idx_0=${vid_dev_idx_arr[0]} + for i in $vid_dev_idx; do + vid="/dev/video${i}" +# [[ ! -c "${vid}" ]] && break +# cam_id=$((i/6)) +# sens_id=$((i%6)) + cam_id=$(((i-${idx_0})/6)) + sens_id=$(((i-${idx_0})%6)) +# dev_name=$(${v4l2_util} -d ${vid} -D | grep 'Driver name' | head -n1 | awk -F' : ' '{print $2}') + dev_name="tegra-video" + bus="mipi" + if [ "${dev_name}" = "tegra-video" ]; then + dev_ln="/dev/video-rs-${camera_vid[${sens_id}]}-${cam_id}" + else + continue + fi + type="Streaming" + sensor_name=$(echo "${camera_vid[${sens_id}]}" | awk -F'-' '{print $1}') + [[ $quiet -eq 0 ]] && printf '%s\t%d\t%s\t%s\t%s\t%s\n' ${bus} ${cam_id} ${sensor_name} ${type} ${vid} ${dev_ln} + + # create link only in case we choose not only to show it + if [[ $info -eq 0 ]]; then + [[ -e $dev_ln ]] && unlink $dev_ln + ln -s $vid $dev_ln + if [[ "${sensor_name}" == 'depth' ]]; then + # Create DFU device link for camera on jetson + i2cdev=$(echo "${dot}" | grep "${vid}" | tr '\\n' ' ' | awk '{print $5}') + dev_dfu_name="/dev/d4xx-dfu-${i2cdev}" + dev_dfu_ln="/dev/d4xx-dfu-${cam_id}" + [[ -e $dev_dfu_ln ]] && unlink $dev_dfu_ln + ln -s $dev_dfu_name $dev_dfu_ln + fi + fi + # find metadata + # skip IR and imu metadata node for now. + [[ ${sensor_name} == 'ir' ]] && continue + [[ ${sensor_name} == 'imu' ]] && continue + + i=$((i+1)) +# sens_id=$((i%6)) +sens_id=$(((i-${idx_0})%6)) + type="Metadata" + vid="/dev/video${i}" +# [[ ! -c "${vid}" ]] && break +# dev_name=$(${v4l2_util} -d ${vid} -D | grep 'Driver name' | head -n1 | awk -F' : ' '{print $2}') +dev_name="tegra-embedded" + if [ "${dev_name}" = "tegra-embedded" ]; then + dev_md_ln="/dev/video-rs-${camera_vid[${sens_id}]}-${cam_id}" + else + continue + fi + sensor_name=$(echo "${camera_vid[${sens_id}]}" | awk -F'-' '{print $1}') + [[ $quiet -eq 0 ]] && printf '%s\t%d\t%s\t%s\t%s\t%s\n' ${bus} ${cam_id} ${sensor_name} ${type} ${vid} ${dev_md_ln} + + # create link only in case we choose not only to show it + if [[ $info -eq 0 ]]; then + [[ -e $dev_md_ln ]] && unlink $dev_md_ln + ln -s $vid $dev_md_ln + fi + done + exit 0 +fi + +#ADL-P IPU6 +mdev=$(${v4l2_util} --list-devices | grep -A1 ipu6 | grep media) +if [ -n "${mdev}" ]; then +[[ $quiet -eq 0 ]] && printf "Bus\tCamera\tSensor\tNode Type\tVideo Node\tRS Link\n" +# cache media-ctl output +dot=$(${media_util} -d ${mdev} --print-dot | grep -v dashed) +# for all d457 muxes a, b, c and d +for camera in $mux_list; do + create_dfu_dev=0 + vpad=0 + if [ "${camera}" \> "d" ]; then + vpad=6 + fi + for sens in "${!d4xx_vc_named[@]}"; do + # get sensor binding from media controller + d4xx_sens=$(echo "${dot}" | grep "D4XX $sens $camera" | awk '{print $1}') + + [[ -z $d4xx_sens ]] && continue; # echo "SENS $sens NOT FOUND" && continue + + d4xx_sens_mux=$(echo "${dot}" | grep $d4xx_sens:port0 | awk '{print $3}' | awk -F':' '{print $1}') + csi2=$(echo "${dot}" | grep $d4xx_sens_mux:port0 | awk '{print $3}' | awk -F':' '{print $1}') + be_soc=$(echo "${dot}" | grep $csi2:port1 | awk '{print $3}' | awk -F':' '{print $1}') + vid_nd=$(echo "${dot}" | grep -w "$be_soc:port$((${d4xx_vc_named[${sens}]}+${vpad}))" | awk '{print $3}' | awk -F':' '{print $1}') + [[ -z $vid_nd ]] && continue; # echo "SENS $sens NOT FOUND" && continue + + vid=$(echo "${dot}" | grep "${vid_nd}" | grep video | tr '\\n' '\n' | grep video | awk -F'"' '{print $1}') + [[ -z $vid ]] && continue; + dev_ln="/dev/video-rs-${camera_names["${sens}"]}-${camera_idx[${camera}]}" + dev_name=$(${v4l2_util} -d $vid -D | grep Model | awk -F':' '{print $2}') + + [[ $quiet -eq 0 ]] && printf '%s\t%d\t%s\tStreaming\t%s\t%s\n' "$dev_name" ${camera_idx[${camera}]} ${camera_names["${sens}"]} $vid $dev_ln + + # create link only in case we choose not only to show it + if [[ $info -eq 0 ]]; then + [[ -e $dev_ln ]] && unlink $dev_ln + ln -s $vid $dev_ln + # activate ipu6 link enumeration feature + ${v4l2_util} -d $dev_ln -c enumerate_graph_link=1 + fi + create_dfu_dev=1 # will create DFU device link for camera + # metadata link + if [ "$metadata_enabled" -eq 0 ]; then + continue; + fi + # skip IR metadata node for now. + [[ ${camera_names["${sens}"]} == 'ir' ]] && continue + # skip IMU metadata node. + [[ ${camera_names["${sens}"]} == 'imu' ]] && continue + + vid_num=$(echo $vid | grep -o '[0-9]\+') + dev_md_ln="/dev/video-rs-${camera_names["${sens}"]}-md-${camera_idx[${camera}]}" + dev_name=$(${v4l2_util} -d "/dev/video$(($vid_num+1))" -D | grep Model | awk -F':' '{print $2}') + + [[ $quiet -eq 0 ]] && printf '%s\t%d\t%s\tMetadata\t/dev/video%s\t%s\n' "$dev_name" ${camera_idx[${camera}]} ${camera_names["${sens}"]} $(($vid_num+1)) $dev_md_ln + # create link only in case we choose not only to show it + if [[ $info -eq 0 ]]; then + [[ -e $dev_md_ln ]] && unlink $dev_md_ln + ln -s "/dev/video$(($vid_num+1))" $dev_md_ln + ${v4l2_util} -d $dev_md_ln -c enumerate_graph_link=3 + fi + done + # create DFU device link for camera + if [[ ${create_dfu_dev} -eq 1 ]]; then + dev_dfu_name="/dev/d4xx-dfu-${camera}" + dev_dfu_ln="/dev/d4xx-dfu-${camera_idx[${camera}]}" + if [[ $info -eq 0 ]]; then + [[ -e $dev_dfu_ln ]] && unlink $dev_dfu_ln + ln -s $dev_dfu_name $dev_dfu_ln + else + [[ $quiet -eq 0 ]] && printf '%s\t%d\t%s\tFirmware \t%s\t%s\n' " i2c " ${camera_idx[${camera}]} "d4xx " $dev_dfu_name $dev_dfu_ln + fi + fi +done +fi +# end of file +