tools: iio: make scale and offset files optional
authorJoo Aun Saw <jasaw@dius.com.au>
Thu, 23 Jul 2015 02:53:47 +0000 (12:53 +1000)
committerJonathan Cameron <jic23@kernel.org>
Thu, 23 Jul 2015 19:45:50 +0000 (20:45 +0100)
Make scale and offset optional by adding -ENOENT check as not all
drivers implement them.

Signed-off-by: Joo Aun Saw <jasaw@dius.com.au>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
tools/iio/iio_utils.c

index c3f9e37..1dcdf03 100644 (file)
@@ -487,7 +487,7 @@ int build_channel_array(const char *device_dir,
                                                       device_dir,
                                                       current->name,
                                                       current->generic_name);
-                       if (ret < 0)
+                       if ((ret < 0) && (ret != -ENOENT))
                                goto error_cleanup_array;
 
                        ret = iioutils_get_param_float(&current->offset,
@@ -495,7 +495,7 @@ int build_channel_array(const char *device_dir,
                                                       device_dir,
                                                       current->name,
                                                       current->generic_name);
-                       if (ret < 0)
+                       if ((ret < 0) && (ret != -ENOENT))
                                goto error_cleanup_array;
 
                        ret = iioutils_get_type(&current->is_signed,