From e353a88321ac091d0708bb2271a1bbb471107a69 Mon Sep 17 00:00:00 2001 From: Uwe Wojak Date: Thu, 30 Oct 2014 10:17:51 +0100 Subject: [PATCH] Added command "--get-iccid" to read the SIM serial number. --- commands-dms.c | 16 ++++++++++++++++ commands-dms.h | 4 +++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/commands-dms.c b/commands-dms.c index 5373df7..563321e 100644 --- a/commands-dms.c +++ b/commands-dms.c @@ -127,6 +127,22 @@ cmd_dms_unblock_pin2_prepare(struct qmi_dev *qmi, struct qmi_request *req, struc return QMI_CMD_REQUEST; } +static void cmd_dms_get_iccid_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg) +{ + struct qmi_dms_uim_get_iccid_response res; + + qmi_parse_dms_uim_get_iccid_response(msg, &res); + if (res.data.iccid) + blobmsg_add_string(&status, NULL, res.data.iccid); +} + +static enum qmi_cmd_result +cmd_dms_get_iccid_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg) +{ + qmi_set_dms_uim_get_iccid_request(msg); + 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 2b9d83c..1f21b13 100644 --- a/commands-dms.h +++ b/commands-dms.h @@ -1,4 +1,4 @@ -#define __uqmi_dms_commands \ +#define __uqmi_dms_commands \ __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), \ @@ -6,6 +6,7 @@ __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_iccid, get-iccid, no, QMI_SERVICE_DMS), \ __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) \ @@ -20,6 +21,7 @@ " --unblock-pin2: Unblock PIN2\n" \ " --puk : PUK needed to unblock\n" \ " --new-pin : New pin\n" \ + " --get-iccid: Get the ICCID\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" \ -- 2.30.2