diff mbox series

[v2,2/2] gprs: allow attached updates and status' on eutran networks

Message ID 20241018105147.1382861-2-sean@geanix.com (mailing list archive)
State Accepted
Commit 2cf81c33a02bcb9f39fd385f4bbab65e8416fe77
Headers show
Series [v2,1/2] network: allow status' and notifications on eutran networks | expand

Commit Message

Sean Nyekjaer Oct. 18, 2024, 10:51 a.m. UTC
SIMCom A7672E-FASE shows attached on LTE with +CREG <stat> either
6 registered for "SMS only", home network (applicable only when E-UTRAN)
7 registered for "SMS only", roaming (applicable only when <AcT> indicates
E-UTRAN)
+COPS supplies the <AcT> = EUTRAN
---
Changes since v1:
 - removed switch cases in favor of L_IN_SET

 src/gprs.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/src/gprs.c b/src/gprs.c
index 46668820..3c71f808 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -1627,9 +1627,11 @@  static void gprs_attached_update(struct ofono_gprs *gprs)
 		 */
 		attached = have_active_contexts(gprs);
 	else
-		attached = gprs->driver_attached &&
-			(status == NETWORK_REGISTRATION_STATUS_REGISTERED ||
-				status == NETWORK_REGISTRATION_STATUS_ROAMING);
+		attached = gprs->driver_attached && L_IN_SET(status,
+			NETWORK_REGISTRATION_STATUS_REGISTERED,
+			NETWORK_REGISTRATION_STATUS_REGISTERED_SMS_EUTRAN,
+			NETWORK_REGISTRATION_STATUS_ROAMING,
+			NETWORK_REGISTRATION_STATUS_ROAMING_SMS_EUTRAN);
 
 	if (attached == gprs->attached)
 		return;
@@ -2637,8 +2639,10 @@  void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status)
 	if (gprs->flags & GPRS_FLAG_ATTACHING)
 		return;
 
-	if (status != NETWORK_REGISTRATION_STATUS_REGISTERED &&
-			status != NETWORK_REGISTRATION_STATUS_ROAMING) {
+	if (!L_IN_SET(status, NETWORK_REGISTRATION_STATUS_REGISTERED,
+				NETWORK_REGISTRATION_STATUS_REGISTERED_SMS_EUTRAN,
+				NETWORK_REGISTRATION_STATUS_ROAMING,
+				NETWORK_REGISTRATION_STATUS_ROAMING_SMS_EUTRAN)) {
 		ofono_gprs_detached_notify(gprs);
 		return;
 	}