Skip to content

Commit 3b2d190

Browse files
committed
drivers: modem_cellular: added automatic APN selection support
* Add CONFIG_MODEM_CELLULAR_AUTO_APN and CONFIG_MODEM_CELLULAR_AUTO_APN_PROFILES Kconfig options. * Detect APN from IMSI (MCC/MNC) and select profile at run‑time. * Build APN SET script dynamically: - Always sends AT+CGDCONT=1,"IP","<apn>" - Adds AT+KCNXCFG for HL7800. * Insert new MODEM_CELLULAR_STATE_RUN_APN_SCRIPT before the dial script to apply either the static or detected APN. * Remove hard‑coded APN commands from dial scripts; all modems now share the common builder. Signed-off-by: Van Petrosyan <[email protected]>
1 parent f66460b commit 3b2d190

File tree

2 files changed

+236
-44
lines changed

2 files changed

+236
-44
lines changed

drivers/modem/Kconfig.cellular

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,23 @@ config MODEM_CELLULAR_APN
3636
string "APN"
3737
default "internet"
3838

39+
config MODEM_CELLULAR_AUTO_APN
40+
bool "Autodetect APN from SIM IMSI"
41+
help
42+
If enabled, the driver derives the APN from the SIM’s
43+
MCC + MNC. Falls back to CONFIG_MODEM_CELLULAR_APN
44+
if no match is found.
45+
46+
config MODEM_CELLULAR_AUTO_APN_PROFILES
47+
string "APN profile list"
48+
depends on MODEM_CELLULAR_AUTO_APN
49+
default "shared.m2m.ch=22801, em=29505 90143 29509"
50+
help
51+
Comma‑separated list of mappings in the form:
52+
<apn>=<mccmnc1> <mccmnc2> …
53+
Each <mccmnc> is a 5‑ or 6‑digit Mobile Country Code + Mobile
54+
Network Code.
55+
3956
config MODEM_CELLULAR_PERIODIC_SCRIPT_MS
4057
int "Periodic script interval in milliseconds"
4158
default 2000

0 commit comments

Comments
 (0)