diff mbox series

[07/10] sim7100: enable A76XX simcom vendor quirks for relevant atoms

Message ID 20240430115234.180185-7-martin@geanix.com (mailing list archive)
State Accepted
Commit 734689fde230561b5922259f01a31fa27971b206
Headers show
Series [01/10] sim7100: simplify serial device opening | expand

Commit Message

Martin Hundebøll April 30, 2024, 11:52 a.m. UTC
Use the recently added detection of modem model to apply the even more
recently added SIMCom sub-vendor id when creating atoms.

The "old" SIMCom vendor id is shared between the sim7100 and sim900
drivers, and so changing the 0 vendor id's for the existing
ofono_*_create() calls might have unexpected side-effects. Avoid such
changes by calling the needed ofono_*_create() functions separately for
each model instead.
---
 plugins/sim7100.c | 35 ++++++++++++++++++++++++++++++-----
 1 file changed, 30 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/plugins/sim7100.c b/plugins/sim7100.c
index 2e9d0eb3..192559d6 100644
--- a/plugins/sim7100.c
+++ b/plugins/sim7100.c
@@ -241,8 +241,19 @@  static void sim7100_pre_sim(struct ofono_modem *modem)
 	DBG("");
 
 	ofono_devinfo_create(modem, 0, "atmodem", data->at);
-	sim = ofono_sim_create(modem, 0, "atmodem", data->at);
-	ofono_voicecall_create(modem, OFONO_VENDOR_SIMCOM, "atmodem", data->at);
+
+	switch (data->model) {
+	case SIMCOM_A76XX:
+		sim = ofono_sim_create(modem, OFONO_VENDOR_SIMCOM_A76XX,
+							"atmodem", data->at);
+		ofono_voicecall_create(modem, 0, "atmodem", data->at);
+		break;
+	default:
+		sim = ofono_sim_create(modem, 0, "atmodem", data->at);
+		ofono_voicecall_create(modem, OFONO_VENDOR_SIMCOM,
+							"atmodem", data->at);
+		break;
+	}
 
 	if (sim)
 		ofono_sim_inserted_notify(sim, TRUE);
@@ -260,13 +271,27 @@  static void sim7100_post_sim(struct ofono_modem *modem)
 	ofono_ussd_create(modem, 0, "atmodem", data->at);
 	ofono_call_forwarding_create(modem, 0, "atmodem", data->at);
 	ofono_call_settings_create(modem, 0, "atmodem", data->at);
-	ofono_netreg_create(modem, 0, "atmodem", data->at);
 	ofono_call_meter_create(modem, 0, "atmodem", data->at);
 	ofono_call_barring_create(modem, 0, "atmodem", data->at);
-	ofono_sms_create(modem, OFONO_VENDOR_SIMCOM, "atmodem", data->at);
 	ofono_phonebook_create(modem, 0, "atmodem", data->at);
 
-	gprs = ofono_gprs_create(modem, 0, "atmodem", data->at);
+	switch (data->model) {
+	case SIMCOM_A76XX:
+		ofono_netreg_create(modem, OFONO_VENDOR_SIMCOM_A76XX,
+							"atmodem", data->at);
+		ofono_sms_create(modem, OFONO_VENDOR_SIMCOM_A76XX,
+							"atmodem", data->at);
+		gprs = ofono_gprs_create(modem, OFONO_VENDOR_SIMCOM_A76XX,
+							"atmodem", data->at);
+		break;
+	default:
+		ofono_netreg_create(modem, 0, "atmodem", data->at);
+		ofono_sms_create(modem, OFONO_VENDOR_SIMCOM, "atmodem",
+								data->at);
+		gprs = ofono_gprs_create(modem, 0, "atmodem", data->at);
+		break;
+	}
+
 	gc = ofono_gprs_context_create(modem, 0, "atmodem", data->ppp);
 
 	if (gprs && gc)