Private
Public Access
2
0

ft4222: move calls to libft4222.so to use dlopen

Makes the lib a runtime only dependency

Signed-off-by: Thomas Ingleby <thomas.ingleby@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Thomas Ingleby
2016-02-14 17:04:31 +01:00
committed by Brendan Le Foll
parent 441a24aaea
commit 7f78b6760f
4 changed files with 86 additions and 35 deletions

View File

@@ -36,14 +36,20 @@ mraa_usb_platform_extender(mraa_board_t* board)
{
mraa_board_t* sub_plat = NULL;
mraa_platform_t platform_type = MRAA_UNKNOWN_PLATFORM;
#ifdef FTDI4222
if (mraa_ftdi_ft4222_init() == MRAA_SUCCESS) {
unsigned int versionChip, versionLib;
if (mraa_ftdi_ft4222_get_version(&versionChip, &versionLib) == MRAA_SUCCESS) {
// TODO: Add ft4222 version checks
platform_type = MRAA_FTDI_FT4222;
libft4222_lib = dlopen("libft4222.so", RTLD_LAZY);
if (!libft4222_lib) {
syslog(LOG_WARNING, "libft4222.so not found, skipping");
} else {
if (mraa_ftdi_ft4222_init() == MRAA_SUCCESS) {
unsigned int versionChip, versionLib;
if (mraa_ftdi_ft4222_get_version(&versionChip, &versionLib) == MRAA_SUCCESS) {
// TODO: Add ft4222 version checks
platform_type = MRAA_FTDI_FT4222;
}
}
}
}
#endif
switch (platform_type) {
#ifdef FTDI4222
@@ -62,4 +68,3 @@ mraa_usb_platform_extender(mraa_board_t* board)
}
return platform_type;
}