From: Marcel Holtmann Date: Mon, 25 Jun 2012 05:24:56 +0000 (-0700) Subject: qmimodem: Add helper function for accessing 64-bit integers X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=74d208768ae462ec9946a58c4977b031771c0b95;p=platform%2Fupstream%2Fofono.git qmimodem: Add helper function for accessing 64-bit integers --- diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index b08321d..378da80 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -1320,6 +1320,28 @@ bool qmi_result_get_uint32(struct qmi_result *result, uint8_t type, return true; } +bool qmi_result_get_uint64(struct qmi_result *result, uint8_t type, + uint64_t *value) +{ + const unsigned char *ptr; + uint16_t len; + uint64_t tmp; + + if (!result || !type) + return false; + + ptr = tlv_get(result->data, result->length, type, &len); + if (!ptr) + return false; + + memcpy(&tmp, ptr, 8); + + if (value) + *value = GUINT64_FROM_LE(tmp); + + return true; +} + struct service_create_data { struct qmi_device *device; uint8_t type; diff --git a/drivers/qmimodem/qmi.h b/drivers/qmimodem/qmi.h index 0bfba93..f8f18b9 100644 --- a/drivers/qmimodem/qmi.h +++ b/drivers/qmimodem/qmi.h @@ -114,6 +114,8 @@ bool qmi_result_get_uint16(struct qmi_result *result, uint8_t type, uint16_t *value); bool qmi_result_get_uint32(struct qmi_result *result, uint8_t type, uint32_t *value); +bool qmi_result_get_uint64(struct qmi_result *result, uint8_t type, + uint64_t *value); struct qmi_service;