[From nobody Thu Jun 25 05:55:21 2020
Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144])
 by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux))
 id 1i2KQc-0003u5-Aq
 for openwrt-devel@lists.openwrt.org; Mon, 26 Aug 2019 19:13:24 +0000
Received: by mail-lf1-x144.google.com with SMTP id v16so13106957lfg.11
 for &lt;openwrt-devel@lists.openwrt.org&gt;; Mon, 26 Aug 2019 12:13:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=olmari.fi; s=google;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
 bh=dTb6adBMV4NZA6rIAfqky+D6Y55Uu1jaMcgAGO/r/XM=;
 b=V2z/zZfOWJm+Iv5Yn5dq7st7lQeiGQrFvZKptzqg3xTEMCX+ApDUcWizwKFsdIep13
 MEpowLR0EBhK3Ig6Kq2MUUc8FxbSANS8Y5GpmQOsKG08xUtNBAKCvQITJctdbWzgIB9f
 4uGVu4wJpxUWcy3kVvrKtfnDvk5Ph6HMK+rPGJKoAQsrY2aqrrWKV1TmIFFgATUY8wg/
 ZFsKzI5xsef2KXDqWfq/7neRNcKcu5BOmYpWUgtDQKO0ppw6SX/vdbPiLPstzjrLMhNB
 7KnuPGKvvtS8uUijRNNI70QwJuqgbVr2l4sIaXkow/b8eMpaFLj61GDSPBW1ds9sI0PT
 XMxg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to;
 bh=dTb6adBMV4NZA6rIAfqky+D6Y55Uu1jaMcgAGO/r/XM=;
 b=ZeSkzmRv87mFGu4nnYJ9V6K7d5+zUE843a9ozGkvevNNA1LLFBpF7U+1ffJcAi5jO9
 0UWOy30afGOEMvoWqHiqdeC46y6Aa7kKbrxceWLhEsxTTf6vxCLvlrtap7fx4qIs8M0w
 xfJTm3qm2D6/45ME1/6C1cQpN/4+bT9+YKFHiPS/fjuYoyApRrqgzKtsvMwGyis1KT8L
 4HueiEbcFzjQQJvwX0Pn9cpGa3tEApL7KR0Ol244PTbndzM2HWVVxIAKD5CVuDvv5k2J
 GJ2mBT/YYOsZ6QBFmjrToIYhfiuRQILROatl3T6JJV9iVc+Bt4V3REPE7H+XhhXASZTt
 zSMg==
X-Gm-Message-State: APjAAAX0ItecMNKWdaftacQbUmiZFQA/69Hzt46h+p0bQv/Frsr2IfLe
 r4gsazo9srlt5z99E8E0pBtaS6w1wGt3P3hQPxW57x8qA5CGeA==
X-Google-Smtp-Source: APXvYqyi5Q+aglnvDgU6DKxRRwRQ6MljSsdJ3exscwdqz7LzGBl3F2kI/YI6z22mcFPX0oxm1Ya+1rVW9jHmIQh3fTM=
X-Received: by 2002:a19:4347:: with SMTP id m7mr5079703lfj.146.1566846789027; 
 Mon, 26 Aug 2019 12:13:09 -0700 (PDT)
MIME-Version: 1.0
References: &lt;20190704113537.22078-1-ms@dev.tdt.de&gt;
 &lt;4454fadb211809fbcceab6dc465a1b7a@dev.tdt.de&gt;
