changeset 28:fcaacf995636

AT+CGxx: remove leo2moko hacks
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sun, 01 Nov 2015 17:25:37 +0000
parents a0605a6290e1
children 132b3e230631
files g23m/condat/ms/src/aci/ati_bas.c
diffstat 1 files changed, 3 insertions(+), 118 deletions(-) [+]
line wrap: on
line diff
--- a/g23m/condat/ms/src/aci/ati_bas.c	Sun Nov 01 15:57:46 2015 +0000
+++ b/g23m/condat/ms/src/aci/ati_bas.c	Sun Nov 01 17:25:37 2015 +0000
@@ -2176,14 +2176,8 @@
 | STATE   : code                        ROUTINE : aciPrcsPlusCG      |
 +--------------------------------------------------------------------+
 
-Conditioned-out below is TI's original version of the function
-responsible for generating responses to +CGMI, +CGMM, +CGMR and +CGSN
-commands.  As you can see, it is very simple and straightforward.
-But see the comments afterward for why the FreeCalypso firmware has
-to use a not-very-clean hacked version instead.
+  PURPOSE :
 */
-
-#if 0
 LOCAL T_ATI_RSLT aciPrcsPlusCG (UBYTE srcId, CHAR* cl, CHAR* ef)
 {
   pcm_FileInfo_Type fileInfo;
@@ -2197,7 +2191,6 @@
     return ATI_FAIL;
   }
 
-
   if (pcm_ReadFile ((UBYTE*)ef, fileInfo.FileSize,
                     (UBYTE*)g_sa, &fileInfo.Version) NEQ DRV_OK)
   {
@@ -2206,118 +2199,10 @@
   }
 
   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';
-  io_sendMessage (srcId, g_sa, ATI_NORMAL_OUTPUT );
-
-  return ATI_CMPL;
-}
-#endif
-
-/*
-As you can see in the conditioned-out code above, TI's original
-implementation of +CGMI/+CGMM/+CGMR/+CGSN simply spits out whatever
-gets read out of PCM/FFS.  But if one runs that original TI code
-on the Openmoko GSM modem, there are some undesirable effects:
-
-* The strings stored in FFS in /pcm/CGM[IMR] (written there at the
-  factory along with the IMEI and the RF calibration data, I presume)
-  are just plain text, e.g., "FIC/OpenMoko" (w/o quotes) in /pcm/CGMI
-  and "Neo1973 GTA02" (ditto) in /pcm/CGMM.  The PCM code trustingly
-  reads them out of FFS and into the in-RAM PCM table.  But if you
-  look at the PCM compiled-in defaults in
-  ../../../../../chipsetsw/drivers/drv_app/ffs/board/pcmdata.c,
-  it appears that at some point they were intended to be enclosed
-  in angle brackets.  The experiments I (Space Falcon) did suggest
-  that the ATI layer is perfectly happy to emit these PlusCG responses
-  either in the angle-bracketed form, or in the form used by Om's
-  firmware, e.g., +CGMM: "Neo1973 whatever embedded modem".
-  But if PCM contains an unencapsulated string like "Neo1973 GTA02"
-  (read from FFS) and that string gets emitted raw, the ATI layer
-  gets confused somewhere.
-
-* TI's ATI layer is not the only code that needs to be kept happy.
-  The code that talks AT commands to our modem (fsogsmd or whatever)
-  probably expects the +CGMI/+CGMM/+CGMR/+CGSN responses to be
-  formatted (encapsulated) in the form in which Om's firmware emits
-  them, hence I reason we should do our best to reproduce that format.
-  My version below implements +CGMI and +CGMM by reading the string
-  value out of PCM (FFS in practice) and encapsulating it in the
-  Om-like manner before handing it to the ATI layer for output.
-
-* For +CGMR I return a compiled-in string identifying this FreeCalypso
-  firmware.  I see no point in reading anything out of FFS or PCM
-  at all in this case, as the objective of the +CGMR query is to
-  identify the firmware version in use, rather than factory FFS
-  programming.
-
-* With TI's vanilla code, the +CGSN query is logically independent of
-  the IMEI seen by the GSM stack: it fetches the CGSN record (not the
-  IMEI one) from PCM, and that record would have to be populated from
-  a /pcm/CGSN file in FFS, if there was one - but Om's GTA0x modems
-  have no such file in their FFS from the factory.  If one runs TI's
-  vanilla code, one would get this dummy output: <serial number>,
-  coming from the compiled-in PCM default table.  Om's firmware
-  responds with "+CGSN: 123456789012345" (IMEI digits, no quotes)
-  instead.  My implementation below replicates Om's functionality.
-
-So without further commentary, here is my hacked version of
-the aciPrcsPlusCG() function:
-*/
-
-LOCAL T_ATI_RSLT aciPrcsPlusCG (UBYTE srcId, CHAR* cl, CHAR* ef_req)
-{
-  CHAR* ef_read;
-  pcm_FileInfo_Type fileInfo;
-  int c, i, j, is_imei;
-  char buf[32];
-
-  TRACE_FUNCTION("aciPrcsPlusCG()");
-
-  if (!strcmp(ef_req, EF_CGMR_ID)) {
-    sprintf(g_sa, "+%s: \"FreeCalypso leo2moko port\"", ef_req);
-    io_sendMessage (srcId, g_sa, ATI_NORMAL_OUTPUT );
-    return ATI_CMPL;
-  } else if (!strcmp(ef_req, EF_CGSN_ID)) {
-    ef_read = EF_IMEI_ID;
-    is_imei = 1;
-  } else {
-    ef_read = ef_req;
-    is_imei = 0;
-  }
-
-  if (pcm_GetFileInfo ((UBYTE* )ef_read, &fileInfo) NEQ DRV_OK)
-  {
-    cmdCmeError (CME_ERR_MemFail);
-    return ATI_FAIL;
-  }
-
-  if (is_imei) {
-
-    for (i = 0, j = 0; i < fileInfo.FileSize; i++) {
-	buf[j++] = (fileInfo.FileLocation[i] & 0x0F) + '0';
-	buf[j++] = (fileInfo.FileLocation[i] >> 4) + '0';
-    }
-    buf[j-1] = '\0';
-
-  } else {
-
-    buf[0] = '\"';
-    for (i = 0, j = 1; i < fileInfo.FileSize; i++) {
-	c = fileInfo.FileLocation[i];
-	if (c == 0 || c == 0xFF)
-		break;
-	buf[j++] = c;
-    }
-    buf[j++] = '\"';
-    buf[j] = '\0';
-
-  }
-
-  sprintf(g_sa, "+%s: %s", ef_req, buf);
+
   io_sendMessage (srcId, g_sa, ATI_NORMAL_OUTPUT );
 
   return ATI_CMPL;