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

Version 0.38.2 #164

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ option(RSID_SECURE "Enable secure communication with device" OFF)
option(RSID_TOOLS "Build additional tools" ON)
option(RSID_PY "Build python wrapper" OFF)


# install option
option(RSID_INSTALL "Generate the install target and rsidConfig.cmake" OFF)

Expand Down
3 changes: 2 additions & 1 deletion include/RealSenseID/AuthenticateStatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ enum class RSID_API AuthenticateStatus
Spoof_3D,
Spoof_LR,
Spoof_Disparity,
Spoof_Surface
Spoof_Surface,
Spoof_Plane_Disparity
};

/**
Expand Down
12 changes: 11 additions & 1 deletion include/RealSenseID/DeviceController.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,21 @@ class RSID_API DeviceController
Status QueryOtpVersion(uint8_t& version);

/**
* Send ping packet to device
* Send ping packet to device.
* @return SerialStatus::Success if device responded with a valid ping response.
*/
Status Ping();

/**
* Retrieve logs from the device.
*
* @param log String that will be filled with the device's log.
* @return SerialStatus::Success on success.
* @Note: Maximum log size is 128kB; therefore, this function allocates up to 128KB and can take approximately 12-14
* seconds to complete.
*/
Status FetchLog(std::string& log);

private:
RealSenseID::DeviceControllerImpl* _impl = nullptr;
};
Expand Down
3 changes: 2 additions & 1 deletion include/RealSenseID/EnrollStatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ enum class RSID_API EnrollStatus
Spoof_3D,
Spoof_LR,
Spoof_Disparity,
Spoof_Surface
Spoof_Surface,
Spoof_Plane_Disparity
};

