Add dev_info v2(Default is v1)
Change-Id: I49693856ab5c97a5df3c199ed75091c4eee1800b
diff --git a/mbtk/mbtk_utils_linux/device_info_generate.c b/mbtk/mbtk_utils_linux/device_info_generate.c
index fda756f..4da38c1 100755
--- a/mbtk/mbtk_utils_linux/device_info_generate.c
+++ b/mbtk/mbtk_utils_linux/device_info_generate.c
@@ -8,17 +8,30 @@
#include <fcntl.h>
#include "mbtk_type.h"
+
+#ifdef MBTK_DEV_INFO_VERSION_2
+#include "mbtk_device_v2.h"
+#else
#include "mbtk_device.h"
+#endif
+
static mbtk_device_info_header_t info_header = {
.tag = MBTK_DEVICE_INFO_PARTITION_TAG,
.version = MBTK_DEVICE_INFO_CURR_VERSION,
.item_count = MBTK_DEVICE_INFO_ITEM_NUM,
.item_header = {
+#ifdef MBTK_DEV_INFO_VERSION_2
+ {MBTK_DEVICE_INFO_ITEM_BASIC, MBTK_DEVICE_INFO_ITEM_ADDR_BASIC},
+ {MBTK_DEVICE_INFO_ITEM_FOTA, MBTK_DEVICE_INFO_ITEM_ADDR_FOTA},
+ {MBTK_DEVICE_INFO_ITEM_MODEM, MBTK_DEVICE_INFO_ITEM_ADDR_MODEM},
+ {MBTK_DEVICE_INFO_ITEM_LOG, MBTK_DEVICE_INFO_ITEM_ADDR_LOG},
+#else
{MBTK_DEVICE_INFO_ITEM_BASIC, 0},
{MBTK_DEVICE_INFO_ITEM_FOTA, 0},
{MBTK_DEVICE_INFO_ITEM_MODEM, 0},
{MBTK_DEVICE_INFO_ITEM_LOG, 0},
+#endif
}
};
@@ -59,15 +72,23 @@
static void help()
{
+#ifdef MBTK_DEV_INFO_VERSION_2
+ printf("device_info_generate -a [a/ab] -b [revision_out] -c [revision_in] -d [project] -e [project_cust] -f [cn/eu/all] -g [build_time] -h [net_pref] -o [out_bin]\n");
+#else
printf("device_info_generate -a [a/ab] -b [revision_out] -c [revision_in] -d [project] -e [project_cust] -f [cn/eu/all] -g [build_time] -o [out_bin]\n");
+#endif
}
static int update_and_write_header(int fd, mbtk_device_info_header_t *header)
{
+#ifdef MBTK_DEV_INFO_VERSION_2
+
+#else
header->item_header[MBTK_DEVICE_INFO_ITEM_BASIC].addr = sizeof(mbtk_device_info_header_t);
header->item_header[MBTK_DEVICE_INFO_ITEM_FOTA].addr = header->item_header[MBTK_DEVICE_INFO_ITEM_BASIC].addr + sizeof(mbtk_device_info_basic_t);
header->item_header[MBTK_DEVICE_INFO_ITEM_MODEM].addr = header->item_header[MBTK_DEVICE_INFO_ITEM_FOTA].addr + sizeof(mbtk_device_info_fota_t);
header->item_header[MBTK_DEVICE_INFO_ITEM_LOG].addr = header->item_header[MBTK_DEVICE_INFO_ITEM_MODEM].addr + sizeof(mbtk_device_info_modem_t);
+#endif
if(sizeof(mbtk_device_info_header_t) != write(fd, header, sizeof(mbtk_device_info_header_t))) {
printf("Write header fail:%d\n", errno);
@@ -126,7 +147,11 @@
{
int ch;
char out_bin[128] = {0};
+#ifdef MBTK_DEV_INFO_VERSION_2
+ while((ch = getopt(argc, argv, "a:b:c:d:e:f:g:h:o:"))!= -1){
+#else
while((ch = getopt(argc, argv, "a:b:c:d:e:f:g:o:"))!= -1){
+#endif
switch(ch)
{
case 'a':
@@ -187,6 +212,12 @@
printf("Set to default band.\n");
}
break;
+#ifdef MBTK_DEV_INFO_VERSION_2
+ case 'h':
+ item_modem.net_pref = (uint32)atoi(optarg);
+ printf("Set net_pref to %d success.\n", item_modem.net_pref);
+ break;
+#endif
case 'g':
if(strlen(optarg) > 0)
memcpy(item_basic.build_time, optarg, strlen(optarg));