From: JengHyun Kang Date: Tue, 27 Sep 2016 14:19:50 +0000 (+0900) Subject: ecore_drm: Set a libinput's log handler X-Git-Tag: accepted/tizen/3.0/ivi/20161011.043919~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=afb9262713938eb11d4d1e0550c1325dbf27bf8b;p=platform%2Fupstream%2Fefl.git ecore_drm: Set a libinput's log handler Change-Id: Ic53c7afbf579f0b38fa17cd971f218ed451a1e2b --- diff --git a/src/lib/ecore_drm/ecore_drm_inputs.c b/src/lib/ecore_drm/ecore_drm_inputs.c index e42ac74..b9e7028 100644 --- a/src/lib/ecore_drm/ecore_drm_inputs.c +++ b/src/lib/ecore_drm/ecore_drm_inputs.c @@ -446,11 +446,36 @@ const struct libinput_interface _input_interface = _cb_close_restricted, }; +static void +ecore_drm_libinput_log_handler(struct libinput *libinput, + enum libinput_log_priority priority, + const char *format, va_list args) +{ + char buf[1024] = {0,}; + + vsprintf(buf, format, args); + switch (priority) + { + case LIBINPUT_LOG_PRIORITY_DEBUG: + DBG(buf); + break; + case LIBINPUT_LOG_PRIORITY_INFO: + INF(buf); + break; + case LIBINPUT_LOG_PRIORITY_ERROR: + ERR(buf); + break; + default: + break; + } +} + /* public functions */ EAPI Eina_Bool ecore_drm_inputs_create(Ecore_Drm_Device *dev) { Ecore_Drm_Input *input; + char *env; /* check for valid device */ EINA_SAFETY_ON_NULL_RETURN_VAL(dev, EINA_FALSE); @@ -479,6 +504,11 @@ ecore_drm_inputs_create(Ecore_Drm_Device *dev) } /* set libinput log priority */ + if ((env = getenv(ECORE_DRM_ENV_LIBINPUT_LOG_DISABLE)) && (atoi(env) == 1)) + libinput_log_set_handler(input->libinput, NULL); + else if ((env = getenv(ECORE_DRM_ENV_LIBINPUT_LOG_EINA_LOG)) && (atoi(env) == 1)) + libinput_log_set_handler(input->libinput, ecore_drm_libinput_log_handler); + libinput_log_set_priority(input->libinput, LIBINPUT_LOG_PRIORITY_INFO); /* assign udev seat */ @@ -560,6 +590,11 @@ ecore_drm_inputs_devices_create(Ecore_Drm_Device *dev) } /* set libinput log priority */ + if ((env = getenv(ECORE_DRM_ENV_LIBINPUT_LOG_DISABLE)) && (atoi(env) == 1)) + libinput_log_set_handler(input->libinput, NULL); + else if ((env = getenv(ECORE_DRM_ENV_LIBINPUT_LOG_EINA_LOG)) && (atoi(env) == 1)) + libinput_log_set_handler(input->libinput, ecore_drm_libinput_log_handler); + libinput_log_set_priority(input->libinput, LIBINPUT_LOG_PRIORITY_INFO); for (int i = 0; i < devices_num; i++) diff --git a/src/lib/ecore_drm/ecore_drm_private.h b/src/lib/ecore_drm/ecore_drm_private.h old mode 100755 new mode 100644 index bc5ffc3..c3ab37d --- a/src/lib/ecore_drm/ecore_drm_private.h +++ b/src/lib/ecore_drm/ecore_drm_private.h @@ -68,6 +68,9 @@ # define EVDEV_SEAT_KEYBOARD (1 << 1) # define EVDEV_SEAT_TOUCH (1 << 2) +# define ECORE_DRM_ENV_LIBINPUT_LOG_DISABLE "ECORE_DRM_LIBINPUT_LOG_DISABLE" +# define ECORE_DRM_ENV_LIBINPUT_LOG_EINA_LOG "ECORE_DRM_LIBINPUT_LOG_EINA_LOG" + # ifdef ERR # undef ERR # endif