From: Marek Vasut Date: Sun, 12 Aug 2012 15:21:00 +0000 (+0100) Subject: IIO: Add 4-byte unsigned reads into generic-buffer example X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6cffc1f814b25d59ca6f0cd75b64bb159801c0fa;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git IIO: Add 4-byte unsigned reads into generic-buffer example Add unsigned 32bit-wide reads into the generic-buffer.c Signed-off-by: Marek Vasut Cc: Jonathan Cameron Cc: Juergen Beisert Cc: Lars-Peter Clausen Cc: Wolfgang Denk Signed-off-by: Jonathan Cameron --- diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c index 827e92de8e30..40d0ecac047f 100644 --- a/drivers/staging/iio/Documentation/generic_buffer.c +++ b/drivers/staging/iio/Documentation/generic_buffer.c @@ -104,6 +104,16 @@ void process_scan(char *data, print2byte(*(uint16_t *)(data + channels[k].location), &channels[k]); break; + case 4: + if (!channels[k].is_signed) { + uint32_t val = *(uint32_t *) + (data + channels[k].location); + printf("%05f ", ((float)val + + channels[k].offset)* + channels[k].scale); + + } + break; case 8: if (channels[k].is_signed) { int64_t val = *(int64_t *)