Fixes for assortment of memory leaks. Updated i2c_read/write_internal
methods to get the controller status ONLY when a read/write fails.
Signed-off-by: Noel Eck <noel.eck@intel.com>
* Fixed broken switch statement - missing 'case' in front of labels
* Added default case to switch statement
* Removed unused variable
* Removed unused static functions
* Attempted to fix cases where functions are returning/not returning
data incorrectly.
* Attempted to fix i2c read which was returning an
* uninitialized/unused variable.
Signed-off-by: Noel Eck <noel.eck@intel.com>
If numDevs is not == 2, the previous code would fail. If numDevs > 2
(example 1 ft2xx device connected and 1 ft4222 device in mode 3) then
the code would not initialize the FT4222 and give an error that the mode
must be 0 or 3.
Updated source to find the first index of a ft4222 device. Initialize
it as I2C. If another device of the same id exists, then initialize it
as GPIO.
Added more syslog messages for debugging.
Signed-off-by: Noel Eck <noel.eck@intel.com>
Add support for Hikey960 board from HiSilicon based on their Kirin960 SoC.
Peripherals supported:
1. GPIO
2. UART
3. I2C
For GPIO only Chardev interface has been added since this board only supports
>=4.15 kernel and using legacy sysfs interface is highly discouraged.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
The following APIs are only used for getting the line information from
kernel by opening the gpiochip independently and they fails to close
the file descriptor when done:
1. mraa_get_line_info_by_chip_number()
2. mraa_get_line_info_by_chip_name()
3. mraa_get_line_info_by_chip_label()
This will create issue if these API consumers like mraa_gpio_read_dir(),
mraa_gpio_mode(), mraa_gpio_chardev_dir() gets called in a loop. The
system will run out of file descriptor after some time.
Fix this issue by closing the opened file descriptors before freeing
the cinfo struct.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
Move the chardev enablement inside the platform check.
Some boards might not have the chardev mapping yet.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
The flag used for checking the kernel owned gpio line is GPIOLINE_FLAG_KERNEL.
Hence use that instead of GPIOLINE_FLAG_IS_OUT.
Flag used for checking the open source gpio line is GPIOLINE_FLAG_OPEN_SOURCE.
Hence use that instead of GPIOHANDLE_REQUEST_OPEN_SOURCE, which should be
only used when requesting lines.
Reported-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
As of now both Dragonboard410c and Hikey boards run latest LTS kernel.
Hence, adding chardev support for those.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
Fixes for possible NULL pointer dereferencing by C++ header methods.
Updated string methods to return an empty string.
Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit includes a set of small fixes flushed out from the google
unit tests.
* Fixed missing implementations of mraa_get_*_count methods.
* Fix for NULL string
* Fix for MOCK platform C++ define.
* Switched (void) -> () function definitions for consistency.
Signed-off-by: Noel Eck <noel.eck@intel.com>
Added Google Test for unit testing. Currently NOT required by
MRAA CMake.
* Added a test fixture for mraa common C header methods.
* Added a test fixture for mraa common C++ header methods.
Signed-off-by: Noel Eck <noel.eck@intel.com>
Added an additional job to the CI matrix which does a minimal mraa build
(only C) which can run and pass/fail quickly.
Signed-off-by: Noel Eck <noel.eck@intel.com>
Remove some _multiple functions and replace with generic function that
does both. Some general cleanup and will move more interrnal mraa
functions to use the _mraa prefix
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
SPI_IOC_RD_MAX_SPEED_HZ is often incorrect and too low (RPI, UP2, galileo g1 at
least). Likely this is because driver writers are too concious of possible
issues or because they don't have the final hardware. Because of this we now
will only LOG_NOTICE on exceeding SPI_IOC_RD_MAX_SPEED_HZ and try keep going
anyways. This effectively will put the burden of not exceeding
SPI_IOC_RD_MAX_SPEED_HZ on our users.
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
According to SonarCloud's email notification,
they're dropping sonarqube.com in favor of sonarcloud.io.
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Pinmap field value is an OS pin number, not mraa pin index,
so make the function return the proper one.
Fixes#817.
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Updates to the FindNodejs.cmake module to find newer installs of nodejs
across other distros. For example openSUSE: /usr/include/node6/node.h
* Added PATH_SUFFIX to find_path for node.h.
* Standardized usage of message() (added STATUS)
* Call find_package_handle_standard_args with version
* Reformatted to look uniform.
Signed-off-by: Noel Eck <noel.eck@intel.com>
this gets exposed on musl, on glibc endian.h gets pulled in indirectly
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>