implement the start network command
authorFelix Fietkau <nbd@openwrt.org>
Sun, 17 Feb 2013 18:37:23 +0000 (19:37 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 17 Feb 2013 18:37:23 +0000 (19:37 +0100)
commands-wds.c
commands-wds.h

index 777411488a755e2eab35450a094f423aa6ee69b0..3b27bfd82fa46b03f794be32f4a32f924b890dbb 100644 (file)
@@ -1,3 +1,5 @@
+#include "qmi-message.h"
+
 static struct qmi_wds_start_network_request wds_sn_req = {
        QMI_INIT(authentication_preference,
                 QMI_WDS_AUTHENTICATION_PAP | QMI_WDS_AUTHENTICATION_CHAP),
@@ -45,3 +47,21 @@ cmd_wds_set_password_prepare(struct qmi_dev *qmi, struct qmi_request *req, struc
        qmi_set_ptr(&wds_sn_req, password, arg);
        return QMI_CMD_DONE;
 }
+
+static void
+cmd_wds_start_network_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg)
+{
+       struct qmi_wds_start_network_response res;
+
+       qmi_parse_wds_start_network_response(msg, &res);
+       if (res.set.packet_data_handle)
+               blobmsg_add_u32(&status, "handle", res.data.packet_data_handle);
+}
+
+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 2374f853261908facef293c7a93fe5a4bb81c69e..b6198c2d07e7d4cfbd5ff5785edbcc78ac775183 100644 (file)
@@ -1,10 +1,12 @@
 #define __uqmi_wds_commands \
-       __uqmi_command(wds_set_auth, set-auth, required, QMI_SERVICE_WDS), \
-       __uqmi_command(wds_set_username, set-username, required, QMI_SERVICE_WDS), \
-       __uqmi_command(wds_set_password, set-password, required, QMI_SERVICE_WDS)
+       __uqmi_command(wds_start_network, start-network, required, QMI_SERVICE_WDS), \
+       __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)
 
 #define wds_helptext \
-               "  --set-auth pap|chap|both|none:    Set network authentication type\n" \
-               "  --set-username:                   Set network username\n" \
-               "  --set-password:                   Set network password\n" \
+               "  --start-network <apn>:            Start network connection (use with options below)\n" \
+               "    --auth-type pap|chap|both|none: Use network authentication type\n" \
+               "    --username <name>:              Use network username\n" \
+               "    --password <password>:          Use network password\n" \