wds: implement selection of LTE attach PDNs
authorDavid Bauer <[email protected]>
Fri, 14 Feb 2025 10:49:14 +0000 (11:49 +0100)
committerDavid Bauer <[email protected]>
Wed, 9 Jul 2025 12:52:45 +0000 (14:52 +0200)
Signed-off-by: David Bauer <[email protected]>
uqmi/commands-wds.c
uqmi/commands-wds.h

index a5bfabae0f616a1248572f3a3b56cec74d1737e0..ffa3883ce78cd322136f90ffc34be69620924502 100644 (file)
@@ -700,3 +700,40 @@ cmd_wds_delete_profile_prepare(struct qmi_dev *qmi, struct qmi_request *req,
 
        return QMI_CMD_REQUEST;
 }
+
+#define cmd_wds_set_lte_attach_pdn_cb no_cb
+
+static enum qmi_cmd_result
+cmd_wds_set_lte_attach_pdn_prepare(struct qmi_dev *qmi, struct qmi_request *req,
+                                  struct qmi_msg *msg, char *arg)
+{
+       uint16_t list[8] = {0};
+
+       char *s = arg;
+       int i = 0;
+
+       while (s) {
+               if (i >= 8) {
+                       fprintf(stderr, "Only 8 attach PDN supported\n");
+                       return QMI_CMD_EXIT;
+               }
+
+               list[i] = strtoul(s, &s, 10);
+               i++;
+               if (*s == ',') {
+                       s++;
+               } else {
+                       fprintf(stderr, "Invalid argument\n");
+                       return QMI_CMD_EXIT;
+               }
+       }
+
+
+       struct qmi_wds_set_lte_attach_pdn_list_request lte_attach_pdn = {
+               QMI_INIT_ARRAY(list, list, i),
+               QMI_INIT(action, QMI_WDS_ATTACH_PDN_LIST_ACTION_DETACH_OR_PDN_DISCONNECT)
+       };
+
+       qmi_set_wds_set_lte_attach_pdn_list_request(msg, &lte_attach_pdn);
+       return QMI_CMD_REQUEST;
+}
index 882cf70f0ca75178aff6d78263c227fcc8fbcfe5..dc8415ee74c69485bdfcb31113664127ee39a57d 100644 (file)
@@ -44,7 +44,8 @@
        __uqmi_command(wds_get_current_settings, get-current-settings, no, QMI_SERVICE_WDS), \
        __uqmi_command(wds_bind_mux, bind-mux, required, QMI_SERVICE_WDS), \
        __uqmi_command(wds_ep_type, endpoint-type, required, CMD_TYPE_OPTION), \
-       __uqmi_command(wds_ep_iface, endpoint-iface, required, CMD_TYPE_OPTION) \
+       __uqmi_command(wds_ep_iface, endpoint-iface, required, CMD_TYPE_OPTION), \
+       __uqmi_command(wds_set_lte_attach_pdn, lte-attach-pdn, required, QMI_SERVICE_WDS)
 
 
 #define wds_helptext \
@@ -82,4 +83,5 @@
                "  --get-current-settings:           Get current connection settings\n" \
                "  --bind-mux <id>:                  Bind data session to QMAP multiplex (use with options below)\n" \
                "    --endpoint-type <type>:         Set endpoint interface type (hsusb, pcie)\n" \
-               "    --endpoint-iface <number>:      Set endpoint interface number\n"
+               "    --endpoint-iface <number>:      Set endpoint interface number\n" \
+               "  --set-lte-attach-pdn #,#,...:     Set list of PDN connections used when attaching to LTE/5G\n"