Skip to content

[RFC PATCH v4] iio: repeat channel support and dummy client example#42

Closed
lucasrangit wants to merge 5 commits into
analogdevicesinc:masterfrom
lucasrangit:dummy-example-v4
Closed

[RFC PATCH v4] iio: repeat channel support and dummy client example#42
lucasrangit wants to merge 5 commits into
analogdevicesinc:masterfrom
lucasrangit:dummy-example-v4

Conversation

@lucasrangit

Copy link
Copy Markdown
Contributor

iio_chan_type IIO_ROT uses the repeat channel iio_chan_spec.scan_type.repeat to store repeated elements in a channel without modifiers.

This patch series adds support to libiio and creates a new example tool that exercises the iio_dummy driver. For testing this series the iio_dummy can be patched to include the IIO_ROT channel. See lucasrangit/linux-iio#1 .

Signed-off-by: Lucas Magasweran lucas.magasweran@daqri.com


Changes since v1:

  • tests: iio_info: compared format->repeat > 1 for consistent output and avoid duplicated printf
  • examples: dummy: remove debug print of scan channel size and repeat count
    and squashed commits since this is a new sample tool
  • added missing Signed-off-by to commits

Changes since v2:

  • iio: moved struct iio_data_format member repeat to the end of the struct to maintain forward ABI compatibility.
  • iio: added a note specifying that the member was added in version v0.8 (assuming this will be merged). this shows up in the doxygen documentation where users are more likely to see a potential version dependency.
  • docs: added note to main page about abi compatibility and recommended usage of iio_library_get_version().
  • examples: dummy: even though this is versioned with the latest source, it may be run against older library versions so it includes an example of checking the library for a feature and conditionally using that feature if supported.

Signed-off-by: Lucas Magasweran <lucas.magasweran@daqri.com>
Linux struct iio_chan_spec supports a 'repeat' scan_type attribute that
represents the number of times the element repeats. A value of 0 and 1
signifies no repeat.

In order maintain backwards and forwards compatibility, the repeat field was
added to the end of the struct. This means applications compiled against an
older version will work fine with the newer dynamically linked library.
Applications compiled against a newer version will work fine with the older
dynamically linked library so long as they don't access this new feature.
Applications using this new feature should ensure the libiio version is
compatible by using iio_library_get_version() to avoid undefined behavior.

Signed-off-by: Lucas Magasweran <lucas.magasweran@daqri.com>
…-hrtimer

Signed-off-by: Lucas Magasweran <lucas.magasweran@daqri.com>
This matches the optional X%u repeat count in sysfs _type scan element
format attribute.

Signed-off-by: Lucas Magasweran <lucas.magasweran@daqri.com>
Signed-off-by: Lucas Magasweran <lucas.magasweran@daqri.com>
Comment thread iio.h
/** @brief Contains the scale to apply if with_scale is set */
double scale;

/** @brief Number of times length repeats (added in v0.8) */

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am assuming this will be merged and released with v0.8.

printf("Library version: %u.%u (git tag: %s)\n", major, minor, git_tag);

/* check for struct iio_data_format.repeat support */
has_repeat = major >= 0 && minor >= 8 ? true : false;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am assuming this will be merged and released with v0.8.

@pcercuei

Copy link
Copy Markdown
Contributor

I don't like how you use "(chn->format.repeat ? chn->format.repeat : 1)" everywhere.
It does not make sense to have chn->format.repeat set to 0 anyway, why not initialize it to 1 by default?

@lucasrangit

Copy link
Copy Markdown
Contributor Author

I did that so that the libiio repeat field matched the value in the kernel,
which doesn't initialize to 1. However, I see your point and will change
it.

Thanks for the feedback!

On Tue, Sep 20, 2016, 05:52 Paul Cercueil notifications@github.com wrote:

I don't like how you use "(chn->format.repeat ? chn->format.repeat : 1)"
everywhere.
It does not make sense to have chn->format.repeat set to 0 anyway, why not
initialize it to 1 by default?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#42 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAq1ertkQ3-nOs_NfenPzGrPCQbLP0ziks5qr9bsgaJpZM4J-e64
.

@pcercuei

Copy link
Copy Markdown
Contributor

Thanks :)

@lucasrangit

Copy link
Copy Markdown
Contributor Author

Changed the initial value of repeat in pull request #43.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants