Skip to contentSkip to conversation

xmm7modem: enabling simtoolkit for xmm7modem

PATCH In review Antara Borwankar 2 participants 2 messages Mar 6, 2019 – Mar 7, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xmm7modem: enabling simtoolkit for xmm7modem

added code to enable and initialize stk in xmm7modem plugin

---
 plugins/xmm7xxx.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
plugins/xmm7xxx.c +10 -0
index 90e52fb..83ed263 100644
@@ -1223,6 +1223,16 @@ static void xmm7xxx_pre_sim(struct ofono_modem *modem)
 	DBG("%p", modem);
 
 	ofono_devinfo_create(modem, OFONO_VENDOR_IFX, "atmodem", data->chat);
+
+	ofono_stk_create(modem, 0, "atmodem", data->chat);
+
+	/*	enabling stk	*/
+	g_at_chat_send(data->chat,
+		"AT+CFUN=6", none_prefix, NULL, NULL, NULL);
+	/*	sim reset to get stk menu command	*/
+	g_at_chat_send(data->chat,
+		"AT+CFUN=27,1", none_prefix, NULL, NULL, NULL);
+
 	data->sim = ofono_sim_create(modem, OFONO_VENDOR_IFX, "atmodem",
 					data->chat);
 }
Signature · 1 line
1.9.1
#1 lore raw

Hi Antara,

Quoted 13 lines · Antara Borwankar

added code to enable and initialize stk in xmm7modem plugin

---
  plugins/xmm7xxx.c | 10 ++++++++++
  1 file changed, 10 insertions(+)
plugins/xmm7xxx.c +0 -0
index 90e52fb..83ed263 100644
@@ -1223,6 +1223,16 @@ static void xmm7xxx_pre_sim(struct ofono_modem *modem)
  	DBG("%p", modem);
 
  	ofono_devinfo_create(modem, OFONO_VENDOR_IFX, "atmodem", data->chat);

plugins/xmm7xxx.c static void xmm7xxx_pre_sim(struct ofono_modem *modem) · line 1235

Quoted 10 lines
plugins/xmm7xxx.c +10 -0
+
+	ofono_stk_create(modem, 0, "atmodem", data->chat);
+
+	/*	enabling stk	*/
+	g_at_chat_send(data->chat,
+		"AT+CFUN=6", none_prefix, NULL, NULL, NULL);
+	/*	sim reset to get stk menu command	*/
+	g_at_chat_send(data->chat,
+		"AT+CFUN=27,1", none_prefix, NULL, NULL, NULL);
+

So as a general rule, there should be no AT commands in pre_sim/post_sim/post_online. It is almost always not what you want.

So the question is, where do these belong. You're adding them in pre_sim, so logically they might belong as part of the .enable sequence?

I'm guessing this is to work around the issue of powering off and on a modem with a SIM inserted, right? e.g. since the modem is not being brought fully down, it is caching / keeping whatever SIM state it already discovered.

Regards,
-Denis

Quoted 4 lines
plugins/xmm7xxx.c +0 -0
  	data->sim = ofono_sim_create(modem, OFONO_VENDOR_IFX, "atmodem",
  					data->chat);
  }