Fix device_info_generate.c addr

Change-Id: I62f74bb167ee514c5c1ed357456a510e9051b035
diff --git a/mbtk/mbtk_utils_linux/device_info_generate.c b/mbtk/mbtk_utils_linux/device_info_generate.c
index 4da38c1..e1341df 100755
--- a/mbtk/mbtk_utils_linux/device_info_generate.c
+++ b/mbtk/mbtk_utils_linux/device_info_generate.c
@@ -98,8 +98,13 @@
     return 0;
 }
 
-static int write_item_basic(int fd, mbtk_device_info_basic_t *item_basic)
+static int write_item_basic(int fd, uint32 addr, mbtk_device_info_basic_t *item_basic)
 {
+    if(-1 == lseek(fd, addr, SEEK_SET)) {
+        printf("lseek() fail:%d\n", errno);
+        return -1;
+    }
+
     if(sizeof(mbtk_device_info_basic_t) != write(fd, item_basic, sizeof(mbtk_device_info_basic_t))) {
         printf("Write item basic fail:%d\n", errno);
         return -1;
@@ -108,8 +113,13 @@
     return 0;
 }
 
-static int write_item_fota(int fd, mbtk_device_info_fota_t *item_fota)
+static int write_item_fota(int fd, uint32 addr, mbtk_device_info_fota_t *item_fota)
 {
+    if(-1 == lseek(fd, addr, SEEK_SET)) {
+        printf("lseek() fail:%d\n", errno);
+        return -1;
+    }
+
     if(sizeof(mbtk_device_info_fota_t) != write(fd, item_fota, sizeof(mbtk_device_info_fota_t))) {
         printf("Write item fota fail:%d\n", errno);
         return -1;
@@ -118,8 +128,13 @@
     return 0;
 }
 
-static int write_item_modem(int fd, mbtk_device_info_modem_t *item_modem)
+static int write_item_modem(int fd, uint32 addr, mbtk_device_info_modem_t *item_modem)
 {
+    if(-1 == lseek(fd, addr, SEEK_SET)) {
+        printf("lseek() fail:%d\n", errno);
+        return -1;
+    }
+
     if(sizeof(mbtk_device_info_modem_t) != write(fd, item_modem, sizeof(mbtk_device_info_modem_t))) {
         printf("Write item modem fail:%d\n", errno);
         return -1;
@@ -128,8 +143,13 @@
     return 0;
 }
 
-static int write_item_log(int fd, mbtk_device_info_log_t *item_log)
+static int write_item_log(int fd, uint32 addr, mbtk_device_info_log_t *item_log)
 {
+    if(-1 == lseek(fd, addr, SEEK_SET)) {
+        printf("lseek() fail:%d\n", errno);
+        return -1;
+    }
+
     if(sizeof(mbtk_device_info_log_t) != write(fd, item_log, sizeof(mbtk_device_info_log_t))) {
         printf("Write item log fail:%d\n", errno);
         return -1;
@@ -249,22 +269,22 @@
         goto fail;
     }
 
-    if(write_item_basic(fd, &item_basic)) {
+    if(write_item_basic(fd, info_header.item_header[MBTK_DEVICE_INFO_ITEM_BASIC].addr, &item_basic)) {
         printf("update_and_write_item_basic() fail.");
         goto fail;
     }
 
-    if(write_item_fota(fd, &item_fota)) {
+    if(write_item_fota(fd, info_header.item_header[MBTK_DEVICE_INFO_ITEM_FOTA].addr, &item_fota)) {
         printf("update_and_write_item_fota() fail.");
         goto fail;
     }
 
-    if(write_item_modem(fd, &item_modem)) {
+    if(write_item_modem(fd, info_header.item_header[MBTK_DEVICE_INFO_ITEM_MODEM].addr, &item_modem)) {
         printf("update_and_write_item_modem() fail.");
         goto fail;
     }
 
-    if(write_item_log(fd, &item_log)) {
+    if(write_item_log(fd, info_header.item_header[MBTK_DEVICE_INFO_ITEM_LOG].addr, &item_log)) {
         printf("update_and_write_item_log() fail.");
         goto fail;
     }