Skip to content

Commit

Permalink
Merge remote-tracking branch 'ev-mp/mhf' into android-camera-fw-update-2
Browse files Browse the repository at this point in the history
  • Loading branch information
matkatz committed Jun 26, 2019
2 parents 97eda7d + e6cc4b3 commit d45e822
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion common/fw-update-helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,4 +315,4 @@ namespace rs2

_started = true;
}
}
}
23 changes: 0 additions & 23 deletions common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4856,29 +4856,6 @@ namespace rs2
}

ImGui::SetCursorPos({ rc.x + 225, rc.y - 107 });

if (fw_version_less_than(fw_version, min_fw_version))
{
std::string label1 = to_string() << textual_icons::exclamation_triangle << "##" << id;
ImGui::PushStyleColor(ImGuiCol_Button, sensor_bg);
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, sensor_bg);
ImGui::PushStyleColor(ImGuiCol_ButtonActive, sensor_bg);
ImGui::PushStyleColor(ImGuiCol_Text, yellow);
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, yellow + 0.1f);

if (ImGui::SmallButton(label1.c_str()))
{
open_url(recommended_fw_url);
}

if (ImGui::IsItemHovered())
{
ImGui::SetTooltip("Click here to update firmware\n(internet connection required)");
}

ImGui::PopStyleColor(5);
}

ImGui::PopFont();
}

Expand Down
48 changes: 37 additions & 11 deletions common/viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,19 +437,25 @@ namespace rs2

void viewer_model::check_permissions()
{
#ifdef __linux__
#ifdef __linux__

if (directory_exists("/etc/udev/rules.d"))
if (directory_exists("/etc/udev/rules.d") || directory_exists("/lib/udev/rules.d/"))
{
std::ifstream f("/etc/udev/rules.d/99-realsense-libusb.rules");
std::string message = "UDEV-Rules configure correct permissions\nfor RealSense devices.`\n"
"Missing UDEV-Rules will cause 'Permissions Denied' errors\nunless the application is running under 'sudo' (not recommended)\n"
"To install UDEV-Rules run in terminal:\n"
const std::string udev_rules_man("/etc/udev/rules.d/99-realsense-libusb.rules");
const std::string udev_rules_deb("/lib/udev/rules.d/60-librealsense2-udev-rules.rules");
std::ifstream f_man(udev_rules_man);
std::ifstream f_deb(udev_rules_deb);

std::string message = "UDEV-Rules permissions configuration \n for RealSense devices.`\n"
"Missing/outdated UDEV-Rules will cause 'Permissions Denied' errors\nunless the application is running under 'sudo' (not recommended)\n"
"In case of Debians use: \n"
"sudo apt-get upgrade/install librealsense2-udev-rules\n"
"To manually install UDEV-Rules in terminal run:\n"
"$ sudo cp ~/.99-realsense-libusb.rules /etc/udev/rules.d/99-realsense-libusb.rules && sudo udevadm control --reload-rules && udevadm trigger\n";

bool create_file = false;

if(!f.good())
if(!(f_man.good() || f_deb.good()))
{
message = "RealSense UDEV-Rules are missing!\n" + message;
not_model.add_notification({ message,
Expand All @@ -459,19 +465,40 @@ namespace rs2
}
else
{
std::ifstream f;
std::string udev_fname;
if(f_man.good())
{
if (f_deb.good())
{
std::string duplicates = "Multiple realsense udev-rules were found! :\n1:" + udev_rules_man
+ "\n2: " + udev_rules_deb+ "\nMake sure to remove redundancies!";
not_model.add_notification({ duplicates,
RS2_LOG_SEVERITY_WARN,
RS2_NOTIFICATION_CATEGORY_COUNT });
}
f.swap(f_man);
udev_fname = udev_rules_man;
create_file = true;
}
else
{
f.swap(f_deb);
udev_fname = udev_rules_deb;
}

std::string str((std::istreambuf_iterator<char>(f)),
std::istreambuf_iterator<char>());

std::string udev = realsense_udev_rules;

if (udev != str)
{
message = "RealSense UDEV-Rules are outdated!\n" + message;
message = "RealSense UDEV-Rules file:\n " + udev_fname +"\n is not up-to date!\n" + message;
not_model.add_notification({
message,
RS2_LOG_SEVERITY_WARN,
RS2_NOTIFICATION_CATEGORY_COUNT });
create_file = true;
}
}

Expand All @@ -485,7 +512,6 @@ namespace rs2
}
}


#endif
}

Expand Down
4 changes: 0 additions & 4 deletions src/ds5/ds5-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -666,10 +666,6 @@ namespace librealsense

std::string curr_version= _fw_version;

if (dynamic_cast<const platform::playback_backend*>(&(ctx->get_backend())) == nullptr)
_tf_keeper->start();
else
LOG_WARNING("playback_backend - global time_keeper unavailable.");
}

notification ds5_notification_decoder::decode(int value)
Expand Down
9 changes: 5 additions & 4 deletions tools/fw-update/rs-fw-update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,6 @@ int main(int argc, char** argv) try
break;
}

std::unique_lock<std::mutex> lk(mutex);
cv.wait_for(lk, std::chrono::seconds(WAIT_FOR_DEVICE_TIMEOUT), [&] { return !done || new_device; });

if (!device_found)
{
if(serial_number_arg.isSet())
Expand All @@ -253,15 +250,19 @@ int main(int argc, char** argv) try
{
std::cout << std::endl << "nothing to do, run again with -h for help" << std::endl;
}
return EXIT_FAILURE;
}

std::unique_lock<std::mutex> lk(mutex);
cv.wait_for(lk, std::chrono::seconds(WAIT_FOR_DEVICE_TIMEOUT), [&] { return !done || new_device; });

if (done)
{
auto devs = ctx.query_devices();
for (auto&& d : devs)
{
auto sn = d.supports(RS2_CAMERA_INFO_SERIAL_NUMBER) ? d.get_info(RS2_CAMERA_INFO_SERIAL_NUMBER) : "unknown";
if (sn != selected_serial_number)
if (serial_number_arg.isSet() && sn != selected_serial_number)
continue;

auto fw = d.supports(RS2_CAMERA_INFO_FIRMWARE_VERSION) ? d.get_info(RS2_CAMERA_INFO_FIRMWARE_VERSION) : "unknown";
Expand Down

0 comments on commit d45e822

Please sign in to comment.