forked from enlightenment/enlightenment
Use eina_log on econnman
Registry domain 'econnman' and log messages with eina_log instead of casual printfs. By: Lucas De Marchi <lucas.demarchi@profusion.mobi> SVN revision: 46130
This commit is contained in:
parent
e71c7d1453
commit
5a60848741
|
@ -80,11 +80,11 @@ _connman_service_move_cb(void *data, DBusMessage *msg __UNUSED__, DBusError *err
|
||||||
struct connman_service_move_data *d = data;
|
struct connman_service_move_data *d = data;
|
||||||
if (error && dbus_error_is_set(error))
|
if (error && dbus_error_is_set(error))
|
||||||
{
|
{
|
||||||
_connman_dbus_error_show(__func__, error);
|
ERR("%s method failed with message \'%s\'", error->name, error->message);
|
||||||
dbus_error_free(error);
|
dbus_error_free(error);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printf("Changed service order");
|
DBG("Changed service order");
|
||||||
|
|
||||||
eina_stringshare_del(d->service_ref_path);
|
eina_stringshare_del(d->service_ref_path);
|
||||||
eina_stringshare_del(d->service_path);
|
eina_stringshare_del(d->service_path);
|
||||||
|
@ -105,8 +105,7 @@ _connman_service_move(E_Connman_Service *service, const E_Connman_Service *servi
|
||||||
d->service_path = eina_stringshare_ref(service->path);
|
d->service_path = eina_stringshare_ref(service->path);
|
||||||
d->ctxt = service->ctxt;
|
d->ctxt = service->ctxt;
|
||||||
|
|
||||||
printf("DBG CONNMAN Move %s %s %s\n", d->service_path, direction==SERVICE_MOVE_UP?"before":"after", d->service_ref_path);
|
DBG("Try to move %s %s %s\n", d->service_path, direction==SERVICE_MOVE_UP?"before":"after", d->service_ref_path);
|
||||||
|
|
||||||
if (direction == SERVICE_MOVE_UP)
|
if (direction == SERVICE_MOVE_UP)
|
||||||
ret = e_connman_service_move_before(service->element, d->service_ref_path, _connman_service_move_cb, d);
|
ret = e_connman_service_move_before(service->element, d->service_ref_path, _connman_service_move_cb, d);
|
||||||
else
|
else
|
||||||
|
@ -134,7 +133,7 @@ _connman_technology_onoff_cb(void *data, DBusMessage *msg __UNUSED__, DBusError
|
||||||
struct _connman_technology_onoff_data *d = data;
|
struct _connman_technology_onoff_data *d = data;
|
||||||
if (error && dbus_error_is_set(error))
|
if (error && dbus_error_is_set(error))
|
||||||
{
|
{
|
||||||
_connman_dbus_error_show(__func__, error);
|
ERR("%s method failed with message \'%s\'.", error->name, error->message);
|
||||||
dbus_error_free(error);
|
dbus_error_free(error);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -142,13 +141,13 @@ _connman_technology_onoff_cb(void *data, DBusMessage *msg __UNUSED__, DBusError
|
||||||
/* TODO: update config dialog */
|
/* TODO: update config dialog */
|
||||||
E_Connman_Technology *t;
|
E_Connman_Technology *t;
|
||||||
t = _connman_technology_find(d->ctxt, d->name);
|
t = _connman_technology_find(d->ctxt, d->name);
|
||||||
if (!t)
|
if (t)
|
||||||
{
|
{
|
||||||
printf("DBG CONNMAN Technology does not exist anymore\n", d->name);
|
t->enabled = d->on;
|
||||||
return;
|
DBG("Technology %s has been %s.", d->name, d->on?"enabled":"disabled");
|
||||||
}
|
}
|
||||||
t->enabled = d->on;
|
else
|
||||||
printf("Technology %s has been %s\n", d->name, d->on?"enabled":"disabled");
|
WRN("Technology does not exist anymore: %s.", d->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
eina_stringshare_del(d->name);
|
eina_stringshare_del(d->name);
|
||||||
|
@ -333,7 +332,7 @@ _networks_fill_details(E_Config_Dialog_Data *cfdata, Evas_Object *list, int sel)
|
||||||
service = _connman_ctxt_find_service_stringshare(ctxt, cfdata->selected_network);
|
service = _connman_ctxt_find_service_stringshare(ctxt, cfdata->selected_network);
|
||||||
if (!service)
|
if (!service)
|
||||||
{
|
{
|
||||||
printf("ERROR: service not found: %s\n", cfdata->selected_network);
|
ERR("service not found: %s.", cfdata->selected_network);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
e_widget_label_text_set(ui->lb_autoconn_val, service->auto_connect?"True":"False");
|
e_widget_label_text_set(ui->lb_autoconn_val, service->auto_connect?"True":"False");
|
||||||
|
@ -556,16 +555,10 @@ _basic_apply(E_Config_Dialog *dialog, E_Config_Dialog_Data *cfdata)
|
||||||
EINA_INLIST_FOREACH(sw->technologies, t)
|
EINA_INLIST_FOREACH(sw->technologies, t)
|
||||||
{
|
{
|
||||||
if (t->val != t->technology->enabled)
|
if (t->val != t->technology->enabled)
|
||||||
{
|
_connman_technology_onoff(ctxt, t->technology->name, t->val);
|
||||||
_connman_technology_onoff(ctxt, t->technology->name, t->val);
|
|
||||||
PRINT_VAR_NAME_VAL_INT ("DBG CONNMAN ", t->val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (ctxt->offline_mode != sw->offline_mode)
|
if (ctxt->offline_mode != sw->offline_mode)
|
||||||
{
|
_connman_toggle_offline_mode(ctxt);
|
||||||
_connman_toggle_offline_mode(ctxt);
|
|
||||||
PRINT_VAR_NAME_VAL_INT ("DBG CONNMAN ", sw->offline_mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ static char tmpbuf[PATH_MAX]; /* general purpose buffer, just use immediately */
|
||||||
|
|
||||||
const char _e_connman_name[] = "connman";
|
const char _e_connman_name[] = "connman";
|
||||||
const char _e_connman_Name[] = "Connection Manager";
|
const char _e_connman_Name[] = "Connection Manager";
|
||||||
|
int _e_connman_log_dom = -1;
|
||||||
|
|
||||||
static const char *e_str_idle = NULL;
|
static const char *e_str_idle = NULL;
|
||||||
static const char *e_str_association = NULL;
|
static const char *e_str_association = NULL;
|
||||||
|
@ -364,7 +365,7 @@ _connman_service_changed(void *data, const E_Connman_Element *element)
|
||||||
(!service->ctxt->default_service))
|
(!service->ctxt->default_service))
|
||||||
_connman_default_service_changed_delayed(service->ctxt);
|
_connman_default_service_changed_delayed(service->ctxt);
|
||||||
else
|
else
|
||||||
printf("DBG CONNMAN: do not request for delayed changed as this is not the default.\n");
|
DBG("Do not request for delayed changed as this is not the default.");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -682,7 +683,7 @@ _connman_technologies_enabled_update()
|
||||||
(&_connman_enabled_technologies.count, &_connman_enabled_technologies.names);
|
(&_connman_enabled_technologies.count, &_connman_enabled_technologies.names);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
printf("DBG CONNMAN enabled technologies?\n");
|
WRN("Failed to query enabled technologies.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -694,17 +695,18 @@ _connman_technology_enabled(const char *type)
|
||||||
int i;
|
int i;
|
||||||
if (!_connman_enabled_technologies.names && !_connman_technologies_enabled_update())
|
if (!_connman_enabled_technologies.names && !_connman_technologies_enabled_update())
|
||||||
return 0;
|
return 0;
|
||||||
printf("DBG CONNMAN %d technologies enabled\n", _connman_enabled_technologies.count);
|
DBG("%d technologies enabled.", _connman_enabled_technologies.count);
|
||||||
printf("DBG CONNMAN technology enabled: %s", type);
|
|
||||||
for (i = 0; i < _connman_enabled_technologies.count; i++)
|
for (i = 0; i < _connman_enabled_technologies.count; i++)
|
||||||
{
|
{
|
||||||
if(!strcmp(type, _connman_enabled_technologies.names[i]))
|
if(!strcmp(type, _connman_enabled_technologies.names[i]))
|
||||||
{
|
{
|
||||||
printf(" ... yes\n");
|
DBG("Technology %s is enabled.", type);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
printf(" ... no\n");
|
DBG("Technology %s is disabled.", type);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -724,8 +726,11 @@ _connman_technologies_free(E_Connman_Module_Context *ctxt)
|
||||||
void
|
void
|
||||||
_connman_request_scan_cb(void *data __UNUSED__, DBusMessage *msg __UNUSED__, DBusError *error)
|
_connman_request_scan_cb(void *data __UNUSED__, DBusMessage *msg __UNUSED__, DBusError *error)
|
||||||
{
|
{
|
||||||
if (dbus_error_is_set(error))
|
if (error && dbus_error_is_set(error))
|
||||||
_connman_dbus_error_show(__func__, error);
|
{
|
||||||
|
ERR("%s method failed with message \'%s\'", error->name, error->message);
|
||||||
|
dbus_error_free(error);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -739,7 +744,7 @@ _connman_technologies_load(E_Connman_Module_Context *ctxt)
|
||||||
if (!e_connman_manager_technologies_available_get(&count, &names))
|
if (!e_connman_manager_technologies_available_get(&count, &names))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
printf("DBG CONNMAN technologies = %d\n", count);
|
DBG("Available Technologies = %d.", count);
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
const char *name = eina_stringshare_add(names[i]);
|
const char *name = eina_stringshare_add(names[i]);
|
||||||
|
@ -753,12 +758,13 @@ _connman_technologies_load(E_Connman_Module_Context *ctxt)
|
||||||
t = E_NEW(E_Connman_Technology, 1);
|
t = E_NEW(E_Connman_Technology, 1);
|
||||||
t->name = name;
|
t->name = name;
|
||||||
t->enabled = _connman_technology_enabled(name);
|
t->enabled = _connman_technology_enabled(name);
|
||||||
printf("DBG CONNMAN added technology: %s\n", t->name);
|
|
||||||
ctxt->technologies = eina_inlist_append(ctxt->technologies, EINA_INLIST_GET(t));
|
ctxt->technologies = eina_inlist_append(ctxt->technologies, EINA_INLIST_GET(t));
|
||||||
|
|
||||||
|
DBG("Added technology: %s.", t->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!e_connman_manager_request_scan("", _connman_request_scan_cb, NULL))
|
if (!e_connman_manager_request_scan("", _connman_request_scan_cb, NULL))
|
||||||
printf("DBG CONNMAN request scan on all technologies failed\n");
|
ERR("Request scan on all technologies failed.");
|
||||||
free(names);
|
free(names);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -783,13 +789,12 @@ _connman_services_load(E_Connman_Module_Context *ctxt)
|
||||||
if (!service)
|
if (!service)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
printf("DBG CONNMAN added service: %s\n", service->name);
|
DBG("Added service: %s\n", service->name);
|
||||||
ctxt->services = eina_inlist_append
|
ctxt->services = eina_inlist_append
|
||||||
(ctxt->services, EINA_INLIST_GET(service));
|
(ctxt->services, EINA_INLIST_GET(service));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* no need to remove elements, as they remove themselves */
|
/* no need to remove elements, as they remove themselves */
|
||||||
|
|
||||||
free(elements);
|
free(elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -815,12 +820,12 @@ _connman_default_service_changed(E_Connman_Module_Context *ctxt)
|
||||||
def = itr;
|
def = itr;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("DBG CONNMAN: default service changed to %p (%s)\n", def, def ? def->name : "");
|
DBG("Default service changed to %p (%s)", def, def ? def->name : "");
|
||||||
|
|
||||||
if (!e_connman_manager_technology_default_get(&tech))
|
if (!e_connman_manager_technology_default_get(&tech))
|
||||||
tech = NULL;
|
tech = NULL;
|
||||||
eina_stringshare_replace(&ctxt->technology, tech);
|
eina_stringshare_replace(&ctxt->technology, tech);
|
||||||
printf("DBG CONNMAN: manager technology is '%s'\n", tech);
|
DBG("Manager technology is '%s'", tech);
|
||||||
|
|
||||||
if (!e_connman_manager_offline_mode_get(&ctxt->offline_mode))
|
if (!e_connman_manager_offline_mode_get(&ctxt->offline_mode))
|
||||||
ctxt->offline_mode = EINA_FALSE;
|
ctxt->offline_mode = EINA_FALSE;
|
||||||
|
@ -849,9 +854,9 @@ static int
|
||||||
_connman_default_service_changed_delayed_do(void *data)
|
_connman_default_service_changed_delayed_do(void *data)
|
||||||
{
|
{
|
||||||
E_Connman_Module_Context *ctxt = data;
|
E_Connman_Module_Context *ctxt = data;
|
||||||
|
DBG("Do delayed change.");
|
||||||
|
|
||||||
ctxt->poller.default_service_changed = NULL;
|
ctxt->poller.default_service_changed = NULL;
|
||||||
printf("\033[32mDBG CONNMAN: do delayed change\033[0m\n");
|
|
||||||
_connman_default_service_changed(ctxt);
|
_connman_default_service_changed(ctxt);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -861,7 +866,7 @@ _connman_default_service_changed_delayed(E_Connman_Module_Context *ctxt)
|
||||||
{
|
{
|
||||||
if (!ctxt->has_manager)
|
if (!ctxt->has_manager)
|
||||||
return;
|
return;
|
||||||
printf("\033[1;31mDBG CONNMAN: request delayed change\033[0m\n");
|
DBG("Request delayed change.");
|
||||||
if (ctxt->poller.default_service_changed)
|
if (ctxt->poller.default_service_changed)
|
||||||
ecore_poller_del(ctxt->poller.default_service_changed);
|
ecore_poller_del(ctxt->poller.default_service_changed);
|
||||||
ctxt->poller.default_service_changed = ecore_poller_add
|
ctxt->poller.default_service_changed = ecore_poller_add
|
||||||
|
@ -1801,6 +1806,16 @@ e_modapi_init(E_Module *m)
|
||||||
ctxt->conf_dialog = NULL;
|
ctxt->conf_dialog = NULL;
|
||||||
connman_mod = m;
|
connman_mod = m;
|
||||||
|
|
||||||
|
if (_e_connman_log_dom < 0)
|
||||||
|
{
|
||||||
|
_e_connman_log_dom = eina_log_domain_register("econnman", EINA_COLOR_ORANGE);
|
||||||
|
if (_e_connman_log_dom < 0)
|
||||||
|
{
|
||||||
|
EINA_LOG_CRIT("could not register logging domain econnman");
|
||||||
|
goto error_log_domain;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_connman_configure_registry_register();
|
_connman_configure_registry_register();
|
||||||
_connman_actions_register(ctxt);
|
_connman_actions_register(ctxt);
|
||||||
e_gadcon_provider_register(&_gc_class);
|
e_gadcon_provider_register(&_gc_class);
|
||||||
|
@ -1809,6 +1824,10 @@ e_modapi_init(E_Module *m)
|
||||||
|
|
||||||
return ctxt;
|
return ctxt;
|
||||||
|
|
||||||
|
error_log_domain:
|
||||||
|
_e_connman_log_dom = -1;
|
||||||
|
connman_mod = NULL;
|
||||||
|
E_FREE(ctxt);
|
||||||
error_connman_context:
|
error_connman_context:
|
||||||
e_connman_system_shutdown();
|
e_connman_system_shutdown();
|
||||||
error_connman_system_init:
|
error_connman_system_init:
|
||||||
|
|
|
@ -7,9 +7,14 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <e.h>
|
#include <e.h>
|
||||||
#include <E_Connman.h>
|
#include <E_Connman.h>
|
||||||
|
#include <eina_log.h>
|
||||||
|
|
||||||
#define MOD_CONF_VERSION 2
|
#define MOD_CONF_VERSION 2
|
||||||
#define PRINT_VAR_NAME_VAL_INT(prefix, x) printf(prefix #x " = %d\n", x)
|
|
||||||
|
extern int _e_connman_log_dom;
|
||||||
|
#define DBG(...) EINA_LOG_DOM_DBG(_e_connman_log_dom, __VA_ARGS__)
|
||||||
|
#define WRN(...) EINA_LOG_DOM_WARN(_e_connman_log_dom, __VA_ARGS__)
|
||||||
|
#define ERR(...) EINA_LOG_DOM_ERR(_e_connman_log_dom, __VA_ARGS__)
|
||||||
|
|
||||||
typedef struct E_Connman_Instance E_Connman_Instance;
|
typedef struct E_Connman_Instance E_Connman_Instance;
|
||||||
typedef struct E_Connman_Module_Context E_Connman_Module_Context;
|
typedef struct E_Connman_Module_Context E_Connman_Module_Context;
|
||||||
|
|
Loading…
Reference in New Issue