Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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 @@ -174,12 +174,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);
if (fw_path_in_device)
{
fw_path_in_device.write(reinterpret_cast<const char*>(_fw.data()), _fw.size());
Expand Down
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
23 changes: 23 additions & 0 deletions scripts/rs-enum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ if [ -n "$(v4l2-ctl --list-devices | grep tegra)" ]; then
if [[ $info -eq 0 ]] && [[ $bus != "usb" ]]; then
[[ -e $dev_ln ]] && sudo unlink $dev_ln
sudo ln -s $vid $dev_ln
#TODO: create DFU device link for camera on jetson
subdev=$(media-ctl --print-dot | grep "D4XX depth ${camera} | awk -F'|' '{print $2}' | awk -F'/' '{print $3}' | tr -d ' '")
i2cdev=$(ls -l /sys/class/video4linux/${subdev}/device | awk -F'/' '{print $9}')
dev_dfu_name="/dev/d4xx-dfu-${i2cdev}"
dev_dfu_ln="/dev/d4xx-dfu-${cam_id}"
[[ -e $dev_dfu_ln ]] && sudo unlink $dev_dfu_ln
sudo ln -s $dev_dfu_name $dev_dfu_ln
fi
done
exit 0
Expand All @@ -87,6 +94,7 @@ fi
dot=$(media-ctl --print-dot)
# for all d457 muxes a, b, c and d
for camera in a b c d; do
create_dfu_dev=0
for sens in "${!d4xx_vc_named[@]}"; do
# get sensor binding from media controller
d4xx_sens=$(echo "${dot}" | grep "D4XX $sens $camera" | awk '{print $1}')
Expand All @@ -97,6 +105,7 @@ for camera in a b c d; do
vid_nd=$(echo "${dot}" | grep "$be_soc:port${d4xx_vc_named[${sens}]}" | grep -v dashed | 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
Expand All @@ -108,6 +117,7 @@ for camera in a b c d; do
# activate ipu6 link enumeration feature
v4l2-ctl -d $dev_ln -c enumerate_graph_link=1
fi
create_dfu_dev=1 # will create DFU device link for camera
# metadata link
# skip IR metadata node for now.
[[ ${camera_names["${sens}"]} == 'ir' ]] && continue
Expand All @@ -122,6 +132,19 @@ for camera in a b c d; do
sudo ln -s "/dev/video$(($vid_num+1))" $dev_md_ln
fi
done
# create DFU device link for camera
if [[ ${create_dfu_dev} -eq 1 ]]; then
#subdev=$(echo ${dot} | grep "D4XX depth ${camera} | awk -F'|' '{print $2}' | awk -F'/' '{print $3}' | tr -d ' '")
Comment thread
Nir-Az marked this conversation as resolved.
Outdated
#i2cdev=$(ls -l /sys/class/video4linux/${subdev}/device | awk -F'/' '{print $9}')
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 ]] && sudo unlink $dev_dfu_ln
sudo ln -s $dev_dfu_name $dev_dfu_ln
else
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

# end of file
1 change: 1 addition & 0 deletions src/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ namespace librealsense
uint16_t mi = 0;
std::string unique_id = "";
std::string device_path = "";
std::string dfu_device_path = ""; // for mipi multiple cameras
std::string serial = "";
usb_spec conn_spec = usb_undefined;
uint32_t uvc_capabilities = 0;
Expand Down
1 change: 1 addition & 0 deletions src/ds/d400/d400-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,7 @@ namespace librealsense
register_info(RS2_CAMERA_INFO_PRODUCT_LINE, "D400");
register_info(RS2_CAMERA_INFO_RECOMMENDED_FIRMWARE_VERSION, _recommended_fw_version);
register_info(RS2_CAMERA_INFO_CAMERA_LOCKED, _is_locked ? "YES" : "NO");
register_info(RS2_CAMERA_INFO_DFU_DEVICE_PATH, group.uvc_devices.front().dfu_device_path);
Comment thread
Nir-Az marked this conversation as resolved.

if (usb_modality)
register_info(RS2_CAMERA_INFO_USB_TYPE_DESCRIPTOR, usb_type_str);
Expand Down
10 changes: 10 additions & 0 deletions src/linux/backend-v4l2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ 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
info.conn_spec = usb_specification;
info.uvc_capabilities = get_dev_capabilities(dev_name).device_caps;

Expand Down Expand Up @@ -837,6 +838,7 @@ namespace librealsense
std::string device_md_path = "video-rs-" + vs + "-md-" + std::to_string(i);
std::string video_path = "/dev/" + device_path;
std::string video_md_path = "/dev/" + device_md_path;
std::string dfu_device_path = "/dev/d4xx-dfu-" + std::to_string(i);
uvc_device_info info{};

// Get Video node
Expand All @@ -857,6 +859,14 @@ namespace librealsense
continue;
}

// Get DFU node for MIPI camera
vfd = open(dfu_device_path.c_str(), O_RDONLY | O_NONBLOCK);

if (vfd > 0) {
::close(vfd); // file exists, close file and continue to assign it
info.dfu_device_path = dfu_device_path;
}

info.mi = vs.compare("imu") ? 0 : 4;
info.unique_id += "-" + std::to_string(i);
mipi_rs_enum_nodes.emplace_back(info, video_path);
Expand Down
1 change: 1 addition & 0 deletions src/to-string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ const char * get_string( rs2_camera_info value )
CASE( ASIC_SERIAL_NUMBER )
CASE( FIRMWARE_UPDATE_ID )
CASE( IP_ADDRESS )
CASE( DFU_DEVICE_PATH )
default:
assert( ! is_valid( value ) );
return UNKNOWN_VALUE;
Expand Down