aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
}