Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alderalke branch to development. #12060

Merged
merged 49 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
986096b
[ADL-P] LRS V4L2 Backend MPLANE streaming support [LRS-572]
dmipx Jan 5, 2023
21acbcb
PR #11295 from dmipx: [ADL-P] LRS V4L2 Backend MPLANE streaming suppo…
Nir-Az Jan 8, 2023
68d5f5e
color processing block acc to platform
remibettan Jan 5, 2023
4084c7c
using gev_dev_capabilities method
remibettan Jan 8, 2023
abd95d8
cr
remibettan Jan 10, 2023
a416a09
PR #11294 from remibettan: color processing block acc to platform
Nir-Az Jan 11, 2023
3cb1dd9
Enumerate video nodes by name
dmipx Jan 12, 2023
3e6b496
Following code review.
dmipx Jan 16, 2023
996d7b6
PR #11319 from dmipx: Enumerate video nodes by name
Nir-Az Jan 19, 2023
f00007b
merge development
Nir-Az Feb 13, 2023
ed4e624
PR #11435 from Nir-Az: Align ADL-P to Development
Nir-Az Feb 14, 2023
38dfbbf
Merge remote-tracking branch 'origin/development' into adl-p
Nir-Az Feb 26, 2023
5e26e12
PR #11485 from Nir-Az: align adl-p to dev
Nir-Az Feb 27, 2023
06644ee
backend: dfu - add support for multiple cameras
dmipx Feb 22, 2023
058726d
scripts: rs-enum: cleanup
dmipx Mar 1, 2023
0c69294
PR #11472 from dmipx: backend: dfu - add support for multiple cameras
Nir-Az Mar 2, 2023
64dd453
[ADL-P] Automate rs-enum script to udev rules
dmipx Mar 9, 2023
022bad7
PR #11550 from dmipx: Automate rs-enum script to udev rules
Nir-Az Mar 12, 2023
0e613b5
rs-enum: support for metadata nodes format updates
dmipx Mar 20, 2023
a58c7df
PR #11592 from dmipx: rs-enum: support for metadata nodes format updates
Nir-Az Mar 21, 2023
875270f
Merge remote-tracking branch 'origin/development' into adl-p
Nir-Az Mar 23, 2023
71da796
PR #11605 from Nir-Az: Align ADL-P to development (23/3)
Nir-Az Mar 26, 2023
95a7572
adl-p temporary disable metadata node
dmipx Mar 27, 2023
5f1f209
PR #11618 from dmipx: adl-p temporary disable metadata node
Nir-Az Mar 28, 2023
32b7038
Merge remote-tracking branch 'origin/development' into adl-p
Nir-Az May 23, 2023
f0939d4
PR #11832 from Nir-Az: align adl-p to development (23/5/23)
Nir-Az May 24, 2023
fd1f272
backend-v4l: ipu6 integration
dmipx May 18, 2023
7498df3
udev rules: update dfu filter for all d4xx dfu node names
dmipx May 21, 2023
154b658
backend-v4l2: use custom structure for metadata.
dmipx May 22, 2023
8786dc5
scripts: enable metadata bindings.
dmipx May 24, 2023
c2b47dd
PR #11822 from dmipx: Adlp metadata
Nir-Az May 25, 2023
7fbdd13
backend-v4l: stop metadata before video for ipu6
dmipx Jun 5, 2023
fe656b7
PR #11902 from dmipx: backend-v4l: stop metadata before video for ipu6
Nir-Az Jun 14, 2023
a2336b8
scripts: ipu6: fix media controller index
dmipx Jul 5, 2023
8bba296
scripts: enum/bind check for dependencies.
dmipx Jul 17, 2023
ba793d1
PR #11969 from dmipx: scripts: ipu6: fix media controller index
Nir-Az Jul 20, 2023
afb06fd
Merge remote-tracking branch 'origin/development' into adl-p
Nir-Az Jul 24, 2023
1a02ed2
PR #12032 from Nir-Az: align adl-p to development (24/7/23)
Nir-Az Jul 24, 2023
e13b9d5
scripts: rs-enum: update enumeration for jetson devices.
dmipx Jul 20, 2023
1c3769f
scripts: udev: unify tegra and ipu6 rules
dmipx Jul 23, 2023
4ee1057
scripts: ipu6-bind: skip for non ipu6 case.
dmipx Jul 24, 2023
5083434
scripts: rs-enum: remove sudo, check for root user on run.
dmipx Jul 24, 2023
6f34bbb
scripts: udev: Merge all mipi platforms to single rule.
dmipx Jul 24, 2023
4c61dea
PR #12023 from dmipx: scripts: rs-enum: update enumeration for jetson…
Nir-Az Aug 1, 2023
4612539
scripts: ipu6 aggregated camera support.
dmipx Aug 4, 2023
439c5a0
PR #12070 from dmipx: scripts: ipu6 aggregated camera support.
Nir-Az Aug 9, 2023
e9e57bf
-sscripts: ipu6 bind commentary
dmipx Aug 14, 2023
0abacd1
PR #12102 from dmipx: scripts: ipu6 bind commentary
Nir-Az Aug 14, 2023
812cf43
PR #12108 from IntelRealSense: adl-p align to development
Nir-Az Aug 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions common/fw-update-helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,9 @@ namespace rs2
device_debug.build_command(dfu_opcode, 1);

