Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1390f05 authored by Avichal Rakesh's avatar Avichal Rakesh Committed by Automerger Merge Worker
Browse files

camera: Fix prefix length path for External Camera HAL am: b8863f6a

parents 75979829 b8863f6a
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -18,15 +18,16 @@
//#define LOG_NDEBUG 0
#include <log/log.h>

#include <regex>
#include <sys/inotify.h>
#include <cutils/properties.h>
#include <errno.h>
#include <linux/videodev2.h>
#include <cutils/properties.h>
#include "ExternalCameraProviderImpl_2_4.h"
#include <sys/inotify.h>
#include <regex>
#include <string>
#include "ExternalCameraDevice_3_4.h"
#include "ExternalCameraDevice_3_5.h"
#include "ExternalCameraDevice_3_6.h"
#include "ExternalCameraProviderImpl_2_4.h"

namespace android {
namespace hardware {
@@ -41,10 +42,10 @@ namespace {
// "device@<version>/external/<id>"
const std::regex kDeviceNameRE("device@([0-9]+\\.[0-9]+)/external/(.+)");
const int kMaxDevicePathLen = 256;
const char* kDevicePath = "/dev/";
constexpr char kPrefix[] = "video";
constexpr int kPrefixLen = sizeof(kPrefix) - 1;
constexpr int kDevicePrefixLen = sizeof(kDevicePath) + kPrefixLen + 1;
constexpr const char* kDevicePath = "/dev/";
constexpr const char* kPrefix = "video";
constexpr int kPrefixLen = std::char_traits<char>::length(kPrefix);
constexpr int kDevicePrefixLen = std::char_traits<char>::length(kDevicePath) + kPrefixLen;

bool matchDeviceName(int cameraIdOffset,
                     const hidl_string& deviceName, std::string* deviceVersion,
+5 −4
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include <linux/videodev2.h>
#include <sys/inotify.h>
#include <regex>
#include <string>
#include "ExternalCameraDevice_3_4.h"
#include "ExternalCameraDevice_3_5.h"
#include "ExternalCameraDevice_3_6.h"
@@ -39,10 +40,10 @@ namespace {
// "device@<version>/external/<id>"
const std::regex kDeviceNameRE("device@([0-9]+\\.[0-9]+)/external/(.+)");
const int kMaxDevicePathLen = 256;
const char* kDevicePath = "/dev/";
constexpr char kPrefix[] = "video";
constexpr int kPrefixLen = sizeof(kPrefix) - 1;
constexpr int kDevicePrefixLen = sizeof(kDevicePath) + kPrefixLen + 1;
constexpr const char* kDevicePath = "/dev/";
constexpr const char* kPrefix = "video";
constexpr int kPrefixLen = std::char_traits<char>::length(kPrefix);
constexpr int kDevicePrefixLen = std::char_traits<char>::length(kDevicePath) + kPrefixLen;

bool matchDeviceName(int cameraIdOffset, const hidl_string& deviceName, std::string* deviceVersion,
                     std::string* cameraDevicePath) {