From 9d816b46e6f2b707b6f91f1363f9c890c1ebf659 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 17 Feb 2013 19:37:23 +0100 Subject: [PATCH] implement the start network command --- commands-wds.c | 20 ++++++++++++++++++++ commands-wds.h | 14 ++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/commands-wds.c b/commands-wds.c index 7774114..3b27bfd 100644 --- a/commands-wds.c +++ b/commands-wds.c @@ -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; +} diff --git a/commands-wds.h b/commands-wds.h index 2374f85..b6198c2 100644 --- a/commands-wds.h +++ b/commands-wds.h @@ -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 : Start network connection (use with options below)\n" \ + " --auth-type pap|chap|both|none: Use network authentication type\n" \ + " --username : Use network username\n" \ + " --password : Use network password\n" \ -- 2.25.1