summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-10-02 11:59:03 +0200
committerFelix Fietkau <nbd@openwrt.org>2014-10-02 11:59:03 +0200
commitc7d4858e3adbd27f47461f7f105bbff95dcdf3b3 (patch)
tree77c9256946720f8e353b39cc73901bec31fa6fc7
parent11102e7e2015063728b126b9e86266a940ed596b (diff)
add a command for changing the autoconnect setting
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-rw-r--r--commands-wds.c25
-rw-r--r--commands-wds.h2
-rw-r--r--data/qmi-service-wds.json43
-rw-r--r--qmi-enums-wds.h12
4 files changed, 82 insertions, 0 deletions
diff --git a/commands-wds.c b/commands-wds.c
index a1804cf..08244a8 100644
--- a/commands-wds.c
+++ b/commands-wds.c
@@ -117,6 +117,31 @@ cmd_wds_get_packet_service_status_prepare(struct qmi_dev *qmi, struct qmi_reques
return QMI_CMD_REQUEST;
}
+#define cmd_wds_set_autoconnect_setting_cb no_cb
+static enum qmi_cmd_result
+cmd_wds_set_autoconnect_setting_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+ struct qmi_wds_set_autoconnect_setting_request ac_req;
+ const char *modes[] = {
+ [QMI_WDS_AUTOCONNECT_DISABLED] = "disabled",
+ [QMI_WDS_AUTOCONNECT_ENABLED] = "enabled",
+ [QMI_WDS_AUTOCONNECT_PAUSED] = "paused",
+ };
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(modes); i++) {
+ if (strcasecmp(modes[i], arg) != 0)
+ continue;
+
+ qmi_set(&ac_req, setting, i);
+ qmi_set_wds_set_autoconnect_setting_request(msg, &ac_req);
+ return QMI_CMD_DONE;
+ }
+
+ uqmi_add_error("Invalid value (valid: disabled, enabled, paused)");
+ return QMI_CMD_EXIT;
+}
+
#define cmd_wds_reset_cb no_cb
static enum qmi_cmd_result
cmd_wds_reset_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
diff --git a/commands-wds.h b/commands-wds.h
index 60e922d..c1985b3 100644
--- a/commands-wds.h
+++ b/commands-wds.h
@@ -6,6 +6,7 @@
__uqmi_command(wds_set_autoconnect, autoconnect, no, CMD_TYPE_OPTION), \
__uqmi_command(wds_stop_network, stop-network, required, QMI_SERVICE_WDS), \
__uqmi_command(wds_get_packet_service_status, get-data-status, no, QMI_SERVICE_WDS), \
+ __uqmi_command(wds_set_autoconnect_setting, set-autoconnect, required, QMI_SERVICE_WDS), \
__uqmi_command(wds_reset, reset-wds, no, QMI_SERVICE_WDS) \
@@ -18,4 +19,5 @@
" --stop-network <pdh>: Stop network connection (use with option below)\n" \
" --autoconnect: Disable automatic connect/reconnect\n" \
" --get-data-status: Get current data access status\n" \
+ " --set-autoconnect <val>: Get current data access status (disabled, enabled, paused)\n" \
diff --git a/data/qmi-service-wds.json b/data/qmi-service-wds.json
index 1788a78..ab48e8a 100644
--- a/data/qmi-service-wds.json
+++ b/data/qmi-service-wds.json
@@ -950,6 +950,28 @@
"prerequisites" : [ { "common-ref" : "Success" } ] } ] },
// *********************************************************************************
+ { "name" : "Get Autoconnect Setting",
+ "type" : "Message",
+ "service" : "WDS",
+ "id" : "0x0034",
+ "version" : "1.0",
+ "output" : [ { "common-ref" : "Operation Result" },
+ { "name" : "Setting",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "gint8",
+ "public-format" : "QmiWdsAutoconnectSetting",
+ "prerequisites" : [ { "common-ref" : "Success" } ] },
+ { "name" : "Roaming",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "gint8",
+ "public-format" : "gboolean",
+ "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+
+ // *********************************************************************************
{ "name" : "Get Data Bearer Technology",
"type" : "Message",
"service" : "WDS",
@@ -1021,6 +1043,27 @@
"type" : "TLV",
"format" : "guint8",
"public-format" : "QmiWdsIpFamily" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+
+ // *********************************************************************************
+ { "name" : "Set Autoconnect Setting",
+ "type" : "Message",
+ "service" : "WDS",
+ "id" : "0x0051",
+ "version" : "1.0",
+ "input" : [ { "name" : "Setting",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "QmiWdsAutoconnectSetting" },
+ { "name" : "Roaming",
+ "id" : "0x10",
+ "mandatory" : "no",
+ "type" : "TLV",
+ "format" : "guint8",
+ "public-format" : "gboolean" } ],
"output" : [ { "common-ref" : "Operation Result" } ] }
]
diff --git a/qmi-enums-wds.h b/qmi-enums-wds.h
index d9d6eb2..6af5936 100644
--- a/qmi-enums-wds.h
+++ b/qmi-enums-wds.h
@@ -1002,4 +1002,16 @@ typedef enum {
QMI_WDS_DS_PROFILE_ERROR_3GPP2_INVALID_PROFILE_ID = 1101,
} QmiWdsDsProfileError;
+/**
+ * QmiWdsAutoconnectSetting:
+ * @QMI_WDS_AUTOCONNECT_DISABLED: Disabled
+ * @QMI_WDS_AUTOCONNECT_ENABLED: Enabled
+ * @QMI_WDS_AUTOCONNECT_PAUSED: Paused (resume on power cycle)
+ */
+typedef enum {
+ QMI_WDS_AUTOCONNECT_DISABLED = 0,
+ QMI_WDS_AUTOCONNECT_ENABLED = 1,
+ QMI_WDS_AUTOCONNECT_PAUSED = 2,
+} QmiWdsAutoconnectSetting;
+
#endif /* _LIBQMI_GLIB_QMI_ENUMS_WDS_H_ */