changeset 891:f3fba126778a

gsm-fw/comlib/cl_imei.c: implemented reading of Pirelli's factory IMEI record
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 29 Jun 2015 21:58:15 +0000
parents 452a4aea3fc5
children eed6dc6aca3c
files gsm-fw/comlib/cl_imei.c
diffstat 1 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/gsm-fw/comlib/cl_imei.c	Mon Jun 29 21:45:23 2015 +0000
+++ b/gsm-fw/comlib/cl_imei.c	Mon Jun 29 21:58:15 2015 +0000
@@ -92,7 +92,11 @@
   }
 }
 
-#if 0	// function for reading from Pirelli's factory block not written yet
+extern int pirelli_read_factory_record(uint32 offset, void *userbuf,
+					T_FFS_SIZE size, int has_chksum);
+
+#define	PIRELLI_IMEI_OFFSET	0x504
+
 /*
 +------------------------------------------------------------------------------
 | Function    : pirelli_get_imeisv
@@ -122,9 +126,10 @@
 
   /*
    * Read ISDID(enciphered IMEISV+DieID) from FFS.
-   * TODO: change the code to read from Pirelli's factory data block instead
+   * (changed to read from Pirelli's factory data block instead)
    */
-  if((ret = ffs_file_read(CL_IMEI_FFS_PATH, isdid_buf, CL_IMEI_ISDID_SIZE)) >= EFFS_OK)
+  if((ret = pirelli_read_factory_record(PIRELLI_IMEI_OFFSET, isdid_buf,
+					CL_IMEI_ISDID_SIZE, 0)) >= EFFS_OK)
   {
    /*
     * Read Die ID for using as DES key
@@ -162,7 +167,6 @@
   return ret;
 
 }/* pirelli_get_imeisv() */
-#endif	/* #if 0 */
 #endif	/* CONFIG_TARGET_PIRELLI */
 
 
@@ -260,9 +264,14 @@
     imei_flag = 1;
     return CL_IMEI_OK;
   }
+#if CONFIG_TARGET_PIRELLI
+  ret = pirelli_get_imeisv (imeiBufSize, imeiBufPtr);
+  if (ret == CL_IMEI_OK) {
+    imei_flag = 1;
+    return ret;
+  }
+#else
   ret = CL_IMEI_READ_IMEI_FAILED;
-#if CONFIG_TARGET_PIRELLI
-  /* not yet implemented */
 #endif
   TRACE_ERROR("CL IMEI FATAL ERROR: IMEI not available!");
   memcpy(imeiBufPtr, C_DEFAULT_IMEISV_DSAMPLE, CL_IMEI_SIZE);