From patchwork Wed Apr 10 11:29:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Thomas X-Patchwork-Id: 1921932 X-Patchwork-Delegate: lynxis@fe80.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=bfUPPE3o; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=WkpSK3uz; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VF0zf0Gv6z1yYB for ; Wed, 10 Apr 2024 21:32:13 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=59Km1V8RA6InE1FBHaNo4EcPFQbFwWcwNb7VzG9lP18=; b=bfUPPE3oyW2W4W L8GryKpKCidoR02wEi7cJ9ZojZtPJK1WLDZAaxDKcjLWy34t7D128ThKiIptyY8xKVK3d3UW7TKux pRVUcVGyS90M4JjSxK0otdStSNYimrQv1qxC3Kx/raZFjkEOs4806GWvPmO7gQxDMMJwYgEfmsxgQ OOWMtT86EX+kXnZqnxwFvvTd9vg9Ig0ONR3TnKBVQv5ypnwlDKZH7zb6CeTMTorAc/e4r1VMJZEok BqIuy6/JDl1DnxlrzKDSpRtoPgY70lBXObaUjzde4tSHx7XNJfItAdtPI3VXVv198CqkxUwlQpwKv Aqt9Tt7OQf/DlEGIYCOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruW97-00000006dQF-0kVg; Wed, 10 Apr 2024 11:29:41 +0000 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruW94-00000006dLE-1ckR for openwrt-devel@lists.openwrt.org; Wed, 10 Apr 2024 11:29:39 +0000 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2d8a2cbe1baso22120161fa.0 for ; Wed, 10 Apr 2024 04:29:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712748569; x=1713353369; darn=lists.openwrt.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=a7rVSqxpQNbiMgQ5xV+r/0EfKCjMacY6PZuASKCA+OQ=; b=WkpSK3uzWwe7fxvQ7m342x9EfvZIhbDZqROcIzsBks7ekWfGdooLaNdo05FIWKrMWn xRc0p/1B4zaGDumXqfTqtAgo2M2i9iI28wOSar9EVL0wkCeqFXqe8plBHYGa0rBvF96P 9ViW3tFWf/1vk2AnIQSB8CLTzOBZQx/+YGe8xb++Bz/spd+3ByBZ6cNkW52YQlFRDDuI RC4EVr9uJQjT+hVxSralS516qEA6+y6zDBr6vn7VOiWB5iEPPYJfbPKdQxo8tMsoyNUm KGtjqo0zY6hUIHb7HmL6T8FxRa9mdsoaVEhddDJpkSIF0hsjGyR1a577gFwBzYaX/cPm XEVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712748569; x=1713353369; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=a7rVSqxpQNbiMgQ5xV+r/0EfKCjMacY6PZuASKCA+OQ=; b=Z2MwdBtwgKVBNRTXYqFw8dVbMGCOEYMfkQ3fhvP3gkbuenZZ4dJfaDQkbYTuqXKXFB 9liSbwhwG6y97mW1VpigPSg6p28gAz0Z55l4T7trnOuGXfs8ffVNzXbqbLzE0SCylixD HnPu9tL4tD8fpz7sontwBdmLj+mYuUfWX4GuNL5i4Ach6/Y5gzlQZhB+5kT9sYBwxXIh 1SYDLl/5BcU4Tcxlv/03U0/JK2N6obEbPfTITDQC9SqU7JHXDpk7OKH3O+VqTiiGNWzR G6tbFIgAraavxmPep7gHuPUDtyoOKdIU00AGuw5kGb9453rWiEw+muDsdq5pWzAr1aER ABGw== X-Gm-Message-State: AOJu0YyNrnMGbIiCGW9nR5h9GZWoH3h8ktt0SXX7TVw3dfQjrbcSLVfs oqumvcJNPHQNSaLV/5jWlHh+A1jE0pZdh5FGWb2LvUzFhOVygRavOdiOPtUD X-Google-Smtp-Source: AGHT+IEjqjMiWxe91P3qt0YUOATLVbcu6qQ1wMndxkBtgBIs2PPQyOYnfn8PO3emQPA5T63fjtAGpw== X-Received: by 2002:a2e:9911:0:b0:2d8:e159:23b6 with SMTP id v17-20020a2e9911000000b002d8e15923b6mr402435lji.16.1712748568870; Wed, 10 Apr 2024 04:29:28 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:aa1:d2f0:f6b3:db6:44c:eeef]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c139100b0041496734318sm1989166wmf.24.2024.04.10.04.29.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 04:29:28 -0700 (PDT) From: Jean Thomas X-Google-Original-From: Jean Thomas To: openwrt-devel@lists.openwrt.org Cc: jean.thomas@wifirst.fr Subject: [PATCH 3/5] uqmi: Add basic 5G NR support Date: Wed, 10 Apr 2024 13:29:20 +0200 Message-Id: <20240410112922.3945627-1-jean.thomas@wifirst.fr> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240410_042938_487890_4F0C4605 X-CRM114-Status: GOOD ( 18.81 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: * Add 5G NR to supported networks in DMS --get-capabilities. * Add 5G NR to supported mode in NAS --set-network-modes. * Add 5G NR signal information to NAS --get-signal-info. * Add 5G NR system infor [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:232 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [jeantho(at)gmail.com] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org * Add 5G NR to supported networks in DMS --get-capabilities. * Add 5G NR to supported mode in NAS --set-network-modes. * Add 5G NR signal information to NAS --get-signal-info. * Add 5G NR system information to NAS --get-system-info. * Add 5G NR to supported radios in NAS --get-tx-rx-info. * Add 5G NR cell information to NAS --get-cell-location-info. Signed-off-by: Jean Thomas --- commands-dms.c | 1 + commands-nas.c | 108 +++++++++++++++++++++++++++++++++++++++++++++++-- commands-nas.h | 4 +- 3 files changed, 107 insertions(+), 6 deletions(-) diff --git a/commands-dms.c b/commands-dms.c index 59648fb..b86fae2 100644 --- a/commands-dms.c +++ b/commands-dms.c @@ -49,6 +49,7 @@ static void cmd_dms_get_capabilities_cb(struct qmi_dev *qmi, struct qmi_request [QMI_DMS_RADIO_INTERFACE_GSM] = "gsm", [QMI_DMS_RADIO_INTERFACE_UMTS] = "umts", [QMI_DMS_RADIO_INTERFACE_LTE] = "lte", + [QMI_DMS_RADIO_INTERFACE_5GNR] = "5gnr", }; const char *service_cap[] = { [QMI_DMS_DATA_SERVICE_CAPABILITY_NONE] = "none", diff --git a/commands-nas.c b/commands-nas.c index 476cd61..d791fee 100644 --- a/commands-nas.c +++ b/commands-nas.c @@ -21,6 +21,10 @@ #include "qmi-message.h" +/* According to libqmi, a value of -32768 in 5G + * indicates that the modem is not connected. */ +#define _5GNR_NOT_CONNECTED_VALUE -32768 + static struct qmi_nas_get_tx_rx_info_request tx_rx_req; static struct qmi_nas_set_system_selection_preference_request sel_req; static struct { @@ -127,6 +131,7 @@ cmd_nas_set_network_modes_prepare(struct qmi_dev *qmi, struct qmi_request *req, { "gsm", QMI_NAS_RAT_MODE_PREFERENCE_GSM }, { "umts", QMI_NAS_RAT_MODE_PREFERENCE_UMTS }, { "lte", QMI_NAS_RAT_MODE_PREFERENCE_LTE }, + { "5gnr", QMI_NAS_RAT_MODE_PREFERENCE_5GNR }, }; QmiNasRatModePreference val = 0; char *word; @@ -262,10 +267,26 @@ static void cmd_nas_get_signal_info_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg) { struct qmi_nas_get_signal_info_response res; - void *c; + void *c, *a; + bool is_5gnr_connected = false; + bool is_5gnr_endc = false; qmi_parse_nas_get_signal_info_response(msg, &res); + /* If 5G NR EN-DC (dual connectivity) is enabled, the mobile device has two connections, + * one with the LTE base station, and one with the NR base station. + * Therefore an array of signals has to be reported in this case. */ + is_5gnr_connected = ((res.set._5g_signal_strength && + ((res.data._5g_signal_strength.rsrp != _5GNR_NOT_CONNECTED_VALUE) || + (res.data._5g_signal_strength.snr != _5GNR_NOT_CONNECTED_VALUE))) || + (res.set._5g_signal_strength_extended && + (res.data._5g_signal_strength_extended != _5GNR_NOT_CONNECTED_VALUE))); + is_5gnr_endc = (res.set.lte_signal_strength && is_5gnr_connected); + + if (is_5gnr_endc) { + a = blobmsg_open_array(&status, NULL); + } + c = blobmsg_open_table(&status, NULL); if (res.set.cdma_signal_strength) { blobmsg_add_string(&status, "type", "cdma"); @@ -304,7 +325,30 @@ cmd_nas_get_signal_info_cb(struct qmi_dev *qmi, struct qmi_request *req, struct blobmsg_add_u32(&status, "signal", (int32_t) res.data.tdma_signal_strength); } + if (is_5gnr_connected) { + if (is_5gnr_endc) { + blobmsg_close_table(&status, c); + c = blobmsg_open_table(&status, NULL); + } + blobmsg_add_string(&status, "type", "5gnr"); + if (res.set._5g_signal_strength) { + if (res.data._5g_signal_strength.rsrp != _5GNR_NOT_CONNECTED_VALUE) + blobmsg_add_u32(&status, "rsrp", (int32_t) res.data._5g_signal_strength.rsrp); + if (res.data._5g_signal_strength.snr != _5GNR_NOT_CONNECTED_VALUE) + blobmsg_add_double(&status, "snr", (double) res.data._5g_signal_strength.snr*0.1); + } + + if (res.set._5g_signal_strength_extended && + (res.data._5g_signal_strength_extended != _5GNR_NOT_CONNECTED_VALUE)) { + blobmsg_add_u32(&status, "rsrq", (int32_t) res.data._5g_signal_strength_extended); + } + } + blobmsg_close_table(&status, c); + + if (is_5gnr_endc) { + blobmsg_close_array(&status, a); + } } static void @@ -498,6 +542,37 @@ cmd_nas_get_system_info_cb(struct qmi_dev *qmi, struct qmi_request *req, struct blobmsg_close_table(&status, c); } + + if (res.set.nr5g_service_status_info) { + c = blobmsg_open_table(&status, "5gnr"); + print_system_info(res.data.nr5g_service_status_info.service_status, + res.data.nr5g_service_status_info.true_service_status, + res.data.nr5g_service_status_info.preferred_data_path, + res.set.nr5g_system_info, + res.data.nr5g_system_info.domain_valid, + res.data.nr5g_system_info.domain, + res.data.nr5g_system_info.service_capability_valid, + res.data.nr5g_system_info.service_capability, + res.data.nr5g_system_info.roaming_status_valid, + res.data.nr5g_system_info.roaming_status, + res.data.nr5g_system_info.forbidden_valid, + res.data.nr5g_system_info.forbidden, + res.data.nr5g_system_info.network_id_valid, + res.data.nr5g_system_info.mcc, + res.data.nr5g_system_info.mnc, + res.data.nr5g_system_info.lac_valid, + res.data.nr5g_system_info.lac); + if (res.set.nr5g_system_info && res.data.nr5g_system_info.tac_valid) + blobmsg_add_u32(&status, "tracking_area_code", + res.data.nr5g_system_info.tac); + if (res.set.nr5g_system_info && res.data.nr5g_system_info.cid_valid) { + blobmsg_add_u32(&status, "enodeb_id",res.data.nr5g_system_info.cid/256); + blobmsg_add_u32(&status, "cell_id",res.data.nr5g_system_info.cid%256); + } + + blobmsg_close_table(&status, c); + } + blobmsg_close_table(&status, t); } @@ -594,11 +669,14 @@ print_chain_info(int8_t radio, bool tuned, int32_t rssi, int32_t ecio, int32_t r { blobmsg_add_u8(&status, "tuned", tuned); blobmsg_add_double(&status, "rssi", (double) rssi*0.1); - if (radio == QMI_NAS_RADIO_INTERFACE_LTE) { + if (radio == QMI_NAS_RADIO_INTERFACE_5GNR) { + blobmsg_add_double(&status, "rsrp", (double) rsrp*-0.1); + } + else if (radio == QMI_NAS_RADIO_INTERFACE_LTE) { blobmsg_add_double(&status, "rsrq", (double) ecio*-0.1); blobmsg_add_double(&status, "rsrp", (double) rsrp*-0.1); } - if (radio == QMI_NAS_RADIO_INTERFACE_UMTS) { + else if (radio == QMI_NAS_RADIO_INTERFACE_UMTS) { blobmsg_add_double(&status, "ecio", (double) ecio*-0.1); blobmsg_add_double(&status, "rscp", (double) rscp*-0.1); } @@ -675,7 +753,9 @@ cmd_nas_get_tx_rx_info_prepare(struct qmi_dev *qmi, struct qmi_request *req, str { int radio = 0; - if (!strcmp(arg, "lte")) + if (!strcmp(arg, "5gnr")) + radio = QMI_NAS_RADIO_INTERFACE_5GNR; + else if (!strcmp(arg, "lte")) radio = QMI_NAS_RADIO_INTERFACE_LTE; else if (!strcmp(arg, "umts")) radio = QMI_NAS_RADIO_INTERFACE_UMTS; @@ -896,6 +976,25 @@ cmd_nas_get_cell_location_info_cb(struct qmi_dev *qmi, struct qmi_request *req, if (res.data.umts_info_neighboring_lte.frequency_n > 0) blobmsg_close_table(&status, c); } + if (res.set.nr5g_cell_information) { + c = blobmsg_open_table(&status, "nr5g_cell_information"); + blobmsg_add_u32(&status, "enodeb_id", + res.data.nr5g_cell_information.global_cell_id/256); + blobmsg_add_u32(&status, "cell_id", + res.data.nr5g_cell_information.global_cell_id%256); + blobmsg_add_u32(&status, "physical_cell_id", + res.data.nr5g_cell_information.physical_cell_id); + blobmsg_add_double(&status, "rsrq", ((double)res.data.nr5g_cell_information.rsrq)/10); + blobmsg_add_double(&status, "rsrp", ((double)res.data.nr5g_cell_information.rsrp)/10); + blobmsg_add_double(&status, "snr", ((double)res.data.nr5g_cell_information.snr)/10); + blobmsg_close_table(&status, c); + } + if (res.set.nr5g_arfcn) { + c = blobmsg_open_table(&status, "nr5g_arfcn"); + blobmsg_add_u32(&status, "arfcn", + res.data.nr5g_arfcn); + blobmsg_close_table(&status, c); + } blobmsg_close_table(&status, t); } @@ -1011,6 +1110,7 @@ cmd_nas_network_scan_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi [QMI_NAS_RADIO_INTERFACE_UMTS] = "umts", [QMI_NAS_RADIO_INTERFACE_LTE] = "lte", [QMI_NAS_RADIO_INTERFACE_TD_SCDMA] = "td-scdma", + [QMI_NAS_RADIO_INTERFACE_5GNR] = "5gnr", }; void *t, *c, *info, *stat; int i, j; diff --git a/commands-nas.h b/commands-nas.h index 2426caa..6b29d33 100644 --- a/commands-nas.h +++ b/commands-nas.h @@ -39,7 +39,7 @@ #define nas_helptext \ " --set-network-modes : Set usable network modes (Syntax: [,,...])\n" \ - " Available modes: all, lte, umts, gsm, cdma, td-scdma\n" \ + " Available modes: all, lte, umts, gsm, cdma, td-scdma, 5gnr\n" \ " --set-network-preference : Set preferred network mode to \n" \ " Available modes: auto, gsm, wcdma\n" \ " --set-network-roaming : Set roaming preference:\n" \ @@ -55,5 +55,5 @@ " --get-system-info: Get system info\n" \ " --get-lte-cphy-ca-info: Get LTE Cphy CA Info\n" \ " --get-cell-location-info: Get Cell Location Info\n" \ - " --get-tx-rx-info : Get TX/RX Info (gsm, umts, lte)\n" \ + " --get-tx-rx-info : Get TX/RX Info (gsm, umts, lte, 5gnr)\n" \ From patchwork Wed Apr 10 11:29:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Thomas X-Patchwork-Id: 1921933 X-Patchwork-Delegate: lynxis@fe80.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=V9iWLtEm; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=RrGbO8ty; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VF0zf10tXz1yZ8 for ; Wed, 10 Apr 2024 21:32:11 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=D/W0gd2zyQgdFPcRAvJPdRSmdryPegE3yRpyevTAGHc=; b=V9iWLtEm2REI8x VGbc6MsmXFRuaPLXSnJ3wPBTT3dKBLF8KnGvXi3Y7yQ0vVf4UrWzpHgEDj+ekUchmvXITQQvKAWA0 RbwIYKLoMOJ/jRSOSFvaJFAWNuqowsZYN858Aq4sFGCljQTlpA3E5H8iv3YKpLvdrvf4LeAmTIMlz oDGJ8E+z6K13mbjhjze//1PQslElzKOQnuW575oihLBcSECr2gOEFJIqlUW0SoP1IQTzc8tXX5Uor lOrA3v2tkINifGX4nosmBUqty04v9Kqkl07ldvqSZG6BZbRTHquqx/wa4qb5LDa8JVcSzFwF2VjR5 P3S8hDm8pBzC8R3xruYA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruW94-00000006dOZ-1FLb; Wed, 10 Apr 2024 11:29:38 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruW8z-00000006dM3-17sC for openwrt-devel@lists.openwrt.org; Wed, 10 Apr 2024 11:29:36 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4166d58a71eso21248325e9.1 for ; Wed, 10 Apr 2024 04:29:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712748571; x=1713353371; darn=lists.openwrt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DZGlgKK625GEnxaKRmVmpFjKg9yNgb2y9KsTLslahyQ=; b=RrGbO8tyGVq4oN0uxMotb5OMHHhklGKjS5+pLBh8a5mP6UDrGlhWVPsqoRZmGQYsJT YS0OtH7jQMRDObvwZHOMeSE5khmBi5T8PlPTkvJLVwGrstL/NbGgKsqPwMno0U9ZK2/9 JMyV56PF9fseIsPQ6GXgTF0Sn//q2XQZmySJuZ4QCgovnQYpARyiSv0pJWpJy/sMOPSK larU1V7hV5SljtEpi45XI0vIKKDqdQmnuMI4W58nh4QcmlT/IsHb9YqAROWsfJwaKVU1 LKkqVyAgayWXaANImks1/y9XdwCulqqQNpQkRK0vly+BFqeaQ1CN5IEm2gid/q9pVBQi Ug9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712748571; x=1713353371; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DZGlgKK625GEnxaKRmVmpFjKg9yNgb2y9KsTLslahyQ=; b=MKwCF//mZ+dR2QyvpZC6dXKKuMjb/bfBkmEeNz7pBThpqPHwsPFI82GE3E0HymCimh 2+70pLOSzCMKvBC+S/upc2LwldUBqbxTKMAu7HoOX4jAnoS6u1BIx5swLgpYXpWAWSJM Oyo3K4hKL7IMZ5QTnDKvbJUqWNWi+JFuCA7SaW8G2NNfTQWtJA0WobuaeYSYMYvWck11 QM7T7P/be6qEWbx62jDOlkGg+Mt2GcEzMJjGvggTNKdiuhh7CqQOpJ+ChQDdTqlIRiQr 8FkcOevs9Mkhc3Cx9z8gYpNgZ8zcowIDe1GE9uCURp0Xwhg1Vl51vCLsAdjWUvgfNUzL pdfA== X-Gm-Message-State: AOJu0YwJVH2ZDkEdqjK1Bgnzc/mQyAx0paLsxPtofUUSuGKSnp3zUthW nRSIhUpcEGeUyE7OM5K+LReDLSUvan1lqNqx5+CWDCP9GQJmVE4s8nsPzPM7 X-Google-Smtp-Source: AGHT+IGbyVjF70y7CWSMAm7kXbelNKOrYJM0FkAycak4F3HSpu0VTwGpCeFGKs5UXUsyeVCUDtE1lg== X-Received: by 2002:a7b:c412:0:b0:416:3762:cea0 with SMTP id k18-20020a7bc412000000b004163762cea0mr2020864wmi.13.1712748571321; Wed, 10 Apr 2024 04:29:31 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:aa1:d2f0:f6b3:db6:44c:eeef]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c139100b0041496734318sm1989166wmf.24.2024.04.10.04.29.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 04:29:30 -0700 (PDT) From: Jean Thomas X-Google-Original-From: Jean Thomas To: openwrt-devel@lists.openwrt.org Cc: jean.thomas@wifirst.fr Subject: [PATCH 4/5] uqmi: create function to print radio interface string Date: Wed, 10 Apr 2024 13:29:21 +0200 Message-Id: <20240410112922.3945627-2-jean.thomas@wifirst.fr> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240410112922.3945627-1-jean.thomas@wifirst.fr> References: <20240410112922.3945627-1-jean.thomas@wifirst.fr> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240410_042933_325879_4E3BA657 X-CRM114-Status: GOOD ( 10.97 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Signed-off-by: Jean Thomas --- commands-nas.c | 46 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/commands-nas.c b/commands-nas.c index d791fee..d06934f 100644 --- a/commands-nas.c +++ b/commands-nas.c @@ -97,6 +97,33 @@ print_earfcn_info(uint32_t earfcn) } } Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:330 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [jeantho(at)gmail.com] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Signed-off-by: Jean Thomas --- commands-nas.c | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/commands-nas.c b/commands-nas.c index d791fee..d06934f 100644 --- a/commands-nas.c +++ b/commands-nas.c @@ -97,6 +97,33 @@ print_earfcn_info(uint32_t earfcn) } } +static char * +print_radio_interface(int8_t radio_interface) +{ + switch (radio_interface) { + case QMI_NAS_RADIO_INTERFACE_NONE: + return "none"; + case QMI_NAS_RADIO_INTERFACE_CDMA_1X: + return "cdma-1x"; + case QMI_NAS_RADIO_INTERFACE_CDMA_1XEVDO: + return "cdma-1x_evdo"; + case QMI_NAS_RADIO_INTERFACE_AMPS: + return "amps"; + case QMI_NAS_RADIO_INTERFACE_GSM: + return "gsm"; + case QMI_NAS_RADIO_INTERFACE_UMTS: + return "umts"; + case QMI_NAS_RADIO_INTERFACE_LTE: + return "lte"; + case QMI_NAS_RADIO_INTERFACE_TD_SCDMA: + return "td-scdma"; + case QMI_NAS_RADIO_INTERFACE_5GNR: + return "5gnr"; + default: + return "unknown"; + } +} + #define cmd_nas_do_set_system_selection_cb no_cb static enum qmi_cmd_result cmd_nas_do_set_system_selection_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg) @@ -1101,17 +1128,6 @@ cmd_nas_network_scan_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi "preferred", "not_preferred", }; - const char *radio[] = { - [QMI_NAS_RADIO_INTERFACE_NONE] = "none", - [QMI_NAS_RADIO_INTERFACE_CDMA_1X] = "cdma-1x", - [QMI_NAS_RADIO_INTERFACE_CDMA_1XEVDO] = "cdma-1x_evdo", - [QMI_NAS_RADIO_INTERFACE_AMPS] = "amps", - [QMI_NAS_RADIO_INTERFACE_GSM] = "gsm", - [QMI_NAS_RADIO_INTERFACE_UMTS] = "umts", - [QMI_NAS_RADIO_INTERFACE_LTE] = "lte", - [QMI_NAS_RADIO_INTERFACE_TD_SCDMA] = "td-scdma", - [QMI_NAS_RADIO_INTERFACE_5GNR] = "5gnr", - }; void *t, *c, *info, *stat; int i, j; @@ -1140,16 +1156,12 @@ cmd_nas_network_scan_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi c = blobmsg_open_array(&status, "radio_access_technology"); for (i = 0; i < res.data.radio_access_technology_n; i++) { - const char *r = "unknown"; - int r_i = res.data.radio_access_technology[i].radio_interface; + int8_t r_i = res.data.radio_access_technology[i].radio_interface; info = blobmsg_open_table(&status, NULL); blobmsg_add_u32(&status, "mcc", res.data.radio_access_technology[i].mcc); blobmsg_add_u32(&status, "mnc", res.data.radio_access_technology[i].mnc); - if (r_i >= 0 && r_i < ARRAY_SIZE(radio)) - r = radio[r_i]; - - blobmsg_add_string(&status, "radio", r); + blobmsg_add_string(&status, "radio", print_radio_interface(r_i)); blobmsg_close_table(&status, info); } blobmsg_close_array(&status, c); From patchwork Wed Apr 10 11:29:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Thomas X-Patchwork-Id: 1921934 X-Patchwork-Delegate: lynxis@fe80.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=trEc/vFv; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=F8sI9HxL; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VF0zf0pvRz1yYw for ; Wed, 10 Apr 2024 21:32:13 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vq+aK80ewPEGQth58VYIeg1E3nCOUPw4LPPXqydqK1c=; b=trEc/vFvd0RBtS CHKC3fNsmOjGk2Yc3HlHY5Axe6Xc0FhgRmNndlLh6QAKbfaoD1C+Kk5gTHO69X1yK7q0hk4aH+9dJ spKZAG0PkgC2GhG5bTTzAhUElgqoERn1PmnxiSZssZvOOQ0GUTd3QDLhlYR2oLPFFHiK6aA0GKF0m Tck9GQKCMwG2EiqE1F0uSMf36aLQuEmCydcBgq9CFI8QZZAT0lMprQdpQDU5p6Gq8VKWDcb2K7wx6 NkL4+LpGP+bgwH7jo9znk2fF8UWC6ISnl7gEC08GGjpD1xOZxuMnF10gTVZl8UHxJWuWaRruFVXoS Q31w4/RFxkYUhi2LfQ0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruW98-00000006dQi-3oBg; Wed, 10 Apr 2024 11:29:42 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruW94-00000006dOY-3hhx for openwrt-devel@lists.openwrt.org; Wed, 10 Apr 2024 11:29:40 +0000 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-415523d9824so68297735e9.3 for ; Wed, 10 Apr 2024 04:29:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712748577; x=1713353377; darn=lists.openwrt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zCnEGuNsB4/ztz0sRj3EGsmM/BrzLkLlcsgOigrfSqo=; b=F8sI9HxLEe/p2CQ+zzvLWt0vWw1PBjg73Y0BohGlF4R02Li2WIW4jMHfMAN5YRVHbq X7iXarmNP7beUoRGpJN2wVM2zOXnfmeQg+j3a1GqWiQerHQpustnh87zv+Y4Y3cRVlY2 1OvYZeVMOwfu6o5NvdaGa4gb02eb4LAvXVIS5fxvnN9JCMkySHIKvGzQRNQxo6JIrFeg w38hbPUEJcttu4hGQ3Ig5TcGYsYIcDy5emuXbuG2099YlBhV9en/mNieEAZP/VSqcTgw lCTfiwLekIFIzMg/6BUNvHj36pD6d6SuuIJfw4IBNVtRGljxv5RYnIyKRockJHbJftWl PWTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712748577; x=1713353377; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zCnEGuNsB4/ztz0sRj3EGsmM/BrzLkLlcsgOigrfSqo=; b=rOj0qbQMr0Qj0acLI1I1DqqsSbwmcuRhBCHQ8/YxLwn/Ie4nyF6B92nFe5EGPTP0U4 STlQ8aYP6csCuVJXVrNNvSI7SlwaKb4vAXhi3+6CQMmFeY0z5vJH+YzvITVXozjZcz2v aINes/9jUKqRerq6SxSafSEbsUrgjwkQ2Q5UlnCgxbwEC5ibG0wYHKupfiG8xSRN66J3 WqIbzkg6dnKUkMVvEhjjYIYKfWdGjIWuIPmrJ2SuFkM3ZJ3xfv0JSIlveXU4M91x1907 /7LSipFeiFd6ASP69ie37JdxP+jCHwPXz696u3m6h1E0IGNlsHBgFoyKsOHdPzE76or+ kwLg== X-Gm-Message-State: AOJu0Yw+6nDv8sMg1jMjRkBDB8MqE06ITSwD3U2PTs64X8icy9zs/jwC ZsNokuzkRlh3nB43pE2EiZ5ZFnzDjEZLTM5hQrjUHVBb+Wtyi1MEV9s0xN1B X-Google-Smtp-Source: AGHT+IEY5Bg5aS2Jx8LXnPKNxey88Jt5NOOCugiH1UJce89jPEmsKdvWk20spsca60MoJavRsD0n/Q== X-Received: by 2002:a05:600c:19cf:b0:416:a958:13d9 with SMTP id u15-20020a05600c19cf00b00416a95813d9mr2396837wmq.1.1712748577258; Wed, 10 Apr 2024 04:29:37 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:aa1:d2f0:f6b3:db6:44c:eeef]) by smtp.gmail.com with ESMTPSA id u17-20020a05600c139100b0041496734318sm1989166wmf.24.2024.04.10.04.29.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 04:29:37 -0700 (PDT) From: Jean Thomas X-Google-Original-From: Jean Thomas To: openwrt-devel@lists.openwrt.org Cc: jean.thomas@wifirst.fr Subject: [PATCH 5/5] uqmi: print radio interfaces in serving system command Date: Wed, 10 Apr 2024 13:29:22 +0200 Message-Id: <20240410112922.3945627-3-jean.thomas@wifirst.fr> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240410112922.3945627-1-jean.thomas@wifirst.fr> References: <20240410112922.3945627-1-jean.thomas@wifirst.fr> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240410_042938_974491_CB17C539 X-CRM114-Status: GOOD ( 10.55 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Add a "radio_interface" array to the NAS --get-serving-system command. Signed-off-by: Jean Thomas --- commands-nas.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/commands-nas.c b/commands-nas.c index d06934f..8865fc4 100644 --- a/commands-nas.c +++ b/commands-nas.c @@ -1050,7 +1050,7 @@ cmd_nas_get_serving_system_cb(struct qmi_dev *qmi, struct qmi [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:329 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [jeantho(at)gmail.com] X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Add a "radio_interface" array to the NAS --get-serving-system command. Signed-off-by: Jean Thomas --- commands-nas.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/commands-nas.c b/commands-nas.c index d06934f..8865fc4 100644 --- a/commands-nas.c +++ b/commands-nas.c @@ -1050,7 +1050,7 @@ cmd_nas_get_serving_system_cb(struct qmi_dev *qmi, struct qmi_request *req, stru [QMI_NAS_REGISTRATION_STATE_REGISTRATION_DENIED] = "registering_denied", [QMI_NAS_REGISTRATION_STATE_UNKNOWN] = "unknown", }; - void *c; + void *c, *a; qmi_parse_nas_get_serving_system_response(msg, &res); @@ -1062,6 +1062,14 @@ cmd_nas_get_serving_system_cb(struct qmi_dev *qmi, struct qmi_request *req, stru state = QMI_NAS_REGISTRATION_STATE_UNKNOWN; blobmsg_add_string(&status, "registration", reg_states[state]); + + a = blobmsg_open_array(&status, "radio_interface"); + for (int i = 0; i < res.data.serving_system.radio_interfaces_n; i++) { + int8_t r_i = res.data.serving_system.radio_interfaces[i]; + + blobmsg_add_string(&status, "radio", print_radio_interface(r_i)); + } + blobmsg_close_array(&status, a); } if (res.set.current_plmn) { blobmsg_add_u32(&status, "plmn_mcc", res.data.current_plmn.mcc);