From d5679acf4b38db415bd25b0c3664d69cec5f43d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Boisnard?= Date: Wed, 31 Jul 2013 17:40:57 +0200 Subject: Fix issue in PFW when loading host libraries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: http://android.intel.com:8080/122812 Reviewed-by: Rocard, KevinX Reviewed-by: Gonzalve, Sebastien Tested-by: Dixon, CharlesX Reviewed-by: cactus Tested-by: cactus --- parameter/SystemClass.cpp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'parameter/SystemClass.cpp') 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-subsystem.so -// The plugin symbol is of the form: -// getSubsystemBuilder - +/** + * A plugin file name is of the form: + * lib-subsystem.so or lib-subsystem._host.so + * + * The plugin symbol is of the form: + * getSubsystemBuilder +*/ // 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); -- cgit v1.1