diff options
author | Andriy Tryshnivskyy <andriy.tryshnivskyy@opensynergy.com> | 2021-10-09 23:10:44 +0200 |
---|---|---|
committer | Andriy Tryshnivskyy <andriy.tryshnivskyy@opensynergy.com> | 2021-10-25 14:32:08 +0300 |
commit | 14ae864f8d4824049fd91dc471d7b70f708bb410 (patch) | |
tree | 9cb157ffff29707d06c8ad91771befd5ae699f03 | |
parent | 34924f5a91df68134a5b5fb04cce05f08da06199 (diff) |
binding iiodevices: Support 64-bit raw values.needlefish_13.93.0needlefish/13.93.0marlin_12.93.0marlin_12.92.0marlin_12.91.0marlin_12.90.1marlin/12.93.0marlin/12.92.0marlin/12.91.0marlin/12.90.113.93.012.93.012.92.012.91.012.90.1
IIO SCMI sensor can return such values.
Bug-AGL: SPEC-3865
Signed-off-by: Andriy Tryshnivskyy <andriy.tryshnivskyy@opensynergy.com>
Change-Id: Ifbdae831fd69bce6b3d0e360fb5848264b1db4e5
-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; } |