qmimodem: Add helper function for accessing 64-bit integers

This commit is contained in:
Marcel Holtmann 2012-06-24 22:24:56 -07:00
parent 797f3a502e
commit 74d208768a
2 changed files with 24 additions and 0 deletions

View File

@ -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;

View File

@ -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;