FreeCalypso > hg > fc-magnetite
view src/aci2/aci/aci_bat_ss.c @ 636:57e67ca2e1cb
pcmdata.c: default +CGMI to "FreeCalypso" and +CGMM to model
The present change has no effect whatsoever on Falconia-made and Openmoko-made
devices on which /pcm/CGMI and /pcm/CGMM files have been programmed in FFS
with sensible ID strings by the respective factories, but what should AT+CGMI
and AT+CGMM queries return when the device is a Huawei GTM900 or Tango modem
that has been converted to FreeCalypso with a firmware change? Before the
present change they would return compiled-in defaults of "<manufacturer>" and
"<model>", respectively; with the present change the firmware will self-identify
as "FreeCalypso GTM900-FC" or "FreeCalypso Tango" on the two respective targets.
This firmware identification will become important if someone incorporates an
FC-converted GTM900 or Tango modem into a ZeroPhone-style smartphone where some
high-level software like ofono will be talking to the modem and will need to
properly identify this modem as FreeCalypso, as opposed to some other AT command
modem flavor with different quirks.
In technical terms, the compiled-in default for the AT+CGMI query (which will
always be overridden by the /pcm/CGMI file in FFS if one is present) is now
"FreeCalypso" in all configs on all targets; the compiled-in default for the
AT+CGMM query (likewise always overridden by /pcm/CGMM if present) is
"GTM900-FC" if CONFIG_TARGET_GTM900 or "Tango" if CONFIG_TARGET_TANGO or the
original default of "<model>" otherwise.
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Sun, 19 Jan 2020 20:14:58 +0000 |
| parents | 93999a60b835 |
| children |
line wrap: on
line source
/* +----------------------------------------------------------------------------- | Project : GSM-F&D (8411) | Modul : ACI_BAT +----------------------------------------------------------------------------- | Copyright 2002 Texas Instruments Berlin, AG | All rights reserved. | | This file is confidential and a trade secret of Texas | Instruments Berlin, AG | The receipt of or possession of this file does not convey | any rights to reproduce or disclose its contents or to | manufacture, use, or sell anything it may describe, in | whole, or in part, without the specific written consent of | Texas Instruments Berlin, AG. +----------------------------------------------------------------------------- | Purpose : This BAT wrapper modul is ... | +----------------------------------------------------------------------------- */ #include "aci_all.h" /* includes prim.h, which includes p_bat.h */ #include "aci_cmh.h" #include "ati_cmd.h" #include "aci_cmd.h" /* prototypes of helper functions */ #include "psa.h" #include "cmh.h" #include "aci_bat_cmh.h" /* prototypes of sBAT_,qBAT_,tBAT_ */ #include "aci_bat.h" #include "aci_bat_err.h" /*prototypes of err functions for BAT*/ /* +--------------------------------------------------------------------+ | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | STATE : code ROUTINE : sBAT_PlusCTFR | +--------------------------------------------------------------------+ PURPOSE : */ GLOBAL T_ACI_BAT_RSLT sBAT_PlusCTFR (T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_send *cmd) { T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; T_ACI_TOA type; T_ACI_TOA *p_type; T_ACI_TOS satype; T_ACI_TOS *p_satype; //CHAR *subadr = subBuf; char subBuf[MAX_SUBADDR_LEN]={0}; char* p_subBuf; SHORT toa_oct = 0; SHORT tos_oct = 0; CHAR numBuf[MAX_B_SUBSCR_NUM_LEN]; TRACE_FUNCTION ("sBAT_PlusCTFR()"); p_type = &type; p_satype = &satype; p_subBuf = subBuf; memset( numBuf, 0, sizeof(numBuf)); memcpy(numBuf,cmd->params.ptr_set_plus_ctfr->number,cmd->params.ptr_set_plus_ctfr->c_number); if ( cmd->params.ptr_set_plus_ctfr->type EQ BAT_PARAMETER_NOT_PRESENT ) { p_type = NULL; } else { toa_oct = cmd->params.ptr_set_plus_ctfr->type; } if ( cmd->params.ptr_set_plus_ctfr->satype EQ BAT_PARAMETER_NOT_PRESENT ) { p_satype = NULL; } else { tos_oct = cmd->params.ptr_set_plus_ctfr->satype; } /* Type Of Address present */ type = toa_demerge (toa_oct); if (type.ton < 0 OR type.npi < 0) { ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_OpNotAllow); return (ACI_BAT_FAIL); } satype = tos_demerge (tos_oct); if (satype.tos < 0 OR satype.oe < 0) { ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_OpNotAllow); return (ACI_BAT_FAIL); } if(cmd->params.ptr_set_plus_ctfr->v_subaddr) { memcpy(subBuf,cmd->params.ptr_set_plus_ctfr->subaddr,cmd->params.ptr_set_plus_ctfr->c_subaddr); } else { p_subBuf = NULL; } ret = sAT_PlusCTFR (src_infos_psi->srcId, numBuf, p_type, p_subBuf, p_satype); return(ret); } /* +--------------------------------------------------------------------+ | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | STATE : code ROUTINE : sBAT_PlusCCFC | +--------------------------------------------------------------------+ PURPOSE : */ GLOBAL T_ACI_BAT_RSLT sBAT_PlusCCFC (T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_send *cmd) { T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; T_BAT_plus_ccfc_reason reason; T_BAT_plus_ccfc_mode mode; T_ACI_TOA type; T_ACI_TOA *p_type; T_ACI_TOS satype; T_ACI_TOS *p_satype; T_BAT_plus_ccfc_bearer_class class_type=BAT_CCFC_CLASS_NOT_PRESENT; //CHAR *subadr = subBuf; char subBuf[MAX_SUBADDR_LEN]={0}; char* p_subBuf; T_BAT_plus_ccfc_time time=BAT_CCFC_TIME_NOT_PRESENT; SHORT toa_oct=0; SHORT tos_oct=0; CHAR numBuf[MAX_B_SUBSCR_NUM_LEN]; CHAR* p_numBuf; TRACE_FUNCTION ("sBAT_PlusCCFC()"); p_type=&type; p_satype=&satype; p_subBuf = subBuf; p_numBuf = numBuf; memset( numBuf, 0, sizeof(numBuf)); reason = cmd->params.ptr_set_plus_ccfc->reason; mode = cmd->params.ptr_set_plus_ccfc->mode; toa_oct = cmd->params.ptr_set_plus_ccfc->type; tos_oct = cmd->params.ptr_set_plus_ccfc->satype; class_type = cmd->params.ptr_set_plus_ccfc->bearer_class; time = cmd->params.ptr_set_plus_ccfc->time; if (mode EQ BAT_CCFC_MODE_QUERY) /*query mode*/ { ret = qAT_PlusCCFC(src_infos_psi->srcId,reason,class_type); switch (ret) { case AT_EXCT: case ATI_BUSY: case ATI_FAIL: { return ret; } default: { return (ACI_BAT_FAIL); } } } if(cmd->params.ptr_set_plus_ccfc->v_subaddr) { memcpy(subBuf,cmd->params.ptr_set_plus_ccfc->subaddr,cmd->params.ptr_set_plus_ccfc->c_subaddr); } else { p_subBuf = NULL; } if ( cmd->params.ptr_set_plus_ccfc->type EQ BAT_PARAMETER_NOT_PRESENT ) { p_type = NULL; } else { toa_oct = cmd->params.ptr_set_plus_ccfc->type; } if ( cmd->params.ptr_set_plus_ccfc->satype EQ BAT_PARAMETER_NOT_PRESENT ) { p_satype = NULL; } else { tos_oct = cmd->params.ptr_set_plus_ccfc->satype; } /* Type Of Address present */ type = toa_demerge (toa_oct); if (type.ton < 0 OR type.npi < 0) { ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_OpNotAllow); return (ACI_BAT_FAIL); } satype = tos_demerge (tos_oct); if (satype.tos < 0 OR satype.oe < 0) { ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_OpNotAllow); return (ACI_BAT_FAIL); } if(cmd->params.ptr_set_plus_ccfc->v_number) { memcpy(numBuf,cmd->params.ptr_set_plus_ccfc->number,cmd->params.ptr_set_plus_ccfc->c_number); } else { p_numBuf = NULL; } ret = sAT_PlusCCFC(src_infos_psi->srcId,reason,mode,p_numBuf,p_type,class_type,p_subBuf,p_satype,time); return(ret); } /* +--------------------------------------------------------------------+ | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | STATE : code ROUTINE : sBAT_PlusCLCK | +--------------------------------------------------------------------+ PURPOSE : */ GLOBAL T_ACI_BAT_RSLT sBAT_PlusCLCK (T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_send *cmd) { T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; T_BAT_plus_clck_fac fac_num; T_BAT_plus_clck_mode mod; T_BAT_bearer_class class_type = BAT_CLASS_NOT_PRESENT; T_BAT_cmd_response resp; T_ACI_CLSSTAT clsStat; char passwd[MAX_PWD_LENGTH]={0}; TRACE_FUNCTION ("sBAT_PlusCLCK()"); fac_num = cmd->params.ptr_set_plus_clck->fac; mod = cmd->params.ptr_set_plus_clck->mode; class_type = cmd->params.ptr_set_plus_clck->bearer_class; if (mod EQ BAT_CLCK_MODE_QUERY) /*query mode*/ { T_BAT_res_set_plus_clck clck; ret=qAT_PlusCLCK(src_infos_psi->srcId,fac_num,class_type,&clsStat); resp.ctrl_response = BAT_RES_SET_PLUS_CLCK; resp.response.ptr_set_plus_clck = &clck; resp.response.ptr_set_plus_clck->status = BAT_CLCK_STATUS_NOT_ACTIVE ; resp.response.ptr_set_plus_clck->bearer_class = BAT_CLASS_NOT_PRESENT; if(ret EQ AT_CMPL) { switch(clsStat.status) { case STATUS_Active: resp.response.ptr_set_plus_clck->status = BAT_CLCK_STATUS_ACTIVE; break; case STATUS_NotActive: resp.response.ptr_set_plus_clck->status = BAT_CLCK_STATUS_NOT_ACTIVE; break; } if(clsStat.class_type NEQ CLASS_NotPresent) { resp.response.ptr_set_plus_clck->bearer_class = clsStat.class_type; } aci_bat_send(src_infos_psi , &resp); return (ACI_BAT_CMPL); } } else /*set mode*/ { if(cmd->params.ptr_set_plus_clck->v_passwd) { memcpy(passwd,cmd->params.ptr_set_plus_clck->passwd,cmd->params.ptr_set_plus_clck->c_passwd); } ret = sAT_PlusCLCK(src_infos_psi->srcId,fac_num,mod,passwd,class_type); } switch(ret) { case AT_EXCT: case AT_FAIL: { break; } case(AT_BUSY): { TRACE_EVENT("sBAT_PlusCLCK(): ME is busy"); break; } } return(ret); } /* +--------------------------------------------------------------------+ | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | STATE : code ROUTINE : sBAT_PlusCPWD | +--------------------------------------------------------------------+ PURPOSE : */ GLOBAL T_ACI_BAT_RSLT sBAT_PlusCPWD (T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_send *cmd) { T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; T_BAT_plus_cpwd_fac fac_num; CHAR oldpwd[MAX_PWD_LENGTH]={0}; CHAR newpwd[MAX_PWD_LENGTH]={0}; TRACE_FUNCTION ("sBAT_PlusCPWD()"); fac_num = cmd->params.ptr_set_plus_cpwd->fac; memcpy(oldpwd, cmd->params.ptr_set_plus_cpwd->oldpwd,cmd->params.ptr_set_plus_cpwd->c_oldpwd); memcpy(newpwd, cmd->params.ptr_set_plus_cpwd->newpwd,cmd->params.ptr_set_plus_cpwd->c_newpwd); ret = sAT_PlusCPWD(src_infos_psi->srcId,fac_num,oldpwd,newpwd); return(ret); } /* +--------------------------------------------------------------------+ | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | STATE : code ROUTINE : sBAT_PlusCUSD | +--------------------------------------------------------------------+ PURPOSE : */ GLOBAL T_ACI_BAT_RSLT sBAT_PlusCUSD (T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_send *cmd) { T_ACI_BAT_RSLT ret; T_ACI_USSD_DATA ussd; T_ACI_USSD_DATA *ussd_ptr; T_BAT_cmd_set_plus_cusd *cusd; TRACE_FUNCTION ("sBAT_PlusCUSD()"); /* * Get a pointer to the BAT structure for convenience. */ cusd=cmd->params.ptr_set_plus_cusd; ussd_ptr=NULL; if (cusd->v_str) { USHORT len; utl_ussdDtaFromTe ( (UBYTE*)cusd->str, cusd->c_str, (UBYTE*)ussd.data, &len, (UBYTE)cusd->dcs); if (len>MAX_USSD_LEN) { /* * The USSD string is too big for the ACI structure. This should * not happen, and if it does means that we have overwritten * memory. */ ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_TxtToLong); return(ACI_BAT_FAIL); } ussd.len=(UBYTE)len; ussd_ptr=&ussd; } /* * Call the corresponding sAT function. T_ACI_BAT_RSLT is * assumed to be equivalent to T_ACI_RESULT. */ ret=(T_ACI_BAT_RSLT)sAT_PlusCUSD( src_infos_psi->srcId, ussd_ptr, (SHORT)cusd->dcs); return(ret); }
