mirror of git://git.sysmocom.de/ofono
plugin: Add debug support for external plugins
This commit is contained in:
parent
1d8ff99f75
commit
652b2d0c43
|
@ -23,6 +23,7 @@
|
||||||
#define __OFONO_PLUGIN_H
|
#define __OFONO_PLUGIN_H
|
||||||
|
|
||||||
#include <ofono/version.h>
|
#include <ofono/version.h>
|
||||||
|
#include <ofono/log.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -50,6 +51,8 @@ struct ofono_plugin_desc {
|
||||||
int priority;
|
int priority;
|
||||||
int (*init) (void);
|
int (*init) (void);
|
||||||
void (*exit) (void);
|
void (*exit) (void);
|
||||||
|
void *debug_start;
|
||||||
|
void *debug_stop;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,10 +72,15 @@ struct ofono_plugin_desc {
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
#define OFONO_PLUGIN_DEFINE(name, description, version, priority, init, exit) \
|
#define OFONO_PLUGIN_DEFINE(name, description, version, priority, init, exit) \
|
||||||
|
extern struct ofono_debug_desc __start___debug[] \
|
||||||
|
__attribute__ ((visibility("hidden"))); \
|
||||||
|
extern struct ofono_debug_desc __stop___debug[] \
|
||||||
|
__attribute__ ((visibility("hidden"))); \
|
||||||
extern struct ofono_plugin_desc ofono_plugin_desc \
|
extern struct ofono_plugin_desc ofono_plugin_desc \
|
||||||
__attribute__ ((visibility("default"))); \
|
__attribute__ ((visibility("default"))); \
|
||||||
struct ofono_plugin_desc ofono_plugin_desc = { \
|
struct ofono_plugin_desc ofono_plugin_desc = { \
|
||||||
#name, description, version, priority, init, exit \
|
#name, description, version, priority, init, exit, \
|
||||||
|
__start___debug, __stop___debug \
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,8 @@ static gboolean add_plugin(void *handle, struct ofono_plugin_desc *desc)
|
||||||
plugin->active = FALSE;
|
plugin->active = FALSE;
|
||||||
plugin->desc = desc;
|
plugin->desc = desc;
|
||||||
|
|
||||||
|
__ofono_log_enable(desc->debug_start, desc->debug_stop);
|
||||||
|
|
||||||
plugins = g_slist_insert_sorted(plugins, plugin, compare_priority);
|
plugins = g_slist_insert_sorted(plugins, plugin, compare_priority);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in New Issue