From: Jonathan Cameron <jic23@kernel.org>
To: Tiberiu Breana <tiberiu.a.breana@intel.com>, linux-iio@vger.kernel.org
Subject: Re: [PATCH] tools: iio: Add single-byte case for generic_buffer
Date: Sun, 21 Jun 2015 11:00:58 +0100 [thread overview]
Message-ID: <55868B5A.1010604@kernel.org> (raw)
In-Reply-To: <1434381469-4373-1-git-send-email-tiberiu.a.breana@intel.com>
On 15/06/15 16:17, Tiberiu Breana wrote:
> Some sensors export data in an 8-bit format.
> Add a single-byte case for the generic_buffer tool so that
> these sensors' buffer data can be visualized.
>
> Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com>
Hi Tiberiu,
Please take a closer look at the other cases handled, you've missed
application of the shift here and I'd also like you to cover the unsigned
case. Probably worth having a print1byte helper to keep it inline with
the other cases as well.
I was amazed that this wasn't already there ;) Oh well, guess we don't
actually have that many 8 bit of less devices or people aren't using
my dumb test code (much improved by others) with them anyway ;)
Jonathan
> ---
> tools/iio/generic_buffer.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c
> index f805493..0d438e3 100644
> --- a/tools/iio/generic_buffer.c
> +++ b/tools/iio/generic_buffer.c
> @@ -103,6 +103,14 @@ void process_scan(char *data,
> for (k = 0; k < num_channels; k++)
> switch (channels[k].bytes) {
> /* only a few cases implemented so far */
> + case 1:
> + if (channels[k].is_signed) {
> + int8_t val = *(int8_t *)
> + (data + channels[k].location);
> + printf("%05f ",
> + ((float)val) * channels[k].scale);
> + }
> + break;
> case 2:
> print2byte(*(uint16_t *)(data + channels[k].location),
> &channels[k]);
>
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
prev parent reply other threads:[~2015-06-21 10:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-15 15:17 [PATCH] tools: iio: Add single-byte case for generic_buffer Tiberiu Breana
2015-06-21 10:00 ` Jonathan Cameron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55868B5A.1010604@kernel.org \
--to=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=tiberiu.a.breana@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.