diff mbox series

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

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

Commit Message

Sean Nyekjaer Oct. 8, 2024, 9:11 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
---
 src/gprs.c | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/src/gprs.c b/src/gprs.c
index 46668820..59beb6a9 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -1613,7 +1613,7 @@  static gboolean on_lte(struct ofono_gprs *gprs)
 
 static void gprs_attached_update(struct ofono_gprs *gprs)
 {
-	ofono_bool_t attached;
+	ofono_bool_t attached, netreg_status;
 	int status = gprs->status;
 
 	if (on_lte(gprs))
@@ -1626,10 +1626,20 @@  static void gprs_attached_update(struct ofono_gprs *gprs)
 		 * result in detaching...
 		 */
 		attached = have_active_contexts(gprs);
-	else
-		attached = gprs->driver_attached &&
-			(status == NETWORK_REGISTRATION_STATUS_REGISTERED ||
-				status == NETWORK_REGISTRATION_STATUS_ROAMING);
+	else {
+		switch (status) {
+		case NETWORK_REGISTRATION_STATUS_REGISTERED:
+		case NETWORK_REGISTRATION_STATUS_REGISTERED_SMS_EUTRAN:
+		case NETWORK_REGISTRATION_STATUS_ROAMING:
+		case NETWORK_REGISTRATION_STATUS_ROAMING_SMS_EUTRAN:
+			netreg_status = true;
+			break;
+		default:
+			netreg_status = false;
+		}
+
+		attached = gprs->driver_attached && netreg_status;
+	}
 
 	if (attached == gprs->attached)
 		return;
@@ -2637,8 +2647,13 @@  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) {
+	switch (status) {
+	case NETWORK_REGISTRATION_STATUS_REGISTERED:
+	case NETWORK_REGISTRATION_STATUS_REGISTERED_SMS_EUTRAN:
+	case NETWORK_REGISTRATION_STATUS_ROAMING:
+	case NETWORK_REGISTRATION_STATUS_ROAMING_SMS_EUTRAN:
+		break;
+	default:
 		ofono_gprs_detached_notify(gprs);
 		return;
 	}