/**
Expand Down
3 changes: 2 additions & 1 deletion include/RealSenseID/FaceprintsDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ struct ExtractedFaceprintsElement
#ifdef __cplusplus
ExtractedFaceprintsElement()
{
version = (int)RSID_FACEPRINTS_VERSION;
version = RSID_FACEPRINTS_VERSION;
featuresType = 0;
flags = 0;
::memset(featuresVector, 0, sizeof(featuresVector));
}

ExtractedFaceprintsElement(const ExtractedFaceprintsElement& other)
Expand Down
2 changes: 1 addition & 1 deletion include/RealSenseID/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#define RSID_VER_MAJOR 0
#define RSID_VER_MINOR 38
#define RSID_VER_PATCH 0
#define RSID_VER_PATCH 2

#define RSID_VERSION (RSID_VER_MAJOR * 10000 + RSID_VER_MINOR * 100 + RSID_VER_PATCH)

Expand Down
14 changes: 7 additions & 7 deletions release_info.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"sw_version": 3800,
"sw_version_str": "0.38.0",
"fw_version": 607000306,
"fw_version_str": "6.7.0.306",
"release_url": "https://github.com/IntelRealSense/RealSenseID/releases/tag/v0.38.0",
"release_notes_url": "https://github.com/IntelRealSense/RealSenseID/blob/v0.38.0/release_notes.txt"
}
"sw_version": 3802,
"sw_version_str": "0.38.2",
"fw_version": 609000301,
"fw_version_str": "6.9.0.301",
"release_url": "https://github.com/IntelRealSense/RealSenseID/releases/tag/v0.38.2",
"release_notes_url": "https://github.com/IntelRealSense/RealSenseID/blob/v0.32.0/release_notes.txt"
}
10 changes: 10 additions & 0 deletions release_notes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
Realsense ID version 0.38.2
-----------------------------------
* New firmware release - version 6.9.0.301
* Improved TNR and TPR for Anti-Spoofing
* Improved debuggability
* Bug fixes
* New host SW:
* Get FW log feature
* Added unpair option to viewer

Realsense ID version 0.38.0
-----------------------------------
* New firmware release - version 6.7.0.306
Expand Down
15 changes: 15 additions & 0 deletions samples/python/device_log.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
License: Apache 2.0. See LICENSE file in root directory.
Copyright(c) 2020-2024 Intel Corporation. All Rights Reserved.
"""

import rsid_py

PORT = 'COM4'

if __name__ == '__main__':
with rsid_py.DeviceController(PORT) as d:
log = d.fetch_log()
with open("device.log", 'w') as f:
f.write(log)
print(f'Saved {len(log)} bytes to device.log')
7 changes: 7 additions & 0 deletions src/DeviceController.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,11 @@ Status DeviceController::Ping()
{
return _impl->Ping();
}

Status DeviceController::FetchLog(std::string& log)
{
return _impl->FetchLog(log);
}


} // namespace RealSenseID
98 changes: 94 additions & 4 deletions src/DeviceControllerImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include "Logger.h"
#include <sstream>
#include <regex>
#include <cctype>


#ifdef _WIN32
#include "PacketManager/WindowsSerial.h"
Expand Down Expand Up @@ -111,7 +113,8 @@ Status DeviceControllerImpl::QueryFirmwareVersion(std::string& version)
std::string line;
while (std::getline(ss, line, '\n'))
{
static const std::regex module_regex {R"((OPFW|NNLED|DNET|RECOG|YOLO|AS2DLR|NNLAS|NNLEDR|SPOOFS) : ([\d\.]+))"};
static const std::regex module_regex {
R"((OPFW|NNLED|DNET|RECOG|YOLO|AS2DLR|NNLAS|NNLEDR|SPOOFS|ASDISP) : ([\d\.]+))"};
std::smatch match;

auto match_ok = std::regex_search(line, match, module_regex);
Expand Down Expand Up @@ -156,8 +159,8 @@ Status DeviceControllerImpl::QuerySerialNumber(std::string& serial)

try
{
auto send_status = _serial->SendBytes(PacketManager::Commands::device_info,
::strlen(PacketManager::Commands::device_info));
auto send_status =
_serial->SendBytes(PacketManager::Commands::device_info, ::strlen(PacketManager::Commands::device_info));
if (send_status != PacketManager::SerialStatus::Ok)
{
LOG_ERROR(LOG_TAG, "Failed sending serial number command");
Expand Down Expand Up @@ -223,7 +226,8 @@ Status DeviceControllerImpl::QueryOtpVersion(uint8_t& otpVer)
{
try
{
auto send_status = _serial->SendBytes(PacketManager::Commands::otp_ver, ::strlen(PacketManager::Commands::otp_ver));
auto send_status =
_serial->SendBytes(PacketManager::Commands::otp_ver, ::strlen(PacketManager::Commands::otp_ver));
if (send_status != PacketManager::SerialStatus::Ok)
{
LOG_ERROR(LOG_TAG, "Failed sending otp version command");
Expand Down Expand Up @@ -332,4 +336,90 @@ Status DeviceControllerImpl::Ping()
}
return Status::Ok;
}

Status DeviceControllerImpl::FetchLog(std::string& result)
{
try
{
result.clear();
auto send_status =
_serial->SendBytes(PacketManager::Commands::getlogs, ::strlen(PacketManager::Commands::getlogs));
if (send_status != PacketManager::SerialStatus::Ok)
{
LOG_ERROR(LOG_TAG, "Failed sending getLogs command");
return ToStatus(send_status);
}

constexpr size_t max_result_size = 128 * 1024;
constexpr size_t reserve_size = 1024;
char buffer[1] = {0};
const std::string start_token = "\nSTART_OF_LOG\n";
const std::string end_token = "\nEND_OF_LOG\n";

result.reserve(reserve_size);
bool done = false;
// receive the data one byte at a time until "END_OF_LOG" or no more data is available (timeout is reached)
while (!done)
{
auto status = _serial->RecvBytes(buffer, 1);
switch (status)
{
case PacketManager::SerialStatus::Ok: {
auto chr = buffer[0];
bool chr_ok =
std::isprint(static_cast<unsigned char>(chr)) || std::isspace(static_cast<unsigned char>(chr));
result.push_back(chr_ok ? chr : '?');
done = result.size() >= max_result_size;
break;
}
case PacketManager::SerialStatus::RecvTimeout: {
done = true;
break;
}
default:
LOG_ERROR(LOG_TAG, "Failed reading serial");
return ToStatus(status);
}
}

// remove the end token suffix if exists
auto pos = result.rfind(end_token);
if (pos != std::string::npos)
{
result.erase(pos);
}

// expect the START_OF_LOG token
pos = result.find(start_token);
if (pos != std::string::npos)
{
result.erase(0, pos + start_token.size());
}
else
{
result.clear();
LOG_ERROR(LOG_TAG, "Didn't receive the START_OF_LOG token");
return Status::Error;
}

// make sure it ends with '\n'
if (!result.empty() && result.back() != '\n')
{
result.push_back('\n');
}

LOG_DEBUG(LOG_TAG, "Got %zu log bytes", result.size());
return Status::Ok;
}
catch (std::exception& ex)
{
LOG_EXCEPTION(LOG_TAG, ex);
return Status::Error;
}
catch (...)
{
LOG_ERROR(LOG_TAG, "Unknown exception");
return Status::Error;
}
}
} // namespace RealSenseID
1 change: 1 addition & 0 deletions src/DeviceControllerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class DeviceControllerImpl
Status QuerySerialNumber(std::string& serial);
Status QueryOtpVersion(uint8_t& otpVer);
Status Ping();
Status FetchLog(std::string& log);

private:
std::unique_ptr<PacketManager::SerialConnection> _serial;
Expand Down
9 changes: 5 additions & 4 deletions src/FwUpdate/FwUpdateEngine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ static const char* LOG_TAG = "FwUpdater";

static const char* DumpFilename = "fw-update.log";
static const std::set<std::string> AllowedModules {"OPFW", "NNLED", "DNET", "RECOG",
"YOLO", "AS2DLR", "NNLAS", "NNLEDR", "SPOOFS"};
"YOLO", "AS2DLR", "NNLAS", "NNLEDR",
"SPOOFS", "ASDISP"};

static const char* OPFW = "OPFW";

Expand Down Expand Up @@ -63,7 +64,7 @@ bool FwUpdateEngine::ParseDlVer(const char* input, const std::string& module_nam
// regex to find line of the form: OPFW : [OPFW] [0.0.0.1] (active)
// regex groups to match: module_name, module_name, version, state
static const std::regex rgx {
R"((\w+) : \[(OPFW|NNLED|DNET|RECOG|YOLO|AS2DLR|SCRAP|NNLAS|NNLEDR|SPOOFS)\] \[([\d\.]+)\] \(([\w-]+)\))"};
R"((\w+) : \[(OPFW|NNLED|DNET|RECOG|YOLO|AS2DLR|SCRAP|NNLAS|NNLEDR|SPOOFS|ASDISP)\] \[([\d\.]+)\] \(([\w-]+)\))"};
std::smatch match;


Expand Down Expand Up @@ -410,7 +411,7 @@ void FwUpdateEngine::BurnModule(ProgressTick tick, const ModuleInfo& module, con
// clean obsolete modules from FW by shrinking the size 1 block (minimum allowed)
void FwUpdateEngine::CleanObsoleteModules()
{
const std::vector<std::string> obsolete_modules = {"NNLAS", "NNLEDR"};
const std::vector<std::string> obsolete_modules = {"NNLAS", "NNLEDR", "SPOOFS"};
// Note: NEVER add "OPFW" to the "obsolete_modules" list above !

for (const std::string &obsolete_name : obsolete_modules)
Expand All @@ -437,7 +438,7 @@ void FwUpdateEngine::BurnSelectModules(const ModuleVector& modules, ProgressTick
auto is_last_module = module_count == modules.size();
bool is_first_module = module_count == 1;

if (module.name == "SPOOFS") // NNLEDR/SPOOFS are new modules and need to be declated
if (module.name == "SPOOFS" || module.name == "ASDISP") // NNLEDR/SPOOFS are new modules and need to be declared
{
_comm->WriteCmd(Cmds::dlnew(module.name, module.size));
_comm->WaitForIdle();
Expand Down
1 change: 1 addition & 0 deletions src/PacketManager/SerialPacket.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ enum class MsgId : char
static const char* device_info = "\r\nbspver -device\r\n";
static const char* reset = "\r\nreset\r\n";
static const char* otp_ver = "\r\ngetOtpVer\r\n";
static const char* getlogs= "\r\ngetLogs\r\n";
} // namespace Commands
} // namespace PacketManager
} // namespace RealSenseID
Expand Down
4 changes: 4 additions & 0 deletions src/StatusHelper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ const char* Description(EnrollStatus status)
return "Spoof_Disparity";
case RealSenseID::EnrollStatus::InvalidFeatures:
return "Invalid_Features";
case RealSenseID::EnrollStatus::Spoof_Plane_Disparity:
return "Spoof_Plane_Disparity";
default:
return "Unknown Status";
}
Expand Down Expand Up @@ -196,6 +198,8 @@ const char* Description(AuthenticateStatus status)
return "TooManySpoofs";
case RealSenseID::AuthenticateStatus::InvalidFeatures:
return "Invalid_Features";
case RealSenseID::AuthenticateStatus::Spoof_Plane_Disparity:
return "Spoof_Plane_Disparity";
default:
return "Unknown Status";
}
Expand Down
Loading