Noel Eck
65e30bf7d3
iio: Allow mraa_iio_trigger_buffer to handle void* args
...
Previously, mraa_iio_trigger_buffer took a void* args but did not use
this. Included implementation to allow user to pass a void* to this
method and have the corresponding pointer returned in the interrupt
handler.
Signed-off-by: Noel Eck <noel.eck@intel.com >
2017-08-30 14:14:41 -07:00
Alex Tereschenko
816be65ba0
gpio.c,aio.c,iio.c: misc fixes of static code analysis findings
...
SonarQube is awesome!
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com >
2017-05-18 20:41:51 +02:00
Alex Tereschenko
0654183b9a
stability: replace sprintf with snprintf to avoid potential overflows
...
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com >
2017-05-15 21:04:18 +02:00
Brendan Le Foll
6c85b61daa
mraa: Fix compiler warnings unused vars and useless statements
...
Should have 0 functionality effect, just cleans up a few things. Fixes #577
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2016-09-13 11:20:41 +01:00
Alex Tereschenko
1af737f3d9
mock: mraa with mock platform now works in Windows under MSYS2
...
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2016-07-05 19:32:58 +01:00
Lay, Kuan Loon
de0543923c
iio: mount matrix compliant to IIO core kernel standard
...
IIO mount matrix is supported in kernel version 4.6.
Change mraa_iio_get_mount_matrix to take in one more parameter
‘mount matrix sysfs entry name’, because different sensor driver
may expose different mount matrix sysfs entry.
Following link explain the mount matrix usage and sysfs entry:
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-iio
Signed-off-by: Lay, Kuan Loon <kuan.loon.lay@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2016-06-29 10:02:08 +01:00
Alexandru Timohi
828338a69a
libmraa: Fix compilation warnings about unsigned ints
...
Make better use of unsigned/signed ints, signed ints are preffered unless there
is a good reason not to.
Signed-off-by: Alexandru Timohi <alexandru.timohi@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2016-05-19 11:50:33 +01:00
Brendan Le Foll
3969af2b24
iio.c: Fix the location mapping in iio
...
Go through channel array after getting byte mapping to correctly map channel
location. Doing it at the same time as mapping the indexes is unreliable
depending on filename etc...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2016-05-16 12:31:47 +01:00
Constantin Musca
caebb8b1fb
iio: guard pthread_setcancelstate with HAVE_PTHREAD_CANCEL
...
Signed-off-by: Constantin Musca <constantin.musca@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2016-01-20 11:15:41 +00:00
Brendan Le Foll
ea183b3738
iio.c: Fix indentation
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-21 15:49:08 +00:00
Brendan Le Foll
d4b32ec1c5
iio.c: Check return of fscanf
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-21 15:48:44 +00:00
Brendan Le Foll
e98bd8653a
iio.c: Check return of fd before using ioctl
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-21 15:48:28 +00:00
Brendan Le Foll
ff34651325
iio.c: Replace sprintf with snprintf
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-21 15:48:02 +00:00
Brendan Le Foll
58cf292dfc
iio.c: Closedir correctly and return error if we fail to read from the device dir
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-21 15:38:20 +00:00
Brendan Le Foll
15e400eaf2
iio.c: Fix leaking filedescriptor on read error
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-21 15:37:37 +00:00
Brendan Le Foll
8862ebd9f2
mraa: Remove trailing whitespace/tabs from various parts
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-21 15:27:15 +00:00
Brendan Le Foll
79609ba359
mraa: Remove executable bit from a few files
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-21 15:23:30 +00:00
Brendan Le Foll
725ce5e946
iioc.: remove call to stat before mkdir as superflous
...
This is especailly true since we don't care about the outcome, or do we? We
probably should check errno for EEXIST and offer an error if the error is
something else
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-21 15:16:10 +00:00
Brendan Le Foll
fd531abd3d
iio.c: Avoid reading uninitialised memory in cases of error
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-21 15:15:51 +00:00
Brendan Le Foll
f4385a8b82
iio: Check fd against != -1 and not > 0 and avoid leaks during error handling
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-21 15:15:15 +00:00
Brendan Le Foll
ee69045ea8
iio.c: Fix closedir not always been called leaving to leaked handles
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-21 15:12:55 +00:00
Lay, Kuan Loon
d5233adbf9
iio.c: fix memory leak and out of bound array access issue
...
Fix memory leak in mraa_iio_update_channels() and mraa_iio_get_channel_data().
In mraa_iio_update_channels(), we add checking for out of bound array access.
Signed-off-by: Lay, Kuan Loon <kuan.loon.lay@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-17 11:28:26 +00:00
Henry Bruce
8e4a809f12
iio: C API changes and C++ API enhancements
...
- C API read/write integer functions changed to int to match C types
- C API now has close function to release resources acquired during init
- iio internal type isr_event() function now has args param in signature
- C++ API now supports events with handler interface and new data structure
- C and C++ examples updated to use API changes
Signed-off-by: Henry Bruce <henry.bruce@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:14 +00:00
Brendan Le Foll
6a85c57c06
iio.c: Fix missing include file sys/stat.h
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Brendan Le Foll
924f4b4799
iio.c: Use sys/ioctl.h instead of stropts.h
...
Closes #377
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Henry Bruce
11211936b6
iio: Fixed device id check bug
...
Signed-off-by: Henry Bruce <henry.bruce@intel.com >
2015-12-15 10:42:06 +00:00
Henry Bruce
ae80d4afc8
iio: Isolated use of open() to string read/write functions.
...
Signed-off-by: Henry Bruce <henry.bruce@intel.com >
2015-12-15 10:42:06 +00:00
Henry Bruce
fbfe3e315f
iio: mraa_iio_write_string now using open insteam of fopen
...
Signed-off-by: Henry Bruce <henry.bruce@intel.com >
2015-12-15 10:42:06 +00:00
Lay, Kuan Loon
3750e2cfa2
iio: iio update channel
...
Signed-off-by: Lay, Kuan Loon <kuan.loon.lay@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Lay, Kuan Loon
e7e58509f0
iio: iio add create trigger
...
Signed-off-by: Lay, Kuan Loon <kuan.loon.lay@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Lay, Kuan Loon
8d7c0722ab
iio: iio get mounting matrix remove unused variable and proper file close
...
Signed-off-by: Lay, Kuan Loon <kuan.loon.lay@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Lay, Kuan Loon
0bd1ab2c53
iio: iio add get mounting matrix
...
Signed-off-by: Lay, Kuan Loon <kuan.loon.lay@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Lay, Kuan Loon
edb7f8a215
iio: iio consolidate read and write API
...
Signed-off-by: Lay, Kuan Loon <kuan.loon.lay@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Brendan Le Foll
219632a1b8
iio.c: run clang format on iio.c
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Brendan Le Foll
8a548de8ae
iio.c: add stropts.h include for iotctl
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Brendan Le Foll
069985641e
iio.c: Use MAX_SIZE var upgrading strings to 128 from 64
...
Fix inspired by Lay's PR #342 but doesn't use magic numbers
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Lay, Kuan Loon
657f28a67d
iio: trigger buffer samples fix
...
Signed-off-by: Lay, Kuan Loon <kuan.loon.lay@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Lay, Kuan Loon
2df28fa883
iio: iio get channel and get event error checking
...
Signed-off-by: Lay, Kuan Loon <kuan.loon.lay@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Lay, Kuan Loon
7a55a1384a
iio: added mraa_iio_write
...
Signed-off-by: Lay, Kuan Loon <kuan.loon.lay@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Brendan Le Foll
dc240913c7
iio: remove exec perms
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Lay, Kuan Loon
4c41d2c2df
iio: added event api
...
Signed-off-by: Lay, Kuan Loon <kuan.loon.lay@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Alex Tereschenko
325ac461d6
iio: added function returning IIO device number by name
...
Closes #309 .
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Brendan Le Foll
65614f5f58
iio: Remove iio structures from mraa_platform_t
...
This means that a valid platform is no longer required for iio operations and
therefore this is now only a req for using USBPLAT
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Brendan Le Foll
acfb74f04e
iio: Improve iio channel parsing to add enabled channels
...
scale and other attributes have to be read individually as they vary quite alot
depending on the channel. We only care/take data from scan_elements
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Brendan Le Foll
2c97fd5953
iio: initial pass at getting channel information from scan_elements
...
This commit creates a new structure inside each _iio device when used and can
then be used to understand the data being read after a trigger is run/executed
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Brendan Le Foll
2b9e832ff9
iio: Simplify API
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Brendan Le Foll
d8c2c7c483
iio: Find attributes and channels in iio device
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Brendan Le Foll
d920d136ea
iio: initial API and enumeration of devices
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00
Brendan Le Foll
0f312545e0
iio: Add initial module
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-12-15 10:42:06 +00:00