[OpenWrt-Devel] [PATCH uqmi 3/3] v2 Added commands to change PIN code

Sławomir Demeszko s.demeszko at wireless-instruments.com
Wed Dec 17 09:56:32 EST 2014


Signed-off-by: Sławomir Demeszko <s.demeszko at wireless-instruments.com>
---
Sorry, somehow old version was in commit. I removed static from struct.

 commands-dms.c | 36 ++++++++++++++++++++++++++++++++++++
 commands-dms.h |  8 ++++++++
 2 files changed, 44 insertions(+)

diff --git a/commands-dms.c b/commands-dms.c
index 76144cf..435c72b 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" \
-- 
1.9.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list