aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndriy Tryshnivskyy <andriy.tryshnivskyy@opensynergy.com>2021-10-09 23:10:44 +0200
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2021-11-03 14:28:35 +0000
commit66851f16f97e07eba6f48a9c11373b17f074c04c (patch)
tree05c9af59419e01ff09b613c1a4b6fbba2af243c4
parent0972d75a487820e3c68e63819a9b7d9bcd7ddb0b (diff)
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.c10
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;
}