rosemary: libinit: Add maltose support

* hwname is required for detecting actual device, maltose having same region (Global) with rosemary

Change-Id: I6aa1f9d856db6e7e0195c511bbb35e987d51c1fc
This commit is contained in:
Matsvei Niaverau
2022-12-07 01:20:10 +01:00
parent e41b2e465d
commit 79879ccf0a
3 changed files with 15 additions and 0 deletions

View File

@@ -12,6 +12,7 @@
typedef struct variant_info {
std::string hwc_value;
std::string hwname_value;
std::string sku_value;
std::string device;

View File

@@ -9,8 +9,17 @@
#include "vendor_init.h"
static const variant_info_t maltose_info = {
.hwc_value = "Global",
.hwname_value="maltose",
.sku_value = "",
.device = "maltose",
.nfc = false,
};
static const variant_info_t rosemary_info = {
.hwc_value = "Global",
.hwname_value="rosemary",
.sku_value = "",
.device = "rosemary",
.nfc = true,
@@ -18,12 +27,14 @@ static const variant_info_t rosemary_info = {
static const variant_info_t secret_info = {
.hwc_value = "Global_PA",
.hwname_value="secret",
.sku_value = "",
.device = "secret",
.nfc = false,
};
static const std::vector<variant_info_t> variants = {
maltose_info,
rosemary_info,
secret_info,
};

View File

@@ -12,14 +12,17 @@
using android::base::GetProperty;
#define HWC_PROP "ro.boot.hwc"
#define HWNAME_PROP "ro.boot.hwname"
#define SKU_PROP "ro.boot.product.hardware.sku"
void search_variant(const std::vector<variant_info_t> variants) {
std::string hwc_value = GetProperty(HWC_PROP, "");
std::string hwname_value = GetProperty(HWNAME_PROP, "");
std::string sku_value = GetProperty(SKU_PROP, "");
for (const auto& variant : variants) {
if ((variant.hwc_value == "" || variant.hwc_value == hwc_value) &&
(variant.hwname_value == "" || variant.hwname_value == hwname_value) &&
(variant.sku_value == "" || variant.sku_value == sku_value)) {
set_variant_props(variant);
break;