From 6df1dc05e73e5108d623c6a38dd24b30f0163657 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Mon, 1 Aug 2016 19:39:51 -0700 Subject: tools: iio: lsiio: enumerate processed channels Enumerate the processed channels (e.g. *_input) as well the raw channels. Signed-off-by: Matt Ranostay Signed-off-by: Jonathan Cameron --- tools/iio/lsiio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/iio/lsiio.c b/tools/iio/lsiio.c index 3d650e668252..ab0f5cf16025 100644 --- a/tools/iio/lsiio.c +++ b/tools/iio/lsiio.c @@ -51,7 +51,8 @@ static int dump_channels(const char *dev_dir_name) while (ent = readdir(dp), ent) if (check_prefix(ent->d_name, "in_") && - check_postfix(ent->d_name, "_raw")) + (check_postfix(ent->d_name, "_raw") || + check_postfix(ent->d_name, "_input"))) printf(" %-10s\n", ent->d_name); return (closedir(dp) == -1) ? -errno : 0; -- cgit v1.2.3-58-ga151 From 6356f1b9b7e3ccd24bec93c7ed4e226464f44774 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Mon, 22 Aug 2016 15:19:37 -0700 Subject: iio: iio-utils: use channel modifier scaling if it exists Now there are channel modifiers with their own scaling those should be used when possible over the generic channel type scaling. Examples are of IIO_TEMP channel having a generic scaling value, and another having IIO_MOD_TEMP_AMBIENT modifier with another scaling value. Previously the first scaling value for a channel type would be applied to all channels of like type in iio_generic_buffer Signed-off-by: Matt Ranostay Signed-off-by: Jonathan Cameron --- tools/iio/iio_utils.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'tools') diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index 5eb6793f3972..7a6d61c6c012 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -121,10 +121,6 @@ int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used, ret = -ENOENT; while (ent = readdir(dp), ent) - /* - * Do we allow devices to override a generic name with - * a specific one? - */ if ((strcmp(builtname, ent->d_name) == 0) || (strcmp(builtname_generic, ent->d_name) == 0)) { ret = asprintf(&filename, @@ -178,6 +174,13 @@ int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used, sysfsfp = 0; free(filename); filename = 0; + + /* + * Avoid having a more generic entry overwriting + * the settings. + */ + if (strcmp(builtname, ent->d_name) == 0) + break; } error_close_sysfsfp: -- cgit v1.2.3-58-ga151