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);