Added commands to change PIN code
authorSławomir Demeszko <s.demeszko@wireless-instruments.com>
Wed, 17 Dec 2014 14:56:32 +0000 (15:56 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 18 Dec 2014 12:04:14 +0000 (13:04 +0100)
Signed-off-by: SÅ‚awomir Demeszko <s.demeszko@wireless-instruments.com>
commands-dms.c
commands-dms.h

index 15cf8297b712e2415ea5c8f2ac84af1e7d23ec2f..a677052a4af7445480de9589da00ac18c4db024f 100644 (file)
@@ -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)
index e214975039b7aee2c4a2f8e92e02a63e64201852..925aea329ce0b00f1626dab999f107a2cb72c0f4 100644 (file)
@@ -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), \
                "    --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" \