summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSławomir Demeszko <s.demeszko@wireless-instruments.com>2014-12-17 15:56:32 +0100
committerFelix Fietkau <nbd@openwrt.org>2014-12-18 13:04:14 +0100
commitb57c0e5af68a65b97aa02b3fc754f40462f2ad80 (patch)
treefd74ff464ee3442ff383d16965993b26861f6daa
parent34db1f7991934675392c7af9c41c4fe0d8cd64b0 (diff)
Added commands to change PIN code
Signed-off-by: SÅ‚awomir Demeszko <s.demeszko@wireless-instruments.com>
-rw-r--r--commands-dms.c36
-rw-r--r--commands-dms.h8
2 files changed, 44 insertions, 0 deletions
diff --git a/commands-dms.c b/commands-dms.c
index 15cf829..a677052 100644
--- a/commands-dms.c
+++ b/commands-dms.c
@@ -136,6 +136,42 @@ cmd_dms_set_pin2_protection_prepare(struct qmi_dev *qmi, struct qmi_request *req
return cmd_dms_set_pin_protection_prepare(msg, arg);
}
+static enum qmi_cmd_result
+cmd_dms_change_pin_prepare(struct qmi_msg *msg, char *arg)
+{
+ if (!dms_req_data.pin || !dms_req_data.new_pin) {
+ uqmi_add_error("Missing argument");
+ return QMI_CMD_EXIT;
+ }
+
+ struct qmi_dms_uim_change_pin_request dms_change_pin_req = {
+ QMI_INIT_SEQUENCE(info,
+ .pin_id = dms_req_data.pin_id
+ ),
+ QMI_INIT_PTR(info.old_pin, dms_req_data.pin),
+ QMI_INIT_PTR(info.new_pin, dms_req_data.new_pin)
+ };
+
+ qmi_set_dms_uim_change_pin_request(msg, &dms_change_pin_req);
+ return QMI_CMD_REQUEST;
+}
+
+#define cmd_dms_change_pin1_cb no_cb
+static enum qmi_cmd_result
+cmd_dms_change_pin1_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+ dms_req_data.pin_id = QMI_DMS_UIM_PIN_ID_PIN;
+ return cmd_dms_change_pin_prepare(msg, arg);
+}
+
+#define cmd_dms_change_pin2_cb no_cb
+static enum qmi_cmd_result
+cmd_dms_change_pin2_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+ dms_req_data.pin_id = QMI_DMS_UIM_PIN_ID_PIN2;
+ return cmd_dms_change_pin_prepare(msg, arg);
+}
+
#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)
diff --git a/commands-dms.h b/commands-dms.h
index e214975..925aea3 100644
--- a/commands-dms.h
+++ b/commands-dms.h
@@ -5,6 +5,8 @@
__uqmi_command(dms_set_pin1_protection, set-pin1-protection, required, QMI_SERVICE_DMS), \
__uqmi_command(dms_set_pin2_protection, set-pin2-protection, required, QMI_SERVICE_DMS), \
__uqmi_command(dms_set_pin, pin, required, CMD_TYPE_OPTION), \
+ __uqmi_command(dms_change_pin1, change-pin1, no, QMI_SERVICE_DMS), \
+ __uqmi_command(dms_change_pin2, change-pin2, no, 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), \
@@ -23,6 +25,12 @@
" --pin <pin>: PIN1 needed to change state\n" \
" --set-pin2-protection <state>: Set PIN2 protection state (disabled, enabled)\n" \
" --pin <pin2>: PIN2 needed to change state\n" \
+ " --change-pin1: Change PIN1\n" \
+ " --pin <old pin>: Current PIN1\n" \
+ " --new-pin <new pin>: New pin\n" \
+ " --change-pin2: Change PIN2\n" \
+ " --pin <old pin>: Current PIN2\n" \
+ " --new-pin <new pin>: New pin\n" \
" --unblock-pin1: Unblock PIN1\n" \
" --puk <puk>: PUK needed to unblock\n" \
" --new-pin <new pin>: New pin\n" \