summaryrefslogtreecommitdiffstats
path: root/parameter/SystemClass.cpp
diff options
context:
space:
mode:
authorFrédéric Boisnard <fredericx.boisnard@intel.com>2013-07-31 17:40:57 +0200
committerDavid Wagner <david.wagner@intel.com>2014-02-12 17:04:05 +0100
commitd5679acf4b38db415bd25b0c3664d69cec5f43d4 (patch)
treea6f6e99eab7f98dffc8d4ec36c908e88d6fdb104 /parameter/SystemClass.cpp
parentdfbd7a605fa30c03b5e4be7e64bfd2deba64e64b (diff)
downloadexternal_parameter-framework-d5679acf4b38db415bd25b0c3664d69cec5f43d4.zip
external_parameter-framework-d5679acf4b38db415bd25b0c3664d69cec5f43d4.tar.gz
external_parameter-framework-d5679acf4b38db415bd25b0c3664d69cec5f43d4.tar.bz2
Fix issue in PFW when loading host libraries
BZ: 127874 Default entry point for plugins libraries must follow the pattern "lib*-subsystem.so". However, when compiling on host, the plugins are named "lib*-subsystem_host.so", so the PFW is unable to load them. This patch modifies the way plugins symbols are detected, so that host libraries can be loaded successfully. Change-Id: I079162c3e47a975641b3d7cb1fc054f95c86028e Signed-off-by: Frédéric Boisnard <fredericx.boisnard@intel.com> Reviewed-on: http://android.intel.com:8080/122812 Reviewed-by: Rocard, KevinX <kevinx.rocard@intel.com> Reviewed-by: Gonzalve, Sebastien <sebastien.gonzalve@intel.com> Tested-by: Dixon, CharlesX <charlesx.dixon@intel.com> Reviewed-by: cactus <cactus@intel.com> Tested-by: cactus <cactus@intel.com>
Diffstat (limited to 'parameter/SystemClass.cpp')
-rw-r--r--parameter/SystemClass.cpp31
1 files changed, 18 insertions, 13 deletions
diff --git a/parameter/SystemClass.cpp b/parameter/SystemClass.cpp
index 56bc489..98917d7 100644
--- a/parameter/SystemClass.cpp
+++ b/parameter/SystemClass.cpp
@@ -36,14 +36,16 @@
#define base CConfigurableElement
-// A plugin file name is of the form:
-// lib<type>-subsystem.so
-// The plugin symbol is of the form:
-// get<TYPE>SubsystemBuilder
-
+/**
+ * A plugin file name is of the form:
+ * lib<type>-subsystem.so or lib<type>-subsystem._host.so
+ *
+ * The plugin symbol is of the form:
+ * get<TYPE>SubsystemBuilder
+*/
// Plugin file naming
-const char* gpcPluginPattern = "-subsystem.so";
-const char* gpcLibraryPrefix = "lib";
+const char* gpcPluginSuffix = "-subsystem";
+const char* gpcPluginPrefix = "lib";
// Plugin symbol naming
const char* gpcPluginSymbolPrefix = "get";
@@ -142,14 +144,17 @@ bool CSystemClass::loadSubsystems(string& strError, const CSubsystemPlugins* pSu
string CSystemClass::getPluginSymbol(const string& strPluginPath)
{
// Extract plugin type out of file name
- string strPluginPattern = gpcPluginPattern;
- string strLibraryPrefix = gpcLibraryPrefix;
+ string strPluginSuffix = gpcPluginSuffix;
+ string strPluginPrefix = gpcPluginPrefix;
+
+ // Remove folder and library prefix
+ size_t iPluginTypePos = strPluginPath.rfind('/') + 1 + strPluginPrefix.length();
- // Remove folder
- int32_t iSlashPos = strPluginPath.rfind('/') + 1 + strLibraryPrefix.length();
+ // Get index of -subsystem.so or -subsystem_host.so suffix
+ size_t iSubsystemPos = strPluginPath.find(strPluginSuffix, iPluginTypePos);
- // Get type
- string strPluginType = strPluginPath.substr(iSlashPos, strPluginPath.length() - iSlashPos - strPluginPattern.length());
+ // Get type (between iPluginTypePos and iSubsystemPos)
+ string strPluginType = strPluginPath.substr(iPluginTypePos, iSubsystemPos - iPluginTypePos);
// Make it upper case
std::transform(strPluginType.begin(), strPluginType.end(), strPluginType.begin(), ::toupper);