From c7d4858e3adbd27f47461f7f105bbff95dcdf3b3 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 2 Oct 2014 11:59:03 +0200 Subject: [PATCH] add a command for changing the autoconnect setting Signed-off-by: Felix Fietkau --- commands-wds.c | 25 +++++++++++++++++++++++ commands-wds.h | 2 ++ data/qmi-service-wds.json | 43 +++++++++++++++++++++++++++++++++++++++ qmi-enums-wds.h | 12 +++++++++++ 4 files changed, 82 insertions(+) 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 : 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 : 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 @@ -949,6 +949,28 @@ "public-format" : "QmiWdsExtendedTechnologyPreference", "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", @@ -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_ */ -- 2.30.2