From: Michael Hennerich <michael.hennerich@xxxxxxxxxx> In case a timestamp is present, scan size returned by size_from_channelarray() is not longer valid. However size_from_channelarray() must be still called in order to setup locations within the buffer. Signed-off-by: Michael Hennerich <michael.hennerich@xxxxxxxxxx> --- drivers/staging/iio/Documentation/generic_buffer.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c index 131d9d0..c382452 100644 --- a/drivers/staging/iio/Documentation/generic_buffer.c +++ b/drivers/staging/iio/Documentation/generic_buffer.c @@ -226,7 +226,13 @@ int main(int argc, char **argv) ret = write_sysfs_int("enable", buf_dir_name, 1); if (ret < 0) goto error_free_buf_dir_name; - scan_size = size_from_channelarray(infoarray, num_channels); + + scan_size = read_sysfs_posint("bytes_per_datum", buf_dir_name); + if (ret < 0) + goto error_free_buf_dir_name; + + size_from_channelarray(infoarray, num_channels); + data = malloc(scan_size*buf_len); if (!data) { ret = -ENOMEM; -- 1.6.0.2 -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html