From 4355be5b4b712dc499145decb530e0f34a9f86f3 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Tue, 13 Jun 2017 12:08:28 +0200 Subject: [PATCH] some improvements for developing plugins --- doc/test-plugin.qdoc | 22 ++++++++++++++++++++++ doc/write-plugins.qdoc | 1 + libguh/devicemanager.cpp | 6 +++++- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 doc/test-plugin.qdoc diff --git a/doc/test-plugin.qdoc b/doc/test-plugin.qdoc new file mode 100644 index 00000000..53014cf3 --- /dev/null +++ b/doc/test-plugin.qdoc @@ -0,0 +1,22 @@ +/*! + \page test-plugin.html + \title Testing your plugin + \brief This page describes how to test your plugin that you've just created + + In order to make guhd load your plugin, you have 2 options. Either install it into the system or make guhd load it from your plugin build directory. + + To install the plugin into the system, run + \code + $ make install + \endcode + + To make guhd load the plugin from the plugins build directory, run guhd with an environment variable exported + \code + $ GUH_PLUGINS_DIR=/path/to/plugin/ guhd + \endcode + + In order to easier debug things, it is advised to enable debug output for the device manager and your plugin. E.g. + \code + $ GUH_PLUGINS_DIR=/path/to/plugin guhd -d DeviceManager,YourPlugin + \endcode +*/ diff --git a/doc/write-plugins.qdoc b/doc/write-plugins.qdoc index 292f5dcc..94d3ca7b 100644 --- a/doc/write-plugins.qdoc +++ b/doc/write-plugins.qdoc @@ -7,6 +7,7 @@ \li \l{Getting started} \li \l{The plugin JSON File} \li \l{CreateMethods and SetupMethods} + \li \l{Testing your plugin} \li \l{Tutorials} \list \li \l{Tutorial 1 - The "Minimal" plugin} diff --git a/libguh/devicemanager.cpp b/libguh/devicemanager.cpp index 3a7b0fd6..08fc7c9b 100644 --- a/libguh/devicemanager.cpp +++ b/libguh/devicemanager.cpp @@ -257,6 +257,10 @@ DeviceManager::~DeviceManager() QStringList DeviceManager::pluginSearchDirs() { QStringList searchDirs; + QByteArray envPath = qgetenv("GUH_PLUGINS_PATH"); + if (!envPath.isEmpty()) { + searchDirs << envPath; + } searchDirs << QCoreApplication::applicationDirPath() + "/../lib/guh/plugins"; searchDirs << QCoreApplication::applicationDirPath() + "/../plugins/"; searchDirs << QCoreApplication::applicationDirPath() + "/../plugins/deviceplugins"; @@ -1025,7 +1029,7 @@ void DeviceManager::loadPlugins() loader.setLoadHints(QLibrary::ResolveAllSymbolsHint); if (!loader.load()) { - qCWarning(dcDeviceManager) << "Could not load plugin data of" << entry; + qCWarning(dcDeviceManager) << "Could not load plugin data of" << entry << "\n" << loader.errorString(); continue; }