_progress = 30;
// Grant permissions for writing
// skipped for now - must be done in sudo
//chmod("/dev/d4xx-dfu504", __S_IREAD|__S_IWRITE);

// Write signed firmware to appropriate file descritptor
std::ofstream fw_path_in_device("/dev/d4xx-dfu504", std::ios::binary);
std::ofstream fw_path_in_device(_dev.get_info(RS2_CAMERA_INFO_DFU_DEVICE_PATH), std::ios::binary);
Nir-Az marked this conversation as resolved.
Show resolved Hide resolved
if (fw_path_in_device)
{
fw_path_in_device.write(reinterpret_cast<const char*>(_fw.data()), _fw.size());
Expand Down
6 changes: 5 additions & 1 deletion config/99-realsense-d4xx-mipi-dfu.rules
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
SUBSYSTEM=="d4xx-class",KERNEL=="d4xx-dfu[0-9]*", GROUP="video", MODE="0660"
# Device rules for Intel RealSense MIPI devices.

# DFU rules
SUBSYSTEM=="d4xx-class",KERNEL=="d4xx-dfu*", GROUP="video", MODE="0660"
# video links for SDK, binding for ipu6
SUBSYSTEM=="video4linux", ATTR{name}=="DS5 mux *", RUN+="/bin/bash -c 'rs_ipu6_d457_bind.sh > /dev/kmsg; rs-enum.sh -q > /dev/kmsg'"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible to identify we are running on ADL-P and only run this script if needed?
Not sure jetson users want to see IPU6 script call..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

after looking on debian package for udev rules, we have no way to get that information on debian installation stage.
I decided to merge all paltforms to one script. If it is so crucial - we can add post installation step and remove unnecessary files and modify rules but it will be a mess..

1 change: 1 addition & 0 deletions include/librealsense2/h/rs_sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ typedef enum rs2_camera_info {
RS2_CAMERA_INFO_ASIC_SERIAL_NUMBER , /**< ASIC serial number */
RS2_CAMERA_INFO_FIRMWARE_UPDATE_ID , /**< Firmware update ID */
RS2_CAMERA_INFO_IP_ADDRESS , /**< IP address for remote camera. */
RS2_CAMERA_INFO_DFU_DEVICE_PATH , /**< DFU Device node path */
RS2_CAMERA_INFO_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
} rs2_camera_info;
const char* rs2_camera_info_to_string(rs2_camera_info info);
Expand Down
203 changes: 154 additions & 49 deletions scripts/rs-enum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,30 @@
#
# Alderlake:
#$ ./rs-enum.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add some comment with explanation of the commands sent in this script

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you are not commenting c++ code for every magic you do.
This is simple filtering, nothing specific can be commented. No magic involved.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think Remi meant command line parameters
i.e.

# parse command line parameters
# for '-i' parameter, print links only

# Bus Camera Sensor Node Type Video Node RS Link
# ipu6 3 depth Streaming /dev/video52 /dev/video-rs-depth-3
# ipu6 3 depth Metadata /dev/video53 /dev/video-rs-depth-md-3
# ipu6 3 ir Streaming /dev/video56 /dev/video-rs-ir-3
# ipu6 3 color Streaming /dev/video54 /dev/video-rs-color-3
# ipu6 3 color Metadata /dev/video55 /dev/video-rs-color-md-3
#
#Bus Camera Sensor Node Type Video Node RS Link
# ipu6 0 depth Streaming /dev/video4 /dev/video-rs-depth-0
Nir-Az marked this conversation as resolved.
Show resolved Hide resolved
# 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
Expand All @@ -33,95 +49,184 @@ while [[ $# -gt 0 ]]; do
info=1
shift
;;
-q|--quiet)
quiet=1
shift
;;
-m|--mux)
shift
mux_param=$1
shift
;;
-n|--no-metadata)
metadata_enabled=0
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

