diff options
author | Andriy Tryshnivskyy <andriy.tryshnivskyy@opensynergy.com> | 2021-10-09 23:10:44 +0200 |
---|---|---|
committer | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2021-11-03 14:28:35 +0000 |
commit | 66851f16f97e07eba6f48a9c11373b17f074c04c (patch) | |
tree | 05c9af59419e01ff09b613c1a4b6fbba2af243c4 | |
parent | 0972d75a487820e3c68e63819a9b7d9bcd7ddb0b (diff) |
binding iiodevices: Support 64-bit raw values.lamprey_12.1.9lamprey_12.1.8lamprey_12.1.7lamprey_12.1.6lamprey_12.1.5lamprey_12.1.4lamprey_12.1.3lamprey_12.1.20lamprey_12.1.2lamprey_12.1.19lamprey_12.1.18lamprey_12.1.17lamprey_12.1.16lamprey_12.1.15lamprey_12.1.14lamprey_12.1.13lamprey_12.1.12lamprey_12.1.11lamprey_12.1.10lamprey_12.1.1lamprey_12.1.0lamprey/12.1.9lamprey/12.1.8lamprey/12.1.7lamprey/12.1.6lamprey/12.1.5lamprey/12.1.4lamprey/12.1.3lamprey/12.1.20lamprey/12.1.2lamprey/12.1.19lamprey/12.1.18lamprey/12.1.17lamprey/12.1.16lamprey/12.1.15lamprey/12.1.14lamprey/12.1.13lamprey/12.1.12lamprey/12.1.11lamprey/12.1.10lamprey/12.1.1lamprey/12.1.012.1.912.1.812.1.712.1.612.1.512.1.412.1.312.1.2012.1.212.1.1912.1.1812.1.1712.1.1612.1.1512.1.1412.1.1312.1.1212.1.1112.1.1012.1.112.1.0lamprey
IIO SCMI sensor can return such values.
Bug-AGL: SPEC-3865
Signed-off-by: Andriy Tryshnivskyy <andriy.tryshnivskyy@opensynergy.com>
Change-Id: Ifbdae831fd69bce6b3d0e360fb5848264b1db4e5
(cherry picked from commit 14ae864f8d4824049fd91dc471d7b70f708bb410)
-rw-r--r-- | binding/iiodevices-binding.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/binding/iiodevices-binding.c b/binding/iiodevices-binding.c index d4d4ba8..9f4ac10 100644 --- a/binding/iiodevices-binding.c +++ b/binding/iiodevices-binding.c @@ -329,7 +329,7 @@ static int read_data(struct client_sub *client, sd_event_source* src) return -1; } - char val[10]; + char val[22]; struct channels *channel = client->channels; while(channel) { //iterate on client channels if(!channel->chn) { @@ -337,11 +337,11 @@ static int read_data(struct client_sub *client, sd_event_source* src) return -1; } - iio_channel_attr_read(channel->chn, "raw", val, 10); - int data = (int)strtol(val, NULL, 10); - AFB_API_DEBUG(afbBindingV3root, "read_data: %s %d", iio_channel_get_id(channel->chn), data); + iio_channel_attr_read(channel->chn, "raw", val, sizeof(val)); + long long data = strtoll(val, NULL, 10); + AFB_API_DEBUG(afbBindingV3root, "read_data: %s %lld", iio_channel_get_id(channel->chn), data); - json_object *value = json_object_new_int(data); + json_object *value = json_object_new_int64(data); json_object_object_add(client->jobject, channel->name, value); channel = channel->next; } |