From patchwork Tue Oct 8 09:11:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Nyekjaer X-Patchwork-Id: 13826083 Received: from www530.your-server.de (www530.your-server.de [188.40.30.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF65417C7C9 for ; Tue, 8 Oct 2024 09:11:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=188.40.30.78 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728378671; cv=none; b=FhZYN2+XHOpBGKau6BT/crtfJrmgZjCLPzV331qlZ/qFDI3pCODBT8ykUCV6s+NbaQzlUGZ6iwyFhkyH6UU2fp6wrqj1tCTwm/7JlErVLIjEICAG/MXOkJMPChwXHmuM7rwlbaxojR7KgSGrolu/iOeI7MMVqqWf5s6ebFJlymI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728378671; c=relaxed/simple; bh=vpQkhRWA9WuIeAMQtls888VaVio7+JfBVLiblbMqXkc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=LNEs0qTwi3VKURyzH9tqa3zOegix1hwLyVZzcVYhEeRCBQDbsEGxGs57nvwQiV2oyvnHyC58UQ0Tc3cW3TlLiLnAIftGVwwFGWzbuq+0TmZmCU3DJmLzCO8NYyW3RYKOVXmNjXm7drl89BVXbZJ/NDrACjfO6sJfXHsiW+i0ijc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com; spf=pass smtp.mailfrom=geanix.com; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b=pvkl5DU/; arc=none smtp.client-ip=188.40.30.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=geanix.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b="pvkl5DU/" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=geanix.com; s=default2211; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date: Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=0TQkFw80gWto+dmIEcTvWTU0d40uHWqxA5PyQfTWsY4=; b=pvkl5DU/o5S8uP6enJVasDTyVu 1qZ40VAkStLA65rPnQgupkLDGeebb2bvVbDZ0KevbCfXixpfx6BRu5jbyExqvQfVjIzAwCOQuthCc uOMCJBVY6p4KZmR9XpwdrkmqOeZrDgh06rjErWYfxtOMJU6H9iZVvSZ8hELfYu6BlfD8Dp7c0hFA+ xfDCF+R1kfUaIrstNYbJ4Ut4imGfx7w7ABOxe9opzd7epi6uUrd9dz/cv+36yD3YV4y3bkZWLfe71 Yj85GaK9jMuxAaEaJUo3jmSpGQM161EGjhd6OiIZJvX7diMkCuJ26iMob9CnL2eso6Kn8FSwm7RaL 5DmTUN5w==; Received: from sslproxy05.your-server.de ([78.46.172.2]) by www530.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sy6FG-000MYG-QQ; Tue, 08 Oct 2024 11:11:06 +0200 Received: from [185.17.218.86] (helo=zen..) by sslproxy05.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sy6FG-00025v-1e; Tue, 08 Oct 2024 11:11:06 +0200 From: Sean Nyekjaer To: ofono@lists.linux.dev Cc: Sean Nyekjaer , denkenz@gmail.com Subject: [PATCH 1/2] network: allow status' and notifications on eutran networks Date: Tue, 8 Oct 2024 11:11:01 +0200 Message-ID: <20241008091104.1567517-1-sean@geanix.com> X-Mailer: git-send-email 2.46.2 Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Authenticated-Sender: sean@geanix.com X-Virus-Scanned: Clear (ClamAV 0.103.10/27420/Mon Oct 7 10:43:46 2024) SIMCom A7672E-FASE shows attached on LTE with +CREG either 6 registered for "SMS only", home network (applicable only when E-UTRAN) 7 registered for "SMS only", roaming (applicable only when indicates E-UTRAN) +COPS supplies the = EUTRAN --- src/network.c | 58 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/src/network.c b/src/network.c index 40626179..02853e23 100644 --- a/src/network.c +++ b/src/network.c @@ -376,7 +376,8 @@ static char *get_operator_display_name(struct ofono_netreg *netreg) return name; } - if (netreg->status == NETWORK_REGISTRATION_STATUS_REGISTERED) + if (netreg->status == NETWORK_REGISTRATION_STATUS_REGISTERED || + netreg->status == NETWORK_REGISTRATION_STATUS_REGISTERED_SMS_EUTRAN) home_or_spdi = TRUE; else home_or_spdi = sim_spdi_lookup(netreg->spdi, @@ -1205,9 +1206,15 @@ static void current_operator_callback(const struct ofono_error *error, * in which case the operator information frequently comes in bogus. * We ignore it here */ - if (netreg->status != NETWORK_REGISTRATION_STATUS_REGISTERED && - netreg->status != NETWORK_REGISTRATION_STATUS_ROAMING) - current = NULL; + switch (netreg->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: + current = NULL; + } if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { DBG("Error during current operator"); @@ -1324,6 +1331,8 @@ static void notify_emulator_status(struct ofono_atom *atom, void *data) void ofono_netreg_status_notify(struct ofono_netreg *netreg, int status, int lac, int ci, int tech) { + ofono_bool_t netreg_status; + if (netreg == NULL) return; @@ -1351,8 +1360,18 @@ void ofono_netreg_status_notify(struct ofono_netreg *netreg, int status, if (netreg->technology != tech) set_registration_technology(netreg, tech); - if (netreg->status == NETWORK_REGISTRATION_STATUS_REGISTERED || - netreg->status == NETWORK_REGISTRATION_STATUS_ROAMING) { + switch (netreg->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; + } + + if (netreg_status) { if (netreg->driver->current_operator != NULL) netreg->driver->current_operator(netreg, current_operator_callback, netreg); @@ -1448,6 +1467,7 @@ static void init_registration_status(const struct ofono_error *error, void *data) { struct ofono_netreg *netreg = data; + ofono_bool_t netreg_status; if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { DBG("Error during registration status query"); @@ -1460,8 +1480,18 @@ static void init_registration_status(const struct ofono_error *error, * Bootstrap our signal strength value without waiting for the * stack to report it */ - if (netreg->status == NETWORK_REGISTRATION_STATUS_REGISTERED || - netreg->status == NETWORK_REGISTRATION_STATUS_ROAMING) { + switch (netreg->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; + } + + if (netreg_status) { if (netreg->driver->strength != NULL) netreg->driver->strength(netreg, signal_strength_callback, netreg); @@ -1516,9 +1546,15 @@ void ofono_netreg_strength_notify(struct ofono_netreg *netreg, int strength) * Theoretically we can get signal strength even when not registered * to any network. However, what do we do with it in that case? */ - if (netreg->status != NETWORK_REGISTRATION_STATUS_REGISTERED && - netreg->status != NETWORK_REGISTRATION_STATUS_ROAMING) - return; + switch (netreg->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: + return; + } DBG("strength %d", strength); From patchwork Tue Oct 8 09:11:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Nyekjaer X-Patchwork-Id: 13826082 Received: from www530.your-server.de (www530.your-server.de [188.40.30.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF6AA18DF8D for ; Tue, 8 Oct 2024 09:11:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=188.40.30.78 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728378670; cv=none; b=A0R2PVK4KnVsS7aMKGbGbYw4sFGTP1WxoS1kifVIL+Jo9vNls0Y3SAtqt05rL0lBtwJ2JkwZJtnww8XtCgU2AUeM1hZuzQgWnzOVCJMPRvowGfBkDut1XPeT9F/nMEREfqddIrs7I+ZeauKQ29ZcjEM8ykBU+6g1TAJW7jzNvRI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728378670; c=relaxed/simple; bh=lNlf1EWEj3MkM8TGZyXJ4eLiuasOfhkjOr4Spk4AwjE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kUhCBQWFs/nvAAY+NLX7m/+BKcx2zg9qRyNdpDxVq/8sM3gaMFt4y7jssPsO3cpgSPMMc7tliLTMYOtCz3uvFYTDhsNIZp4cUaGaEPfRWgACtH1BVVqeE2zIfr+4mr0evd5nG/M1jPdEc4YJf7Imkw3nWemTNLKSOKcDyW3RnP8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com; spf=pass smtp.mailfrom=geanix.com; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b=X8PagcTP; arc=none smtp.client-ip=188.40.30.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=geanix.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b="X8PagcTP" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=geanix.com; s=default2211; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=sNzP8QSp1LsA7pMy/DT2dg9G0/nPq+Q5KUkLrnXeS9w=; b=X8PagcTPlNow/RXJ/TW2o1ML+Q jnMJCsAfPXnwWLS30flyDidYhqwcPWM+WKnkBXYcLz+RiTv2olC0WhPG0ixpbIcup6VpjJ/pyja+t irDUkIo+e+uL9qazPLYOnTbvW5TRtvpoO+TBfrW1zjS8guZ0PBZeUymGPIpL2IgStRyV2OkxSVkLo 2HltNBn71nFlgbq4MVbykp3nw/GkHFLlbBDVg96KClXOL7Bvng8JjJIRXkRmZA6XLALctd3vTcWqV bu142O/h7Z59XMXrwoq1MwQw2YwUdKsPj8GjgT00kuecZw/3Appv8MOsKRI9c4UY9ejiWRkiY/ZNU DE7+AYIA==; Received: from sslproxy05.your-server.de ([78.46.172.2]) by www530.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sy6FG-000MYJ-VR; Tue, 08 Oct 2024 11:11:06 +0200 Received: from [185.17.218.86] (helo=zen..) by sslproxy05.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sy6FG-00025v-27; Tue, 08 Oct 2024 11:11:06 +0200 From: Sean Nyekjaer To: ofono@lists.linux.dev Cc: Sean Nyekjaer , denkenz@gmail.com Subject: [PATCH 2/2] gprs: allow attached updates and status' on eutran networks Date: Tue, 8 Oct 2024 11:11:02 +0200 Message-ID: <20241008091104.1567517-2-sean@geanix.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241008091104.1567517-1-sean@geanix.com> References: <20241008091104.1567517-1-sean@geanix.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Authenticated-Sender: sean@geanix.com X-Virus-Scanned: Clear (ClamAV 0.103.10/27420/Mon Oct 7 10:43:46 2024) SIMCom A7672E-FASE shows attached on LTE with +CREG either 6 registered for "SMS only", home network (applicable only when E-UTRAN) 7 registered for "SMS only", roaming (applicable only when indicates E-UTRAN) +COPS supplies the = EUTRAN --- src/gprs.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) 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; }