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

L535 bundling #9264

Merged
merged 12 commits into from
Jul 15, 2021
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
4 changes: 2 additions & 2 deletions common/fw-update-helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ namespace rs2
RS2_FWU_STATE_FAILED = 3,
};

bool is_recommended_fw_available(const std::string& id, const std::string& PID)
bool is_recommended_fw_available(const std::string& product_line, const std::string& PID)
{
auto pl = parse_product_line(id);
auto pl = parse_product_line(product_line);
auto fv = get_available_firmware_version(pl, PID);
return !(fv == "");
}
Expand Down
2 changes: 1 addition & 1 deletion common/fw-update-helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace rs2
std::map<std::pair<int, std::string>, std::vector<uint8_t>> create_default_fw_table();
maloel marked this conversation as resolved.
Show resolved Hide resolved
std::vector<int> parse_fw_version(const std::string& fw);
bool is_upgradeable(const std::string& curr, const std::string& available);
bool is_recommended_fw_available(const std::string& version, const std::string& PID);
bool is_recommended_fw_available(const std::string& product_line, const std::string& PID);

class firmware_update_manager : public process_manager
{
Expand Down
4 changes: 2 additions & 2 deletions common/fw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ message(STATUS "T26X_FW_VERSION: ${T26X_FW_VERSION}")
set(T26X_FW_SHA1 c3940ccbb0e3045603e4aceaa2d73427f96e24bc)
set(T26X_FW_URL "${REALSENSE_FIRMWARE_URL}/Releases/TM2/FW/target/${T26X_FW_VERSION}")

string(REGEX MATCH "L51X_RECOMMENDED_FIRMWARE_VERSION \"([0-9]+.[0-9]+.[0-9]+.[0-9]+)\"" _ ${ver})
string(REGEX MATCH "L51X_RECOMMENDED_FIRMWARE_VERSION \"([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\"" _ ${ver})
set(L51X_FW_VERSION ${CMAKE_MATCH_1})
message(STATUS "L51X_FW_VERSION: ${L51X_FW_VERSION}")
set(L51X_FW_SHA1 ab73e5bfc520c0aa0340cada4b3e317b8fd31a4d)
set(L51X_FW_URL "${REALSENSE_FIRMWARE_URL}/Releases/L5xx/FW")

string(REGEX MATCH "L53X_RECOMMENDED_FIRMWARE_VERSION \"([0-9]+.[0-9]+.[0-9]+.[0-9]+)\"" _ ${ver})
string(REGEX MATCH "L53X_RECOMMENDED_FIRMWARE_VERSION \"([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\"" _ ${ver})
set(L53X_FW_VERSION ${CMAKE_MATCH_1})
message(STATUS "L53X_FW_VERSION: ${L53X_FW_VERSION}")
set(L53X_FW_SHA1 9bc28aaf079b105d9a20a0bd845ea222b8754571)
Expand Down
9 changes: 8 additions & 1 deletion common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3837,7 +3837,7 @@ namespace rs2
configurations::update::allow_rc_firmware,
false );
bool is_rc = ( product_line == RS2_PRODUCT_LINE_D400 ) && allow_rc_firmware;
std::string PID = product_line == RS2_PRODUCT_LINE_L500 ? dev.get_info(RS2_CAMERA_INFO_PRODUCT_ID) : "";
std::string PID = dev.get_info(RS2_CAMERA_INFO_PRODUCT_ID);

std::string available_fw_ver = get_available_firmware_version( product_line, PID);

Expand All @@ -3850,6 +3850,13 @@ namespace rs2

static auto table = create_default_fw_table();

std::vector<uint8_t> image;

if (table.find({ product_line, PID }) != table.end())
image = table[{product_line, PID}];
else
image = table[{product_line, ""}];

manager = std::make_shared< firmware_update_manager >( not_model,
*this,
dev,
Expand Down
18 changes: 12 additions & 6 deletions unit-tests/test-fw-update.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,13 @@ def reset_update_counter( device ):

send_hardware_monitor_command( device, cmd )

def find_image_or_exit( product_name, image_mask ):
def find_image_or_exit( product_name, fw_version ):
"""
Description...
maloel marked this conversation as resolved.
Show resolved Hide resolved
:param product_name: the name of the camera
:param fw_version: fw version
maloel marked this conversation as resolved.
Show resolved Hide resolved
:return: the image file corresponding to product_name and fw_version if exist, otherwise exit
"""
pattern = re.compile(r'^Intel RealSense ((\S+?)(\d+)(\S*))')
match = pattern.search(product_name)
if not match:
Expand All @@ -84,13 +90,13 @@ def find_image_or_exit( product_name, image_mask ):
# For example: for 'Intel RealSense L53X Recovery'
# Take the 'L53' and try to concatenate it 'X' + postfix and than "XX" + postfix
# Until find file or exit if not find.
x = 'X'
r = match.regs[1]
x = ''
start_index, end_index = match.span(1)

for i in range(1, 3):
pn = product_name[r[0]:r[1]]
for i in range(0, end_index-start_index):
pn = product_name[start_index:end_index-i]

image_name = '(^|/)' + product_name[r[0]:r[1]-i] + x + "_FW_Image-" + image_mask + ".bin" + '$'
image_name = '(^|/)' + pn + x + "_FW_Image-" + fw_version + ".bin" + '$'
maloel marked this conversation as resolved.
Show resolved Hide resolved
image_file = None
for image in file.find(repo.root, image_name):
image_file = os.path.join(repo.root, image)
Expand Down