changeset 216:557041e392a9

src/g23m-aci/aci/ati_bas.c: handle +CGxx like the aci2 version
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 15 Oct 2016 06:16:40 +0000
parents 1181c9733e08
children 2f17574d7001
files src/g23m-aci/aci/ati_bas.c
diffstat 1 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/g23m-aci/aci/ati_bas.c	Sat Oct 15 06:08:39 2016 +0000
+++ b/src/g23m-aci/aci/ati_bas.c	Sat Oct 15 06:16:40 2016 +0000
@@ -73,6 +73,8 @@
 
 #endif /*FF_ATI_BAT*/
 
+#include "fc-target.cfg"
+
 LOCAL T_ATI_RSLT aciPrcsPlusCG (UBYTE srcId, CHAR* cl, CHAR* ef);
 LOCAL T_ATI_RSLT setaciPrcsVolLevel ( CHAR* cl, UBYTE device );
 LOCAL T_ATI_RSLT tesaciPrcsVolLevel ( UBYTE srcId, CHAR* cl, UBYTE device );
@@ -2211,6 +2213,7 @@
 {
   pcm_FileInfo_Type fileInfo;
   USHORT i;
+  char *cp;
 
   TRACE_FUNCTION("aciPrcsPlusCG()");
 
@@ -2220,7 +2223,6 @@
     return ATI_FAIL;
   }
 
-
   if (pcm_ReadFile ((UBYTE*)ef, fileInfo.FileSize,
                     (UBYTE*)g_sa, &fileInfo.Version) NEQ DRV_OK)
   {
@@ -2229,11 +2231,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';
+
+#ifdef 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;