add UIM verify pin commands
authorFelix Fietkau <nbd@nbd.name>
Fri, 4 Nov 2016 13:20:51 +0000 (14:20 +0100)
committerFelix Fietkau <nbd@nbd.name>
Fri, 4 Nov 2016 13:25:05 +0000 (14:25 +0100)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
commands-uim.c [new file with mode: 0644]
commands-uim.h [new file with mode: 0644]
commands.c
commands.h
dev.c
main.c

diff --git a/commands-uim.c b/commands-uim.c
new file mode 100644 (file)
index 0000000..4c0287e
--- /dev/null
@@ -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 (file)
index 0000000..86ebae4
--- /dev/null
@@ -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" \
+
index b1b54d70b8828eb556a612236832c013bccc2004..869ca7c5b0fc1eaa2d0dfda2fa17c75311b45267 100644 (file)
@@ -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] = { \
index 1c9b5d613bac9f7615ae3316f7ebbbef73a864bd..28823f35ee2c355c61f6e4dfcb7e3000455cd9e2 100644 (file)
@@ -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 06b0b33ef9492804f6d601ab61d65e676e4cdd4b..9bf7ab20f904b5ac631c3d2538c5f6384139f292 100644 (file)
--- 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 e4617e295c92da4cad9e773d8dfffc9f22093267..25ec992405ce7cb8f0e75e4d542751cd8a0f813c 100644 (file)
--- 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