Brendan Le Foll
effc813e42
mraa.c: fix possible overrun in strncpy
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-09-18 11:57:41 +01:00
Brendan Le Foll
32aa4310c8
mraa.c: simplify mraa_get_platform_name with subplatforms
...
This removes the chance of buffer overflow with a subplatform
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-09-18 11:52:52 +01:00
Brendan Le Foll
07343e2ee7
mraa: Remove global advance_func struct and place it in platform configuration
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-09-08 14:42:04 +01:00
Henry Bruce
3e76bee085
api: Added API calls that support both main and sub platforms
...
Signed-off-by: Henry Bruce <henry.bruce@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-09-08 14:42:04 +01:00
Brendan Le Foll
570fba9463
mraa.c: usb MRAA_UNKNOWN_PLATFORM is not considered initialisation
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-09-08 14:42:04 +01:00
Brendan Le Foll
4757d039ab
mraa.c: Fix current_plat being invalid but not NULL
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-09-08 14:42:04 +01:00
Henry Bruce
4031124081
api: Renamed some sub-platform API calls.
...
Signed-off-by: Henry Bruce <henry.bruce@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-09-08 14:42:04 +01:00
Brendan Le Foll
7c5972ad15
mraa.c: use #if defined() for platforms
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-09-08 14:42:03 +01:00
Henry Bruce
c9cfb42326
mraa.c: Fixed bug in detected main/sub platform name and type logging
...
Signed-off-by: Henry Bruce <henry.bruce@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-09-08 14:42:03 +01:00
Henry Bruce
33645791af
api: Added mraa_has_sub_platform() function
...
Signed-off-by: Henry Bruce <henry.bruce@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-09-08 14:42:03 +01:00
Henry Bruce
7058fea8bd
mraa.c: Added mainn and sub-platform select API calls.
...
Signed-off-by: Henry Bruce <henry.bruce@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-09-08 14:42:03 +01:00
Henry Bruce
99593ec640
usb: USB sub-platform bug fixes.
...
Signed-off-by: Henry Bruce <henry.bruce@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-09-08 14:42:03 +01:00
Henry Bruce
13118e949b
api: Added mraa_get_sub_platform_type()
...
Signed-off-by: Henry Bruce <henry.bruce@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-09-08 14:42:03 +01:00
Henry Bruce
5740e46ae0
x86: advance_func now stored in mraa_board_t instance
...
Signed-off-by: Henry Bruce <henry.bruce@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-09-08 14:42:03 +01:00
Henry Bruce
7ada55982d
platform_type: platform_type now in mraa_board_t
...
Now platform_type is no longer global it tracks with board instance
so that platform and sub-platform can report different types.
Signed-off-by: Henry Bruce <henry.bruce@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-09-08 14:42:03 +01:00
Henry Bruce
4a6bf832bc
usb: Converted sub-platform bus/pin helper macros to functions.
...
Signed-off-by: Henry Bruce <henry.bruce@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-09-08 14:42:03 +01:00
Brendan Le Foll
e353508e30
cmake: add -DFTDID2xx and use FindFtd2xx.cmake
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-09-08 14:42:03 +01:00
Brendan Le Foll
e170e21031
mraa.c: subplatforms need to be defined after platforms
...
This also means arm subplatforms can work and removes a plat == NULL check
which will never be true if -DUSBPLAT=ON
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-09-08 14:42:03 +01:00
Henry Bruce
8f48df0533
usb: Skeleton platform code for FTDI FT4222 USB to i2c bridge
...
Signed-off-by: Henry Bruce <henry.bruce@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-09-08 14:42:03 +01:00
Yong Li
02399b61f9
mraa.c: Add new API to support I2C bus number query
...
Add two new API to get the usable I2C bus count and related I2C adapter number
Signed-off-by: Yong Li <yong.b.li@intel.com >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-08-25 11:36:14 +01:00
Brendan Le Foll
5d24868582
mraa.c: Fix close/free fail introduced earlier
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-08-20 19:09:42 +01:00
Brendan Le Foll
0ad753689e
mraa.c: Fix error handing resource leaks in mraa_file_contains_*
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-08-14 15:36:50 +01:00
Brendan Le Foll
8269340c25
mraa.c: log level syslog messages
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-08-14 11:15:57 +01:00
Brendan Le Foll
45133922aa
mraa.c: Fix ressource leaks during error handling
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-08-13 15:25:59 +01:00
Brendan Le Foll
5717bba0d4
mraa.c: fix ARMPLAT elif not being done on define like if statement
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-07-24 14:04:47 +01:00
Brendan Le Foll
a5d13670f4
mraa.c: Fix buffer overfow in mraa_find_i2c_bus
...
All files in sysfs are 4K minimum so allocate a 4k buffer to hold the result -
even if it'll never be that big
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-07-15 13:50:29 +01:00
Brendan Le Foll
df0dbb0c73
mraa: add internal mraa_find_i2c_bus function
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-07-10 11:11:41 +01:00
Brendan Le Foll
76a34afe84
mraa.c: Fix readlink call not terminating its buffer
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-07-01 10:59:03 +01:00
Michael Ring
095ff894a7
mraa.c: Remove mraa_init() from mraa_pin_mode_test
...
If platform is not initalised at this stage then there is no need to attempt
again
Signed-off-by: Michael Ring <mail@michael-ring.org >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-04-08 22:19:14 +01:00
Michael Ring
bff7b558eb
mraa.c: Add _contains helper functions
...
Signed-off-by: Michael Ring <mail@michael-ring.org >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-04-08 22:19:14 +01:00
Michael Ring
d2fcadc8d5
mraa.c: change helper functions to use const char*
...
Signed-off-by: Michael Ring <mail@michael-ring.org >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-04-08 22:19:14 +01:00
Brendan Le Foll
ffcf3d7d07
clang-format: run clang-format on C/C++ code
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-03-23 15:15:48 +00:00
Michael Ring
827e1974bf
api/mraa: add mraa_get_pin_name
...
Add mraa_get_pin_name to get the real world name of the pin.
Signed-off-by: Michael Ring <mail@michael-ring.org >
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com >
2015-03-19 00:16:32 +00:00
Brendan Le Foll
76ffa35cec
mraa.c: stop C constructor calling mraa_init() in SWIG builds
...
Closes #65
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-03-01 10:22:14 +00:00
Michael Ring
8e305a1032
mraa.c added internal helper functions to support globbing and link analysis
...
Signed-off-by: Michael Ring <mail@michael-ring.org >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-02-15 22:38:36 +00:00
Thomas Ingleby
459ecc0c1c
src/mraa.c: mux mapped
...
Don't own gpio of muxes, so it isnt unexported.
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com >
2015-02-05 16:20:09 +00:00
Brendan Le Foll
8ccefe95e5
Revert "setup_mux_mapped: use HIGH/LOW instead"
...
This reverts commit 6c73a8adce as it breaks
galileo gen1 muxing.
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-02-05 15:17:50 +00:00
Brendan Le Foll
baa1a0ae03
mraa.c: Allow running mraa_init() as non root
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-01-31 09:26:24 +00:00
Alex Tereschenko
82bb1c573d
mraa: we now log version and user ID into syslog upon init
...
Closes #98 .
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com >
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com >
2015-01-26 15:09:47 +00:00
Thomas Ingleby
6c73a8adce
setup_mux_mapped: use HIGH/LOW instead
...
Avoids on some platforms where when setting a mux will set it low when
it wouldn't be safe to.
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com >
2015-01-22 17:40:16 +00:00
Thomas Ingleby
e8bc227a92
api/platform_name: Change return when null platform
...
Easier to error check against
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com >
2015-01-21 15:39:29 +00:00
Thomas Ingleby
53a9a7dce4
internal/platform_name: move to const char*
...
Instead of plain char* to avoid need to malloc and do all the needed
error checking needed that goes along with that.
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com >
2015-01-21 15:35:54 +00:00
Thomas Ingleby
067487f9ec
mraa/platform: add mraa_get_pin_count()
...
Will return physical pin count.
Closes #75
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com >
2015-01-21 15:17:34 +00:00
Thomas Ingleby
ed4c68eba1
uart: cleanup and bring inline with standard
...
Removed mraa_setup_uart from core mraa.c moved logic within init
function
Add more syslog output for easier debugging.
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com >
2015-01-20 14:44:28 +00:00
Philippe Coval
17ee0c9669
mraa.c: fix FTBFS on printf by adding format
...
gcc-4.8.2 fails to build from source and complains :
error: format not a string literal and no format arguments
Signed-off-by: Philippe Coval <philippe.coval@open.eurogiciel.org >
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-01-12 18:12:37 +00:00
Brendan Le Foll
d6bbd0bf38
mraa.c: fix missing break statement in case switch
...
Missing in mraa_pin_mode_test causes an erroneous syslog message. Fixes #86
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2015-01-05 23:04:50 +00:00
Brendan Le Foll
2574efdb1d
mraa.c: mraa_pin_mode_test should check against b->gpio_count -1
...
It's already the case for rpi & MMAX but it should be noted that on 1 indexed
boards gpio_count should be +1
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2014-12-18 14:28:36 +00:00
Brendan Le Foll
1ee5e25f85
mraa.c: add syslog msg in case we get an unknown pinmode
...
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2014-12-18 14:13:04 +00:00
Brendan Le Foll
a769f78e83
mraa.c: fix uart mraa_pin_mode_test
...
switch statement was missing a clause for MRAA_PIN_UART meaning it always
returned False
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2014-12-18 14:11:27 +00:00
Brendan Le Foll
d58adefa3c
mraa.c: fix aio mraa_pin_mode_test
...
test was adding board gpio_count to pin so that 0 would use the info for pin 14
on some boards when asking for aio capability
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com >
2014-12-18 14:07:59 +00:00