Added commands to unblock blocked PINs.
authorUwe Wojak <uwojak@eltec.de>
Mon, 7 Jul 2014 13:57:53 +0000 (15:57 +0200)
committerJohn Crispin <blogic@openwrt.org>
Thu, 30 Oct 2014 10:49:05 +0000 (11:49 +0100)
Added commands "--unblock-pin1" and "--unblock-pin2" and
parameters "--puk" and  "--new-pin".

commands-dms.c
commands-dms.h

index 43b973e28220a3ce428b5666cb02eeb410fae30c..5373df7de8928e7942b593e2e9e87811964b2a7c 100644 (file)
@@ -75,6 +75,58 @@ cmd_dms_verify_pin2_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct
        return QMI_CMD_REQUEST;
 }
 
+static struct qmi_dms_uim_unblock_pin_request dms_unlock_pin_req = {
+       QMI_INIT_SEQUENCE(info,
+                       .pin_id = QMI_DMS_UIM_PIN_ID_PIN
+               )
+       };
+
+#define cmd_dms_set_new_pin_cb no_cb
+static enum qmi_cmd_result
+cmd_dms_set_new_pin_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+       qmi_set_ptr(&dms_unlock_pin_req, info.new_pin, arg);
+       return QMI_CMD_DONE;
+}
+
+#define cmd_dms_set_puk_cb no_cb
+static enum qmi_cmd_result
+cmd_dms_set_puk_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+       qmi_set_ptr(&dms_unlock_pin_req, info.puk, arg);
+       return QMI_CMD_DONE;
+}
+
+#define cmd_dms_unblock_pin1_cb no_cb
+static enum qmi_cmd_result
+cmd_dms_unblock_pin1_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+       qmi_set_ptr(&dms_unlock_pin_req, info.pin_id, QMI_DMS_UIM_PIN_ID_PIN);
+
+       if (!dms_unlock_pin_req.data.info.puk || !dms_unlock_pin_req.data.info.new_pin) {
+               uqmi_add_error("Missing argument");
+               return QMI_CMD_EXIT;
+       }
+
+       qmi_set_dms_uim_unblock_pin_request(msg, &dms_unlock_pin_req);
+       return QMI_CMD_REQUEST;
+}
+
+#define cmd_dms_unblock_pin2_cb no_cb
+static enum qmi_cmd_result
+cmd_dms_unblock_pin2_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+       qmi_set_ptr(&dms_unlock_pin_req, info.pin_id, QMI_DMS_UIM_PIN_ID_PIN2);
+
+       if (!dms_unlock_pin_req.data.info.puk || !dms_unlock_pin_req.data.info.new_pin) {
+               uqmi_add_error("Missing argument");
+               return QMI_CMD_EXIT;
+       }
+
+       qmi_set_dms_uim_unblock_pin_request(msg, &dms_unlock_pin_req);
+       return QMI_CMD_REQUEST;
+}
+
 static void cmd_dms_get_imsi_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg)
 {
        struct qmi_dms_uim_get_imsi_response res;
index 18643ca4c60025d310c356fd4e93b40dbaa1f287..2b9d83c98fdd12507193bcc31889b3b9c1fd6149 100644 (file)
@@ -2,6 +2,10 @@
        __uqmi_command(dms_get_pin_status, get-pin-status, no, QMI_SERVICE_DMS), \
        __uqmi_command(dms_verify_pin1, verify-pin1, required, QMI_SERVICE_DMS), \
        __uqmi_command(dms_verify_pin2, verify-pin2, required, QMI_SERVICE_DMS), \
+       __uqmi_command(dms_unblock_pin1, unblock-pin1, no, QMI_SERVICE_DMS), \
+       __uqmi_command(dms_unblock_pin2, unblock-pin2, no, QMI_SERVICE_DMS), \
+       __uqmi_command(dms_set_puk, puk, required, CMD_TYPE_OPTION), \
+       __uqmi_command(dms_set_new_pin, new-pin, required, CMD_TYPE_OPTION), \
        __uqmi_command(dms_get_imsi, get-imsi, no, QMI_SERVICE_DMS), \
        __uqmi_command(dms_set_operating_mode, set-device-operating-mode, required, QMI_SERVICE_DMS), \
        __uqmi_command(dms_reset, reset-dms, no, QMI_SERVICE_DMS) \
                "  --get-pin-status:                 Get PIN verification status\n" \
                "  --verify-pin1 <pin>:              Verify PIN1\n" \
                "  --verify-pin2 <pin>:              Verify PIN2\n" \
+               "  --unblock-pin1:                   Unblock PIN1\n" \
+               "    --puk <puk>:                    PUK needed to unblock\n" \
+               "    --new-pin <new pin>:            New pin\n" \
+               "  --unblock-pin2:                   Unblock PIN2\n" \
+               "    --puk <puk>:                    PUK needed to unblock\n" \
+               "    --new-pin <new pin>:            New pin\n" \
                "  --get-imsi:                       Get International Mobile Subscriber ID\n" \
                "  --reset-dms:                      Reset the DMS service\n" \
                "  --set-device-operating-mode <m>   Set the device operating mode\n" \