In-Reply-To: &lt;4454fadb211809fbcceab6dc465a1b7a@dev.tdt.de&gt;
From: Sami Olmari &lt;sami@olmari.fi&gt;
Date: Mon, 26 Aug 2019 22:12:58 +0300
Message-ID: &lt;CAENOc+xxGFFSh+K-EC1o5Kog8LsPJDGiHG26b0d-YC0ed079XQ@mail.gmail.com&gt;
Subject: Re: [OpenWrt-Devel] [PATCH uqmi] nas: add --get-plmn
To: openwrt-devel &lt;openwrt-devel@lists.openwrt.org&gt;
Content-Type: text/plain; charset=&quot;UTF-8&quot;
X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 
X-CRM114-CacheID: sfid-20190826_121322_865148_10572085 
X-CRM114-Status: GOOD (  17.26  )
X-Spam-Score: -0.2 (/)
X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary:
 Content analysis details:   (-0.2 points)
 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:144 listed in]
 [list.dnswl.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
 0.1 DKIM_SIGNED            Message has a DKIM or DK signature, not necessarily
 valid
 -0.1 DKIM_VALID_AU          Message has a valid DKIM or DK signature from
 author's domain
 -0.1 DKIM_VALID_EF          Message has a valid DKIM or DK signature from
 envelope-from domain

I think the ideology behind proto handler there is to &quot;do whatever
told&quot; despite of what the state is currently,
maybe there is a reason for such behaviour (searches some stuff from
network etc).

-- 
 Sami Olmari

On Mon, Aug 26, 2019 at 1:48 PM Martin Schiller &lt;ms@dev.tdt.de&gt; wrote:
&gt;
&gt; Can somebody please take a look at this patch.
&gt;
&gt; It's really necessary to fix the problem in the qmi proto handler.
&gt;
&gt; Thanks,
&gt; Martin
&gt;
&gt; On 2019-07-04 13:35, Martin Schiller wrote:
&gt; &gt; This command is needed in the qmi proto handler to check if the plmn
&gt; &gt; is already set to 'auto'.
&gt; &gt;
&gt; &gt; The reason for this is, that setting the plmn to 'auto' will implicitly
&gt; &gt; lead to a (delayed) network re-registration, which could further lead
&gt; &gt; to some timing related issues in the qmi proto handler.
&gt; &gt;
&gt; &gt; Signed-off-by: Martin Schiller &lt;ms@dev.tdt.de&gt;
&gt; &gt; ---
&gt; &gt;  commands-nas.c | 31 +++++++++++++++++++++++++++++++
&gt; &gt;  commands-nas.h |  2 ++
&gt; &gt;  2 files changed, 33 insertions(+)
&gt; &gt;
&gt; &gt; diff --git a/commands-nas.c b/commands-nas.c
&gt; &gt; index 5874bfb..1f7445d 100644
&gt; &gt; --- a/commands-nas.c
&gt; &gt; +++ b/commands-nas.c
&gt; &gt; @@ -293,6 +293,37 @@ cmd_nas_get_serving_system_prepare(struct qmi_dev
&gt; &gt; *qmi, struct qmi_request *req,
&gt; &gt;  }
&gt; &gt;
&gt; &gt;  static void
&gt; &gt; +cmd_nas_get_plmn_cb(struct qmi_dev *qmi, struct qmi_request *req,
&gt; &gt; struct qmi_msg *msg)
&gt; &gt; +{
&gt; &gt; +     struct qmi_nas_get_system_selection_preference_response res;
&gt; &gt; +     static const char *modes[] = {
&gt; &gt; +             [QMI_NAS_NETWORK_SELECTION_PREFERENCE_AUTOMATIC] = &quot;automatic&quot;,
&gt; &gt; +             [QMI_NAS_NETWORK_SELECTION_PREFERENCE_MANUAL] = &quot;manual&quot;,
&gt; &gt; +     };
&gt; &gt; +     void *c;
&gt; &gt; +
&gt; &gt; +     qmi_parse_nas_get_system_selection_preference_response(msg, &amp;res);
&gt; &gt; +
&gt; &gt; +     c = blobmsg_open_table(&amp;status, NULL);
&gt; &gt; +     if (res.set.network_selection_preference) {
&gt; &gt; +             blobmsg_add_string(&amp;status, &quot;mode&quot;,
&gt; &gt; modes[res.data.network_selection_preference]);
&gt; &gt; +     }
&gt; &gt; +     if (res.set.manual_network_selection) {
&gt; &gt; +             blobmsg_add_u32(&amp;status, &quot;mcc&quot;,
&gt; &gt; res.data.manual_network_selection.mcc);
&gt; &gt; +             blobmsg_add_u32(&amp;status, &quot;mnc&quot;,
&gt; &gt; res.data.manual_network_selection.mnc);
&gt; &gt; +     }
&gt; &gt; +
&gt; &gt; +     blobmsg_close_table(&amp;status, c);
&gt; &gt; +}
&gt; &gt; +
&gt; &gt; +static enum qmi_cmd_result
&gt; &gt; +cmd_nas_get_plmn_prepare(struct qmi_dev *qmi, struct qmi_request
&gt; &gt; *req, struct qmi_msg *msg, char *arg)
&gt; &gt; +{
&gt; &gt; +     qmi_set_nas_get_system_selection_preference_request(msg);
&gt; &gt; +     return QMI_CMD_REQUEST;
&gt; &gt; +}
&gt; &gt; +
&gt; &gt; +static void
&gt; &gt;  cmd_nas_network_scan_cb(struct qmi_dev *qmi, struct qmi_request *req,
&gt; &gt; struct qmi_msg *msg)
&gt; &gt;  {
&gt; &gt;       static struct qmi_nas_network_scan_response res;
&gt; &gt; diff --git a/commands-nas.h b/commands-nas.h
&gt; &gt; index 9ebfa00..4b175f9 100644
&gt; &gt; --- a/commands-nas.h
&gt; &gt; +++ b/commands-nas.h
&gt; &gt; @@ -24,6 +24,7 @@
&gt; &gt;       __uqmi_command(nas_set_network_modes, set-network-modes, required,
&gt; &gt; CMD_TYPE_OPTION), \
&gt; &gt;       __uqmi_command(nas_initiate_network_register, network-register, no,
&gt; &gt; QMI_SERVICE_NAS), \
&gt; &gt;       __uqmi_command(nas_set_plmn, set-plmn, no, QMI_SERVICE_NAS), \
&gt; &gt; +     __uqmi_command(nas_get_plmn, get-plmn, no, QMI_SERVICE_NAS), \
&gt; &gt;       __uqmi_command(nas_set_mcc, mcc, required, CMD_TYPE_OPTION), \
&gt; &gt;       __uqmi_command(nas_set_mnc, mnc, required, CMD_TYPE_OPTION), \
&gt; &gt;       __uqmi_command(nas_network_scan, network-scan, no, QMI_SERVICE_NAS),
&gt; &gt; \
&gt; &gt; @@ -44,6 +45,7 @@
&gt; &gt;               &quot;  --set-plmn:                       Register at specified
&gt; &gt; network\n&quot; \
&gt; &gt;               &quot;    --mcc &lt;mcc&gt;:                    Mobile Country Code (0 -
&gt; &gt; auto)\n&quot; \
&gt; &gt;               &quot;    --mnc &lt;mnc&gt;:                    Mobile Network Code\n&quot; \
&gt; &gt; +             &quot;  --get-plmn:                       Get preferred network
&gt; &gt; selection info\n&quot; \
&gt; &gt;               &quot;  --get-signal-info:                Get signal strength info\n&quot; \
&gt; &gt;               &quot;  --get-serving-system:             Get serving system info\n&quot; \
&gt;
&gt;
&gt; _______________________________________________
&gt; openwrt-devel mailing list
&gt; openwrt-devel@lists.openwrt.org
&gt; https://lists.openwrt.org/mailman/listinfo/openwrt-devel

]