From: Uwe Wojak Date: Mon, 7 Jul 2014 13:57:53 +0000 (+0200) Subject: Added commands to unblock blocked PINs. X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=50c1e167be97a7d189c8322adca8f34625149f33;p=oweals%2Fuqmi.git Added commands to unblock blocked PINs. Added commands "--unblock-pin1" and "--unblock-pin2" and parameters "--puk" and "--new-pin". --- diff --git a/commands-dms.c b/commands-dms.c index 43b973e..5373df7 100644 --- a/commands-dms.c +++ b/commands-dms.c @@ -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; diff --git a/commands-dms.h b/commands-dms.h index 18643ca..2b9d83c 100644 --- a/commands-dms.h +++ b/commands-dms.h @@ -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) \ @@ -10,6 +14,12 @@ " --get-pin-status: Get PIN verification status\n" \ " --verify-pin1 : Verify PIN1\n" \ " --verify-pin2 : Verify PIN2\n" \ + " --unblock-pin1: Unblock PIN1\n" \ + " --puk : PUK needed to unblock\n" \ + " --new-pin : New pin\n" \ + " --unblock-pin2: Unblock PIN2\n" \ + " --puk : PUK needed to unblock\n" \ + " --new-pin : New pin\n" \ " --get-imsi: Get International Mobile Subscriber ID\n" \ " --reset-dms: Reset the DMS service\n" \ " --set-device-operating-mode Set the device operating mode\n" \