diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/config.c | 4 | ||||
-rwxr-xr-x | src/connman.h | 3 | ||||
-rwxr-xr-x | src/device.c | 10 | ||||
-rwxr-xr-x | src/ipconfig.c | 12 | ||||
-rwxr-xr-x | src/log.c | 32 | ||||
-rwxr-xr-x | src/main.c | 48 | ||||
-rwxr-xr-x | src/main.conf | 9 | ||||
-rwxr-xr-x | src/network.c | 24 | ||||
-rwxr-xr-x | src/service.c | 31 | ||||
-rwxr-xr-x | src/timeserver.c | 10 |
10 files changed, 165 insertions, 18 deletions
diff --git a/src/config.c b/src/config.c index 56ca2b8b..d9907a1c 100644 --- a/src/config.c +++ b/src/config.c @@ -1591,7 +1591,9 @@ int __connman_config_provision_service(struct connman_service *service) /* For now only WiFi, Gadget and Ethernet services are supported */ type = connman_service_get_type(service); - +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("service %p type %d", service, type); if (type != CONNMAN_SERVICE_TYPE_WIFI && diff --git a/src/connman.h b/src/connman.h index 9e28ffea..82e584eb 100755 --- a/src/connman.h +++ b/src/connman.h @@ -1222,6 +1222,9 @@ int __connman_util_init(void); void __connman_util_cleanup(void); #ifdef TIZEN_EXT +__attribute__ ((unused)) static bool dlog_logging = true; +__attribute__ ((unused)) static bool file_logging = true; +__attribute__ ((unused)) static bool simplified_log = true; __attribute__ ((unused)) static int __tizentvextension = -1; #define TIZEN_TV_EXT (__builtin_expect(__tizentvextension != -1, 1) ? \ __tizentvextension : \ diff --git a/src/device.c b/src/device.c index 78b01f77..801400f2 100755 --- a/src/device.c +++ b/src/device.c @@ -1124,6 +1124,9 @@ int connman_device_set_string(struct connman_device *device, const char *connman_device_get_string(struct connman_device *device, const char *key) { +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("device %p key %s", device, key); if (g_str_equal(key, "Address")) @@ -1151,7 +1154,9 @@ int connman_device_add_network(struct connman_device *device, struct connman_network *network) { const char *identifier = connman_network_get_identifier(network); - +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("device %p network %p", device, network); if (!identifier) @@ -1177,6 +1182,9 @@ int connman_device_add_network(struct connman_device *device, struct connman_network *connman_device_get_network(struct connman_device *device, const char *identifier) { +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("device %p identifier %s", device, identifier); return g_hash_table_lookup(device->networks, identifier); diff --git a/src/ipconfig.c b/src/ipconfig.c index fb39f64d..6d8ba05a 100755 --- a/src/ipconfig.c +++ b/src/ipconfig.c @@ -1203,7 +1203,9 @@ struct connman_ipconfig *__connman_ipconfig_create(int index, } ipconfig->system = connman_ipaddress_alloc(AF_INET); - +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("ipconfig %p index %d", ipconfig, index); return ipconfig; @@ -1239,7 +1241,9 @@ void __connman_ipconfig_unref_debug(struct connman_ipconfig *ipconfig, { if (!ipconfig) return; - +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("%p ref %d by %s:%d:%s()", ipconfig, ipconfig->refcount - 1, file, line, caller); @@ -1653,7 +1657,9 @@ int __connman_ipconfig_enable(struct connman_ipconfig *ipconfig) int __connman_ipconfig_disable(struct connman_ipconfig *ipconfig) { struct connman_ipdevice *ipdevice; - +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("ipconfig %p", ipconfig); if (!ipconfig || ipconfig->index < 0) @@ -40,6 +40,10 @@ static const char *program_path; #if defined TIZEN_EXT #include <sys/stat.h> #include <sys/time.h> +#include <dlog.h> + +#undef LOG_TAG +#define LOG_TAG "CONNMAN" #define LOG_FILE_PATH "/opt/usr/data/network/connman.log" #define MAX_LOG_SIZE 1 * 1024 * 1024 @@ -127,7 +131,7 @@ void __connman_log(const int log_priority, const char *format, va_list ap) int log_size = 0; struct stat buf; char str[256]; - char strtime[40]; + char strtime[64]; if (!log_file) log_file = (FILE *)fopen(LOG_FILE_PATH, "a+"); @@ -168,7 +172,11 @@ void __connman_log_s(int log_priority, const char *format, ...) va_start(ap, format); - vsyslog(LOG_DEBUG, format, ap); + if (dlog_logging) + dlog_vprint(DLOG_DEBUG, LOG_TAG, format, ap); + + if (file_logging) + vsyslog(LOG_DEBUG, format, ap); va_end(ap); } @@ -189,7 +197,12 @@ void connman_info(const char *format, ...) va_list ap; va_start(ap, format); +#if defined TIZEN_EXT + if (dlog_logging) + dlog_vprint(DLOG_INFO, LOG_TAG, format, ap); + if (file_logging) +#endif vsyslog(LOG_INFO, format, ap); va_end(ap); @@ -207,7 +220,12 @@ void connman_warn(const char *format, ...) va_list ap; va_start(ap, format); +#if defined TIZEN_EXT + if (dlog_logging) + dlog_vprint(DLOG_WARN, LOG_TAG, format, ap); + if (file_logging) +#endif vsyslog(LOG_WARNING, format, ap); va_end(ap); @@ -225,7 +243,12 @@ void connman_error(const char *format, ...) va_list ap; va_start(ap, format); +#if defined TIZEN_EXT + if (dlog_logging) + dlog_vprint(DLOG_ERROR, LOG_TAG, format, ap); + if (file_logging) +#endif vsyslog(LOG_ERR, format, ap); va_end(ap); @@ -243,7 +266,12 @@ void connman_debug(const char *format, ...) va_list ap; va_start(ap, format); +#if defined TIZEN_EXT + if (dlog_logging) + dlog_vprint(DLOG_DEBUG, LOG_TAG, format, ap); + if (file_logging) +#endif vsyslog(LOG_DEBUG, format, ap); va_end(ap); @@ -104,6 +104,9 @@ static struct { char *global_nameserver; bool supplicant_debug; char *def_wifi_ifname; + bool file_log; + bool dlog_log; + bool simplified_log; #endif } connman_settings = { .bg_scan = true, @@ -134,6 +137,9 @@ static struct { .global_nameserver = NULL, .supplicant_debug = false, .def_wifi_ifname = DEFAULT_WIFI_INTERFACE, + .file_log = true, + .dlog_log = true, + .simplified_log = true, #endif }; @@ -221,6 +227,9 @@ static struct { #define CONF_GLOBAL_NAMESERVER "GlobalNameserver" #define CONF_CONNMAN_SUPPLICANT_DEBUG "ConnmanSupplicantDebug" #define CONF_CONNMAN_WIFI_DEF_IFNAME "DefaultWifiInterface" +#define CONF_CONNMAN_FILE_LOG "FileLogging" +#define CONF_CONNMAN_DLOG_LOG "DlogLogging" +#define CONF_CONNMAN_SIMPLIFIED_LOG "SimplifiedLog" #endif #if defined TIZEN_EXT @@ -279,6 +288,9 @@ static const char *supported_options[] = { CONF_GLOBAL_NAMESERVER, CONF_CONNMAN_SUPPLICANT_DEBUG, CONF_CONNMAN_WIFI_DEF_IFNAME, + CONF_CONNMAN_FILE_LOG, + CONF_CONNMAN_DLOG_LOG, + CONF_CONNMAN_SIMPLIFIED_LOG, #endif NULL }; @@ -666,6 +678,27 @@ static void check_Tizen_configuration(GKeyFile *config) g_clear_error(&error); + boolean = __connman_config_get_bool(config, "General", + CONF_CONNMAN_FILE_LOG, &error); + if (!error) + connman_settings.file_log = boolean; + + g_clear_error(&error); + + boolean = __connman_config_get_bool(config, "General", + CONF_CONNMAN_DLOG_LOG, &error); + if (!error) + connman_settings.dlog_log = boolean; + + g_clear_error(&error); + + boolean = __connman_config_get_bool(config, "General", + CONF_CONNMAN_SIMPLIFIED_LOG, &error); + if (!error) + connman_settings.simplified_log = boolean; + + g_clear_error(&error); + check_Tizen_INS_configuration(config); } @@ -907,7 +940,11 @@ static int config_init(const char *file) parse_config(config); if (config) g_key_file_free(config); - +#if defined TIZEN_EXT + dlog_logging = connman_settings.file_log; + file_logging = connman_settings.dlog_log; + simplified_log = connman_settings.simplified_log; +#endif return 0; } @@ -1134,6 +1171,15 @@ bool connman_setting_get_bool(const char *key) if (g_str_equal(key, CONF_CONNMAN_SUPPLICANT_DEBUG)) return connman_settings.supplicant_debug; + + if (g_str_equal(key, CONF_CONNMAN_FILE_LOG)) + return connman_settings.file_log; + + if (g_str_equal(key, CONF_CONNMAN_DLOG_LOG)) + return connman_settings.dlog_log; + + if (g_str_equal(key, CONF_CONNMAN_SIMPLIFIED_LOG)) + return connman_settings.simplified_log; #endif #if defined TIZEN_EXT diff --git a/src/main.conf b/src/main.conf index 58bcfcb9..555225f0 100755 --- a/src/main.conf +++ b/src/main.conf @@ -172,6 +172,15 @@ NetworkCellularInterfaceList = pdp,rmnet,seth_td,seth_w # Enable supplicant debugging log ConnmanSupplicantDebug = false +# Save ConnMan log to file +FileLogging = false + +# Use dlog for ConnMan logging +DlogLogging = true + +# Some logs of low importance are omitted to reduce the amount of logs +SimplifiedLog = true + # This value specifies which will be the default when there are multiple wifi interfaces. # Default value is wlan0. DefaultWifiInterface = wlan0 diff --git a/src/network.c b/src/network.c index 636da188..281d0204 100755 --- a/src/network.c +++ b/src/network.c @@ -1169,7 +1169,9 @@ static int network_probe(struct connman_network *network) driver = NULL; continue; } - +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("driver %p name %s", driver, driver->name); if (driver->probe(network) == 0) @@ -2110,7 +2112,9 @@ int __connman_network_connect(struct connman_network *network) int __connman_network_disconnect(struct connman_network *network) { int err = 0; - +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("network %p", network); remove_ipv4ll_timeout(network); @@ -2341,7 +2345,9 @@ int connman_network_set_bssid(struct connman_network *network, if (bssid == NULL) return -EINVAL; - +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("network %p bssid %02x:%02x:%02x:%02x:%02x:%02x", network, bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5]); @@ -2433,6 +2439,9 @@ int connman_network_set_enc_mode(struct connman_network *network, if (encryption_mode == NULL) return -EINVAL; +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("network %p encryption mode %s", network, encryption_mode); g_strlcpy(network->wifi.encryption_mode, encryption_mode, @@ -2526,6 +2535,9 @@ int connman_network_set_countrycode(struct connman_network *network, if (country_code == NULL) return -EINVAL; +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("network %p Country Code %02x:%02x",network, country_code[0],country_code[1]); @@ -2552,6 +2564,9 @@ int connman_network_set_bssid_list(struct connman_network *network, int connman_network_set_phy_mode(struct connman_network *network, ieee80211_modes_e mode) { +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("network %p phy mode %d", network, mode); network->wifi.phy_mode = mode; @@ -2684,6 +2699,9 @@ int connman_network_set_domain(struct connman_network *network, int connman_network_set_name(struct connman_network *network, const char *name) { +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("network %p name %s", network, name); g_free(network->name); diff --git a/src/service.c b/src/service.c index 2b40dec4..99f52e07 100755 --- a/src/service.c +++ b/src/service.c @@ -860,6 +860,9 @@ static int service_ext_load(struct connman_service *service) int i; int err = 0; +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("service %p", service); if (!service->network) @@ -1036,7 +1039,9 @@ static int service_load(struct connman_service *service) #if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET bool use_eapol; #endif - +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("service %p", service); keyfile = connman_storage_load_service(service->identifier); @@ -6259,6 +6264,9 @@ static void preferred_tech_add_by_type(gpointer data, gpointer user_data) tech_data->preferred_list = g_list_append(tech_data->preferred_list, service); +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("type %d service %p %s", tech_data->type, service, service->name); } @@ -7053,6 +7061,9 @@ static void service_append_added_foreach(gpointer data, gpointer user_data) append_struct(service, iter); g_hash_table_remove(services_notify->add, service->path); } else { +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("changed %s", service->path); append_struct_service(iter, NULL, service); @@ -7261,6 +7272,9 @@ static DBusMessage *downgrade_service(DBusConnection *conn, static void service_schedule_added(struct connman_service *service) { +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("service %p", service); g_hash_table_remove(services_notify->remove, service->path); @@ -7454,6 +7468,9 @@ static void stats_init(struct connman_service *service) static void service_initialize(struct connman_service *service) { +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("service %p", service); service->refcount = 1; @@ -9960,7 +9977,9 @@ static struct connman_service *service_get(const char *identifier) service = connman_service_create(); if (!service) return NULL; - +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("service %p", service); service->identifier = g_strdup(identifier); @@ -9975,6 +9994,9 @@ static struct connman_service *service_get(const char *identifier) static int service_register(struct connman_service *service) { +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("service %p", service); if (service->path) @@ -9992,7 +10014,7 @@ static int service_register(struct connman_service *service) if (ret == -ERANGE) service_ext_save(service); ret = __connman_config_provision_service(service); - if (ret < 0) + if (ret < 0 && simplified_log) DBG("Failed to provision service"); #else if (__connman_config_provision_service(service) < 0) @@ -10608,7 +10630,8 @@ void __connman_service_notify_strength_changed(struct connman_network *network) return; service->strength = strength; - DBG("Strength %d", strength); + if (!simplified_log) + DBG("Strength %d", strength); strength_changed(service); service_list_sort(); } diff --git a/src/timeserver.c b/src/timeserver.c index 32f1b01c..ac99f76d 100755 --- a/src/timeserver.c +++ b/src/timeserver.c @@ -106,9 +106,11 @@ static void resolv_result(GResolvResultStatus status, char **results, server = g_strdup((gchar *)user_data); ts_list = g_slist_append(ts_list, server); - DBG("added server %s", server); -#endif + if (!simplified_log) + DBG("added server %s", server); + if (!simplified_log) +#endif DBG("status %d", status); if (status == G_RESOLV_RESULT_STATUS_SUCCESS) { @@ -185,7 +187,9 @@ static void sync_next(void) __connman_ntp_start(ts_current, ntp_callback, NULL); return; } - +#if defined TIZEN_EXT + if (!simplified_log) +#endif DBG("Resolving timeserver %s", ts_current); #if defined TIZEN_EXT resolv_id = g_resolv_lookup_hostname(resolv, ts_current, |