Skip to content

Commit f7118f3

Browse files
committed
remove needless special case for dfu
1 parent 95b8549 commit f7118f3

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

src/linux/backend-v4l2.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ namespace librealsense
578578
}
579579
}
580580

581-
bool v4l_uvc_device::get_devname_from_video_path(const std::string& video_path, std::string& devname, bool is_for_dfu)
581+
bool v4l_uvc_device::get_devname_from_video_path(const std::string& video_path, std::string& devname)
582582
{
583583
std::ifstream uevent_file(video_path + "/uevent");
584584
if (!uevent_file)
@@ -591,14 +591,10 @@ namespace librealsense
591591
{
592592
if (uevent_line.find("DEVNAME=") != std::string::npos)
593593
{
594-
devname = uevent_line.substr(uevent_line.find_last_of('=') + 1);
594+
devname = "/dev/" + uevent_line.substr(uevent_line.find_last_of('=') + 1);
595595
}
596596
}
597597
uevent_file.close();
598-
if (!is_for_dfu)
599-
{
600-
devname = "/dev/" + devname;
601-
}
602598
return true;
603599
}
604600

@@ -690,8 +686,7 @@ namespace librealsense
690686
continue;
691687
}
692688
std::string devname;
693-
bool for_dfu = true;
694-
if (get_devname_from_video_path(real_path, devname, for_dfu))
689+
if (get_devname_from_video_path(real_path, devname))
695690
{
696691
if (devname.empty())
697692
{
@@ -907,11 +902,10 @@ namespace librealsense
907902
std::vector<std::string> dfu_device_paths = get_mipi_dfu_paths();
908903

909904
for (const auto& dfu_device_path: dfu_device_paths) {
910-
auto mipi_dfu_chardev = "/dev/" + dfu_device_path;
911-
int vfd = open(mipi_dfu_chardev.c_str(), O_RDONLY | O_NONBLOCK);
905+
int vfd = open(dfu_device_path.c_str(), O_RDONLY | O_NONBLOCK);
912906
if (vfd >= 0) {
913907
// Use legacy DFU device node used in firmware_update_manager
914-
info.dfu_device_path = mipi_dfu_chardev;
908+
info.dfu_device_path = dfu_device_path;
915909
::close(vfd); // file exists, close file and continue to assign it
916910
break;
917911
}

src/linux/backend-v4l2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ namespace librealsense
405405
virtual inline std::shared_ptr<buffer> get_video_buffer(__u32 index) const {return _buffers[index];}
406406
virtual inline std::shared_ptr<buffer> get_md_buffer(__u32 index) const {return nullptr;}
407407

408-
static bool get_devname_from_video_path(const std::string& real_path, std::string& devname, bool is_for_dfu = false);
408+
static bool get_devname_from_video_path(const std::string& real_path, std::string& devname);
409409

410410
power_state _state = D3;
411411
std::string _name = "";

0 commit comments

Comments
 (0)