wds: make APN optional
authorMatti Laakso <malaakso@elisanet.fi>
Sun, 20 Nov 2016 21:27:32 +0000 (23:27 +0200)
committerJohn Crispin <john@phrozen.org>
Mon, 21 Nov 2016 10:01:58 +0000 (11:01 +0100)
Some modem firmwares do not use the APN selected in the Start
Network command. Moreover, it is marked optional in the QMI
specification.

Signed-off-by: Matti Laakso <malaakso@elisanet.fi>
commands-wds.c
commands-wds.h

index 7bb75da00005f8f9a54703bb2a98f003f8ab30bc..26c9f594963879d9eace3e5dc5dd029b7a6eafa0 100644 (file)
@@ -30,6 +30,14 @@ static struct qmi_wds_start_network_request wds_sn_req = {
 };
 static struct qmi_wds_stop_network_request wds_stn_req;
 
+#define cmd_wds_set_apn_cb no_cb
+static enum qmi_cmd_result
+cmd_wds_set_apn_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+       qmi_set_ptr(&wds_sn_req, apn, arg);
+       return QMI_CMD_DONE;
+}
+
 #define cmd_wds_set_auth_cb no_cb
 static enum qmi_cmd_result
 cmd_wds_set_auth_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
@@ -121,7 +129,6 @@ cmd_wds_start_network_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qm
 static enum qmi_cmd_result
 cmd_wds_start_network_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
 {
-       qmi_set_ptr(&wds_sn_req, apn, arg);
        qmi_set_wds_start_network_request(msg, &wds_sn_req);
        return QMI_CMD_REQUEST;
 }
index c603f79bb5f252d896ca8ea32043d168ac5f2e9b..3076bae2d94b55bcc245c1e045ca7716be8c6b12 100644 (file)
@@ -20,7 +20,8 @@
  */
 
 #define __uqmi_wds_commands \
-       __uqmi_command(wds_start_network, start-network, required, QMI_SERVICE_WDS), \
+       __uqmi_command(wds_start_network, start-network, no, QMI_SERVICE_WDS), \
+       __uqmi_command(wds_set_apn, apn, required, CMD_TYPE_OPTION), \
        __uqmi_command(wds_set_auth, auth-type, required, CMD_TYPE_OPTION), \
        __uqmi_command(wds_set_username, username, required, CMD_TYPE_OPTION), \
        __uqmi_command(wds_set_password, password, required, CMD_TYPE_OPTION), \
@@ -35,7 +36,8 @@
 
 
 #define wds_helptext \
-               "  --start-network <apn>:            Start network connection (use with options below)\n" \
+               "  --start-network:                  Start network connection (use with options below)\n" \
+               "    --apn <apn>:                    Use APN\n" \
                "    --auth-type pap|chap|both|none: Use network authentication type\n" \
                "    --username <name>:              Use network username\n" \
                "    --password <password>:          Use network password\n" \