land: init: Dynamically set board ID on init

Change-Id: Id08be566818ae5d920bb1298ccb92a302ba41018
This commit is contained in:
Zhao Wei Liew 2016-11-07 08:01:35 +08:00
parent 3d9e9b98d3
commit df8dde6344
2 changed files with 37 additions and 2 deletions

View file

@ -35,6 +35,8 @@
#include "log.h" #include "log.h"
#include "util.h" #include "util.h"
static char board_id[PROP_VALUE_MAX];
static int read_file2(const char *fname, char *data, int max_size) static int read_file2(const char *fname, char *data, int max_size)
{ {
int fd, rc; int fd, rc;
@ -58,6 +60,22 @@ static int read_file2(const char *fname, char *data, int max_size)
return 1; return 1;
} }
static void import_cmdline(char *name, int for_emulator)
{
char *value = strchr(name, '=');
int name_len = strlen(name);
const char s[2] = ":";
if (value == 0) return;
*value++ = 0;
if (name_len == 0) return;
if (!strcmp(name, "board_id")) {
value = strtok(value, s);
strlcpy(board_id, value, sizeof(board_id));
}
}
static void init_alarm_boot_properties() static void init_alarm_boot_properties()
{ {
char const *alarm_file = "/proc/sys/kernel/boot_reason"; char const *alarm_file = "/proc/sys/kernel/boot_reason";
@ -91,5 +109,24 @@ static void init_alarm_boot_properties()
void vendor_load_properties() void vendor_load_properties()
{ {
import_kernel_cmdline(0, import_cmdline);
property_set("ro.product.wt.boardid", board_id);
ERROR("Detected board ID=%s\n", board_id);
if (!strcmp(board_id, "S88537AA1")) {
property_set("ro.build.display.wtid", "SW_S88537AA1_V053_M20_MP_XM");
} else if (!strcmp(board_id, "S88537AB1")) {
property_set("ro.build.display.wtid", "SW_S88537AB1_V053_M20_MP_XM");
} else if (!strcmp(board_id, "S88537AC1")) {
property_set("ro.build.display.wtid", "SW_S88537AC1_V053_M20_MP_XM");
} else if (!strcmp(board_id, "S88537BA1")) {
property_set("ro.build.display.wtid", "SW_S88537BA1_V053_M20_MP_XM");
} else if (!strcmp(board_id, "S88537CA1")) {
property_set("ro.build.display.wtid", "SW_S88537CA1_V053_M20_MP_XM");
} else if (!strcmp(board_id, "S88537EC1")) {
property_set("ro.build.display.wtid", "SW_S88537EC1_V053_M20_MP_XM");
}
init_alarm_boot_properties(); init_alarm_boot_properties();
} }

View file

@ -27,9 +27,7 @@ PRODUCT_PROPERTY_OVERRIDES += \
persist.radio.sib16_support=1 \ persist.radio.sib16_support=1 \
ril.subscription.types=NV,RUIM \ ril.subscription.types=NV,RUIM \
rild.libpath=/vendor/lib64/libril-qc-qmi-1.so \ rild.libpath=/vendor/lib64/libril-qc-qmi-1.so \
ro.build.display.wtid=SW_S88537AA1_V053_M20_MP_XM \
ro.ct.device.model=XMP-2016030 \ ro.ct.device.model=XMP-2016030 \
ro.product.wt.boardid=S88537AA1 \
ro.telephony.call_ring.multiple=false \ ro.telephony.call_ring.multiple=false \
ro.telephony.default_network=20 \ ro.telephony.default_network=20 \
ro.use_data_netmgrd=true \ ro.use_data_netmgrd=true \