summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2016-11-04 14:20:51 +0100
committerFelix Fietkau <nbd@nbd.name>2016-11-04 14:25:05 +0100
commit399eddfa3c81d5e7ff1aa736b946e3fe6ffc4eaa (patch)
tree9eb787ac65be2c974689d535dabf47b4cb180df3
parentea810c632d65d213e0dd4aed2c339c876e1eafc4 (diff)
add UIM verify pin commands
Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r--commands-uim.c48
-rw-r--r--commands-uim.h30
-rw-r--r--commands.c1
-rw-r--r--commands.h4
-rw-r--r--dev.c1
-rw-r--r--main.c1
6 files changed, 84 insertions, 1 deletions
diff --git a/commands-uim.c b/commands-uim.c
new file mode 100644
index 0000000..4c0287e
--- /dev/null
+++ b/commands-uim.c
@@ -0,0 +1,48 @@
+/*
+ * uqmi -- tiny QMI support implementation
+ *
+ * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ */
+
+#define cmd_uim_verify_pin1_cb no_cb
+static enum qmi_cmd_result
+cmd_uim_verify_pin1_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+ struct qmi_uim_verify_pin_request data = {
+ QMI_INIT_SEQUENCE(info,
+ .pin_id = QMI_UIM_PIN_ID_PIN1,
+ .pin_value = arg
+ )
+ };
+ qmi_set_uim_verify_pin_request(msg, &data);
+ return QMI_CMD_REQUEST;
+}
+
+#define cmd_uim_verify_pin2_cb no_cb
+static enum qmi_cmd_result
+cmd_uim_verify_pin2_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+ struct qmi_uim_verify_pin_request data = {
+ QMI_INIT_SEQUENCE(info,
+ .pin_id = QMI_UIM_PIN_ID_PIN2,
+ .pin_value = arg
+ )
+ };
+ qmi_set_uim_verify_pin_request(msg, &data);
+ return QMI_CMD_REQUEST;
+}
diff --git a/commands-uim.h b/commands-uim.h
new file mode 100644
index 0000000..86ebae4
--- /dev/null
+++ b/commands-uim.h
@@ -0,0 +1,30 @@
+/*
+ * uqmi -- tiny QMI support implementation
+ *
+ * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ */
+
+#define __uqmi_uim_commands \
+ __uqmi_command(uim_verify_pin1, uim-verify-pin1, required, QMI_SERVICE_UIM), \
+ __uqmi_command(uim_verify_pin2, uim-verify-pin2, required, QMI_SERVICE_UIM) \
+
+
+#define uim_helptext \
+ " --uim-verify-pin1 <pin>: Verify PIN1 (new devices)\n" \
+ " --uim-verify-pin2 <pin>: Verify PIN2 (new devices)\n" \
+
diff --git a/commands.c b/commands.c
index b1b54d7..869ca7c 100644
--- a/commands.c
+++ b/commands.c
@@ -161,6 +161,7 @@ cmd_ctl_set_data_format_prepare(struct qmi_dev *qmi, struct qmi_request *req, st
#include "commands-nas.c"
#include "commands-wms.c"
#include "commands-wda.c"
+#include "commands-uim.c"
#define __uqmi_command(_name, _optname, _arg, _type) \
[__UQMI_COMMAND_##_name] = { \
diff --git a/commands.h b/commands.h
index 1c9b5d6..28823f3 100644
--- a/commands.h
+++ b/commands.h
@@ -28,6 +28,7 @@
#include "commands-nas.h"
#include "commands-wms.h"
#include "commands-wda.h"
+#include "commands-uim.h"
enum qmi_cmd_result {
QMI_CMD_DONE,
@@ -61,7 +62,8 @@ struct uqmi_cmd {
__uqmi_dms_commands, \
__uqmi_nas_commands, \
__uqmi_wms_commands, \
- __uqmi_wda_commands
+ __uqmi_wda_commands, \
+ __uqmi_uim_commands
#define __uqmi_command(_name, _optname, _arg, _option) __UQMI_COMMAND_##_name
enum uqmi_command {
diff --git a/dev.c b/dev.c
index 06b0b33..9bf7ab2 100644
--- a/dev.c
+++ b/dev.c
@@ -390,6 +390,7 @@ QmiService qmi_service_get_by_name(const char *str)
{ "wds", QMI_SERVICE_WDS },
{ "wms", QMI_SERVICE_WMS },
{ "wda", QMI_SERVICE_WDA },
+ { "uim", QMI_SERVICE_UIM },
};
int i;
diff --git a/main.c b/main.c
index e4617e2..25ec992 100644
--- a/main.c
+++ b/main.c
@@ -68,6 +68,7 @@ static int usage(const char *progname)
" (implies --keep-client-id)\n"
wds_helptext
dms_helptext
+ uim_helptext
nas_helptext
wms_helptext
wda_helptext