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 b1b54d7..869ca7c 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 1c9b5d6..28823f3 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 06b0b33..9bf7ab2 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 e4617e2..25ec992 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