declare -A camera_idx=( [a]=0 [b]=1 [c]=2 [d]=3 )
declare -A d4xx_vc=([1]=1 [2]=3 [4]=5)
declare -A d4xx_vc_named=([depth]=1 [rgb]=3 ["motion detection"]=5 [imu]=7)
declare -A camera_names=( [depth]=depth [rgb]=color ["motion detection"]=ir [imu]=imu )
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")

printf "Bus\tCamera\tSensor\tNode Type\tVideo Node\tRS Link\n"

# For Jetson we have simple method
if [ -n "$(v4l2-ctl --list-devices | grep tegra)" ]; then
for ((i = 0; i < 127; i++)); do
if [ ! -c /dev/video${i} ]; then
break;
fi
mdev=$(${v4l2_util} --list-devices | grep -A1 tegra | grep media)

# For Jetson we have `simple` method
if [ -n "${mdev}" ]; then
# cache media-ctl output
dot=$(${media_util} -d ${mdev} --print-dot)

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"
for i in $vid_dev_idx; do
vid="/dev/video${i}"
[[ ! -c "${vid}" ]] && break
cam_id=$((i/6))
sens_id=$((i%6))
vid="/dev/video${i}"
dev_name=$(v4l2-ctl -d ${vid} -D | grep 'Driver name' | head -n1 | awk -F' : ' '{print $2}')
dev_ln="/dev/video-rs-${camera_vid[${sens_id}]}-${cam_id}"
bus="mipi"
if [ "$dev_name" = "uvcvideo" ]; then
dev_ln=$vid
bus="usb"
dev_name=$(${v4l2_util} -d ${vid} -D | grep 'Driver name' | head -n1 | awk -F' : ' '{print $2}')
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
if [ -n "$(echo ${camera_vid[${sens_id}]} | awk /md/)" ]; then
type="Metadata"
# 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))

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}')
if [ "${dev_name}" = "tegra-embedded" ]; then
dev_md_ln="/dev/video-rs-${camera_vid[${sens_id}]}-${cam_id}"
else
type="Streaming"
continue
fi
sensor_name=$(echo "${camera_vid[${sens_id}]}" | awk -F'-' '{print $1}')
printf '%s\t%d\t%s\t%s\t%s\t%s\n' ${bus} ${cam_id} ${sensor_name} ${type} ${vid} ${dev_ln}
[[ $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 ]] && [[ $bus != "usb" ]]; then
[[ -e $dev_ln ]] && sudo unlink $dev_ln
sudo ln -s $vid $dev_ln
if [[ $info -eq 0 ]]; then
[[ -e $dev_md_ln ]] && unlink $dev_md_ln
ln -s $vid $dev_md_ln
fi
done
exit 0
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-ctl --print-dot)
dot=$(${media_util} -d ${mdev} --print-dot | grep -v dashed)
# for all d457 muxes a, b, c and d
for camera in a b c d; do
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 | grep -v dashed | awk '{print $3}' | awk -F':' '{print $1}')
vid_nd=$(echo "${dot}" | grep "$be_soc:port${d4xx_vc_named[${sens}]}" | grep -v dashed | 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-ctl -d $vid -D | grep Model | awk -F':' '{print $2}')
# echo Sensor: $sens,\t Device: $vid,\t Link $dev_ln
printf '%s\t%d\t%s\tStreaming\t%s\t%s\n' "$dev_name" ${camera_idx[${camera}]} ${camera_names["${sens}"]} $vid $dev_ln
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 ]] && sudo unlink $dev_ln
sudo ln -s $vid $dev_ln
[[ -e $dev_ln ]] && unlink $dev_ln
ln -s $vid $dev_ln
# activate ipu6 link enumeration feature
v4l2-ctl -d $dev_ln -c enumerate_graph_link=1
${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-ctl -d "/dev/video$(($vid_num+1))" -D | grep Model | awk -F':' '{print $2}')
# echo Metadata: $sens,\t Device: "/dev/video$(($vid_num+1))",\t Link: $dev_md_ln
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
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 ]] && sudo unlink $dev_md_ln
sudo ln -s "/dev/video$(($vid_num+1))" $dev_md_ln
[[ -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

Loading