Age | Commit message (Collapse) | Author | Files | Lines |
|
UV index indicating strength of sunburn-producing ultraviolet (UV) radiation
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
All the ST Sensors use the old "<foo>-trigger" rather than the
standard "<foo>-devN" new standard suffix for triggers. Now much
to do about it since it is ABI, but make the testing tools
recognize it too.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
add recently added channel types and modifiers
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Currently if generic_buffer is invoked without first enabling any
channels in scan_elements/*_en, it will fail unable to enable the
buffer because bytes_per_datum inside the kernel will be zero if
no channels are available.
It is implied that the user of the program should enable channels
manually or with a script before executing generic_buffer.
Be more helpful by stopping execution if no enabled channels can
be found, and print a helptext that will tell you what is wrong
and what needs to be done.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
This makes the event monitor bail out with a helpful error
message if a device does not support events, as a related
fix to iio core now makes it return -ENODEV properly.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
commit acf50b3586f8d8a7530b905e111dda41876d38f4
"tools:iio:lsiio: add error handling"
introduced error handling of errors returned from
read_sysfs_string(), but with a simple if (retval),
missing the fact that these functions return a positive
value if the read was successful.
As a result lsiio regresses and does not show any
devices on my filesystem. Fix this by checking for
only negative error codes.
Cc: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Remove unnecessary double pointer from channel sorting function.
Signed-off-by: Joo Aun Saw <jasaw@dius.com.au>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
On error, caller's ci_array is freed and set to NULL to avoid
potential double free if some other user of this code is not
sufficiently careful. Counter is reset to zero for consistency.
Signed-off-by: Joo Aun Saw <jasaw@dius.com.au>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Signed-off-by: Joo Aun Saw <jasaw@dius.com.au>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Signed-off-by: Joo Aun Saw <jasaw@dius.com.au>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Running generic_buffer without enabling any channel of the
sensor will fail without printing any error message.
Add an error message that indicates buffer enable failed.
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
When the the sensor data uses 32 bits out of 32, generic_buffer prints
the value 0 for all data read.
In this case, the mask is shifted 32 bits, which is beyond the size of
an integer. This will lead to the mask always being 0. Before printing,
the mask is applied to the raw value, thus generating a final value of 0.
Fix the mask by shifting a 64 bit value instead of an integer.
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
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>
|
|
This patch indends to make some cleanup and send printf
error messages to stderr. The changes were performed with coccinelle
for failure messages and manual for other cases, such as wrong usage
messages.
Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Reviewed-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Calculation of the length of an array can be done with the ARRAY_SIZE
macro to make code more abstract and remove the associated
checkpatch.pl warning.
Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Single statement blocks don’t need braces.
Found with checkpatch.pl.
Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Remove explicit NULL comparison and write it in its simpler form as
recommended by checkpatch.pl.
Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Reviewed-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
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>
Reviewed-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Check that the read event is of the expected size.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Use more appropriate/common variable names:
* namepf instead of nameFile in iio_utils.c
* ret instead of retval in lsiio.c
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Fix various coding style issues, including:
* have spaces around operators
* indentation
* consolidate parameters in same line
* required braces
* adjust/drop comments
* multiline comment style
* delete unnecessary empty lines
* add empty lines to visualize logial code blocks
* typos
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Mark strings, which are not supposed to be changed (basedir, filename,
value), as const in function parameters.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
In generic_buffer.c: sort program parameters alphabetically and provide
usage information
In lsiio.c: drop unused parameters
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
In build_channel_array(), count can be initialized already during variable
declaration.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
In iioutils_get_type() it is logically better fitting to have sysfsfp
assigned zero right after closing it.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Change the assignment of *is_signed in iioutils_get_type() to a one-liner,
as already done with *be.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Refactor the code in print_event() to reduce code duplication and better
reflect that the type is output unconditionally, as well as cascade the
dependency of the diff-channel. Saves a few lines of code, as well.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Return directly, if no common cleanup is required.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Fully document public functions and elements.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Add error handling to calls which can indicate a major problem by
returning an error code.
This also involves to change the type of dump_devices() from void to int.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Add error handling to calls which can indicate a major problem by
returning an error code.
This also sets ret to -ENOENT in iioutils_get_type() and
iioutils_get_param_float() to indicate if no matching directory entry was
found.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Add error handling to calls which can indicate a major problem by
returning an error code.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Add error handling to calls which can indicate a major problem by
returning an error code.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Add handler to catch errors on conversion of numerical arguments.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
This patch catches errors in string allocation in generic_buffer.c,
iio_event_monitor.c, iio_utils.c and lsiio.c.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Functions _write_sysfs_int() and _write_sysfs_string() are supposed to
be called only by public wrappers, so make them static.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Previously, the return value of sscanf() was treated as an indication of
the digits it would have read. Yet, sscanf() only returns the amount of
valid matches.
Therefore, introduce a function to calculate the decimal digits of the
read number and use this one to commence a colon search, as originally
intended.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
fscanf() usually returns the number of input items successfully matched
and assigned, which can be fewer than provided (or even zero).
Add a check in iioutils_get_type() to make sure all items are matched.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Refactor process_scan() to handle signed and unsigned data, respect shifts
and the data mask for 2, 4 and 8 byte sized scan elements.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
find_type_by_name() returns a valid error code in case of an error. Pass
this code up instead of an artificial one.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Since errno contains the value of any of the defined error names, a
negation will not lead to the desired match.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Move up error handling code to preserve the errno coming from ioctl(),
before it may be changed by close().
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
The man-page of errno states, that errno should be saved before doing any
library call, as that call may have changed the value of errno. So, when
encountering any error, save errno first.
This patch affects generic_buffer.c, iio_event_monitor.c and iio_utils.c.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
In dump_channels() the DIR *dp was left open on exit. Close it and check
for errors.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
In build_channel_array(), count needs to be decreased in more places since
current->name and current->generic_name would be freed on the error path,
although they have not been allocated, yet.
This also requires to free current->name, when it is allocated, but
current->generic_name is not yet allocated.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
In iio_utils.c build_channel_array() dynamically allocates the string
generic_name in the current iio_channel_info, which doesn't got freed in
case of an error.
This dynamically allocated channel-array is used by generic_buffer, and
needs to be freed on the error/exit path.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
In the error path, the string scan_el_dir got freed, while it was missing when
build_channel_array() finished without errors.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Make sure to free dev_dir_name in case of an error or regular exit.
Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|