wds: implement profile deletion
authorDavid Bauer <[email protected]>
Thu, 13 Feb 2025 01:19:27 +0000 (02:19 +0100)
committerDavid Bauer <[email protected]>
Wed, 9 Jul 2025 12:52:45 +0000 (14:52 +0200)
Implement deletion of a specific configuration on the modem.

Signed-off-by: David Bauer <[email protected]>
uqmi/commands-wds.c
uqmi/commands-wds.h

index b7d3f09c7726ebf4f2fd31da4eee26238e79f189..afb57aa901da14b121baf89c7534fff7816bd01b 100644 (file)
@@ -648,3 +648,30 @@ cmd_wds_get_default_profile_cb(struct qmi_dev *qmi, struct qmi_request *req, str
 
        blobmsg_close_table(&status, p);
 }
+
+#define cmd_wds_delete_profile_cb no_cb
+
+static enum qmi_cmd_result
+cmd_wds_delete_profile_prepare(struct qmi_dev *qmi, struct qmi_request *req,
+                              struct qmi_msg *msg, char *arg)
+{
+       struct qmi_wds_delete_profile_request delete_req = {
+               QMI_INIT_SEQUENCE(profile_identifier,
+                       .profile_type = QMI_WDS_PROFILE_TYPE_3GPP,
+                       .profile_index = 1,
+               )
+       };
+       struct uqmi_wds_profile_identifier profile;
+
+       if (uqmi_wds_profile_identifier_parse(arg, &profile) < 0) {
+               fprintf(stderr, "Invalid argument\n");
+               return QMI_CMD_EXIT;
+       }
+
+       qmi_set_ptr(&delete_req, profile_identifier.profile_type, profile.type);
+       qmi_set_ptr(&delete_req, profile_identifier.profile_index, profile.index);
+
+       qmi_set_wds_delete_profile_request(msg, &delete_req);
+
+       return QMI_CMD_REQUEST;
+}
index 26e98b3c08ecc24c8121b35595b64a584e26d66d..18d4c391a96100e287cec46d0d7e823fd1894b6a 100644 (file)
@@ -37,6 +37,7 @@
        __uqmi_command(wds_get_default_profile, get-default-profile, required, QMI_SERVICE_WDS), \
        __uqmi_command(wds_create_profile, create-profile, required, QMI_SERVICE_WDS), \
        __uqmi_command(wds_modify_profile, modify-profile, required, QMI_SERVICE_WDS), \
+       __uqmi_command(wds_delete_profile, delete-profile, required, QMI_SERVICE_WDS), \
        __uqmi_command(wds_set_pdp_type, pdp-type, required, CMD_TYPE_OPTION), \
        __uqmi_command(wds_no_roaming, no-roaming, required, CMD_TYPE_OPTION), \
        __uqmi_command(wds_get_current_settings, get-current-settings, no, QMI_SERVICE_WDS), \
@@ -75,6 +76,7 @@
                "    --password <password>:          Use network password\n" \
                "    --auth-type pap|chap|both|none: Use network authentication type\n" \
                "    --no-roaming false|true         To allow roaming, set to false\n" \
+               "  --delete-profile <val>,#:         Delete profile number (3gpp, 3gpp2)\n" \
                "  --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" \