Add command to get IMEI from the device
authorFelix Fietkau <nbd@openwrt.org>
Mon, 13 Apr 2015 22:29:26 +0000 (00:29 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 13 Apr 2015 22:29:26 +0000 (00:29 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
commands-dms.c
commands-dms.h

index 563b6d92f8db10126fa53271a8ec479bd5a8f1d2..668c78f2615b4bec900f9ee741387a920032ed52 100644 (file)
@@ -331,6 +331,22 @@ cmd_dms_get_msisdn_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct
        return QMI_CMD_REQUEST;
 }
 
+static void cmd_dms_get_imei_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg)
+{
+       struct qmi_dms_get_ids_response res;
+
+       qmi_parse_dms_get_ids_response(msg, &res);
+       if (res.data.imei)
+               blobmsg_add_string(&status, NULL, res.data.imei);
+}
+
+static enum qmi_cmd_result
+cmd_dms_get_imei_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+       qmi_set_dms_get_ids_request(msg);
+       return QMI_CMD_REQUEST;
+}
+
 #define cmd_dms_reset_cb no_cb
 static enum qmi_cmd_result
 cmd_dms_reset_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
index a3704256dcf30175c33cec26cab155afba0591e1..edf6fde0d825553d3333918e6187d2b9ced5c3bf 100644 (file)
@@ -14,6 +14,7 @@
        __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_get_imei, get-imei, no, QMI_SERVICE_DMS), \
        __uqmi_command(dms_get_msisdn, get-msisdn, 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) \
@@ -41,6 +42,7 @@
                "    --new-pin <new pin>:            New pin\n" \
                "  --get-iccid:                      Get the ICCID\n" \
                "  --get-imsi:                       Get International Mobile Subscriber ID\n" \
+               "  --get-imei:                       Get International Mobile Equipment ID\n" \
                "  --get-msisdn:                     Get the MSISDN (telephone number)\n" \
                "  --reset-dms:                      Reset the DMS service\n" \
                "  --set-device-operating-mode <m>   Set the device operating mode\n" \