Created
January 4, 2016 11:01
-
-
Save pcercuei/9187ad1ac71a6eed8c6e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 745887e8484999b89d3983e89e0d53444485736a Mon Sep 17 00:00:00 2001 | |
From: Paul Cercueil <paul.cercueil@analog.com> | |
Date: Wed, 16 Dec 2015 14:51:05 +0100 | |
Subject: [PATCH] Add support for channels sharing the same index | |
Signed-off-by: Paul Cercueil <paul.cercueil@analog.com> | |
--- | |
buffer.c | 8 +++++++- | |
device.c | 2 ++ | |
2 files changed, 9 insertions(+), 1 deletion(-) | |
diff --git a/buffer.c b/buffer.c | |
index 82ab6c5..4e61f1e 100644 | |
--- a/buffer.c | |
+++ b/buffer.c | |
@@ -234,7 +234,9 @@ ssize_t iio_buffer_foreach_sample(struct iio_buffer *buffer, | |
processed += ret; | |
} | |
- ptr += length; | |
+ if (i == dev->nb_channels - 1 || dev->channels[ | |
+ i + 1]->index != chn->index) | |
+ ptr += length; | |
} | |
} | |
return processed; | |
@@ -267,6 +269,10 @@ void * iio_buffer_first(const struct iio_buffer *buffer, | |
if (!TEST_BIT(buffer->mask, cur->index)) | |
continue; | |
+ /* Two channels with the same index use the same samples */ | |
+ if (i > 0 && cur->index == buffer->dev->channels[i - 1]->index) | |
+ continue; | |
+ | |
if (ptr % len) | |
ptr += len - (ptr % len); | |
ptr += len; | |
diff --git a/device.c b/device.c | |
index 53d5832..6f83eb4 100644 | |
--- a/device.c | |
+++ b/device.c | |
@@ -449,6 +449,8 @@ ssize_t iio_device_get_sample_size_mask(const struct iio_device *dev, | |
break; | |
if (!TEST_BIT(mask, chn->index)) | |
continue; | |
+ if (i > 0 && chn->index == dev->channels[i - 1]->index) | |
+ continue; | |
if (size % length) | |
size += 2 * length - (size % length); | |
-- | |
2.6.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment