drivers: modem: gsm: Add setting of MCC number
Add Kconfig option that allows user to set MCC (Mobile Country Code). If user does not set it, then automatic operator registration is used. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
49724e25a0
commit
b05e72f3bb
2 changed files with 39 additions and 0 deletions
|
@ -29,4 +29,12 @@ config MODEM_GSM_APN
|
||||||
Specify Access Point Name, i.e. the name to identify Internet IP
|
Specify Access Point Name, i.e. the name to identify Internet IP
|
||||||
GPRS cellular data context.
|
GPRS cellular data context.
|
||||||
|
|
||||||
|
config MODEM_GSM_MANUAL_MCCMNO
|
||||||
|
string "MCC/MNO for establishing network connection"
|
||||||
|
help
|
||||||
|
This setting is used in the AT+COPS command to set the MCC/MNO
|
||||||
|
for the network connection context. This value is specific to
|
||||||
|
the network provider and may need to be changed if auto is not
|
||||||
|
selected.
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -205,6 +205,36 @@ static struct setup_cmd setup_cmds[] = {
|
||||||
SETUP_CMD_NOHANDLE("ATD*99#")
|
SETUP_CMD_NOHANDLE("ATD*99#")
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int gsm_setup_mccmno(struct gsm_modem *gsm)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (CONFIG_MODEM_GSM_MANUAL_MCCMNO[0]) {
|
||||||
|
/* use manual MCC/MNO entry */
|
||||||
|
ret = modem_cmd_send(&gsm->context.iface,
|
||||||
|
&gsm->context.cmd_handler,
|
||||||
|
NULL, 0,
|
||||||
|
"AT+COPS=1,2,\""
|
||||||
|
CONFIG_MODEM_GSM_MANUAL_MCCMNO
|
||||||
|
"\"",
|
||||||
|
&gsm->sem_response,
|
||||||
|
GSM_CMD_AT_TIMEOUT);
|
||||||
|
} else {
|
||||||
|
/* register operator automatically */
|
||||||
|
ret = modem_cmd_send(&gsm->context.iface,
|
||||||
|
&gsm->context.cmd_handler,
|
||||||
|
NULL, 0, "AT+COPS=0,0",
|
||||||
|
&gsm->sem_response,
|
||||||
|
GSM_CMD_AT_TIMEOUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret < 0) {
|
||||||
|
LOG_ERR("AT+COPS ret:%d", ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static void gsm_configure(struct k_work *work)
|
static void gsm_configure(struct k_work *work)
|
||||||
{
|
{
|
||||||
int r = -1;
|
int r = -1;
|
||||||
|
@ -225,6 +255,7 @@ static void gsm_configure(struct k_work *work)
|
||||||
LOG_DBG("modem not ready %d", r);
|
LOG_DBG("modem not ready %d", r);
|
||||||
} else {
|
} else {
|
||||||
LOG_DBG("connect with modem %d", r);
|
LOG_DBG("connect with modem %d", r);
|
||||||
|
(void)gsm_setup_mccmno(gsm);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue