changeset 854:acc9e473e93f

gsm-fw/g23m-aci/aci/ati_bas.c: +CGxx fix in preparation for enabling MokoFFS
author Space Falcon <falcon@ivan.Harhan.ORG>
date Thu, 30 Apr 2015 02:56:40 +0000
parents ae254ffeaec3
children cbd91f807141
files gsm-fw/g23m-aci/aci/ati_bas.c
diffstat 1 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/gsm-fw/g23m-aci/aci/ati_bas.c	Thu Apr 30 01:46:26 2015 +0000
+++ b/gsm-fw/g23m-aci/aci/ati_bas.c	Thu Apr 30 02:56:40 2015 +0000
@@ -2216,6 +2216,7 @@
 {
   pcm_FileInfo_Type fileInfo;
   USHORT i;
+  char *cp;
 
   TRACE_FUNCTION("aciPrcsPlusCG()");
 
@@ -2225,7 +2226,6 @@
     return ATI_FAIL;
   }
 
-
   if (pcm_ReadFile ((UBYTE*)ef, fileInfo.FileSize,
                     (UBYTE*)g_sa, &fileInfo.Version) NEQ DRV_OK)
   {
@@ -2234,11 +2234,24 @@
   }
 
   i = 0;
-  while ((UBYTE)g_sa[i] NEQ 0xFF)
-  {
+  while ((UBYTE)g_sa[i] NEQ 0xFF AND i < fileInfo.FileSize)
     i++;
-  }
   g_sa[i] = '\0';
+
+#if CONFIG_MOKOFFS
+  /*
+   * Openmoko's FFS has a /pcm/CGMR file programmed like this:
+   *
+   *   GTA02BV4/Moko5
+   *
+   * When queried for +CGMR, we would like to report the hardware revision
+   * from FFS, but also tell the user that we are FreeCalypso and not Moko5.
+   * Hence the following hack.
+   */
+  if ((cp = strchr(g_sa, '/')) && !strncmp(cp + 1, "Moko", 4))
+    strcpy(cp + 1, "FreeCalypso");
+#endif
+
   io_sendMessage (srcId, g_sa, ATI_NORMAL_OUTPUT );
 
   return ATI_CMPL;