From: Yunhee Seo Date: Thu, 17 Oct 2024 01:34:53 +0000 (+0900) Subject: input: Add support of loading /etc/deviced/conf.d/input.conf for headless profile X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen_8.0;p=platform%2Fcore%2Fsystem%2Fplugin%2Fdeviced-headless.git input: Add support of loading /etc/deviced/conf.d/input.conf for headless profile As support plugin-backend implementation, plugin-backend specific conf file should be located under the "/etc/deviced/conf.d". To provide using headless profile specific input.conf, this is necessary. Change-Id: Ib1aa4cb725c8889fb83f47a3dd55723c7533ed11 Signed-off-by: Yunhee Seo --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 4553799..0c39ee2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror") ADD_SUBDIRECTORY(src/deviced-input) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/input.conf DESTINATION /etc/deviced) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/conf/input.conf DESTINATION /etc/deviced/conf.d) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/power.conf DESTINATION /etc/deviced) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/rndis.service DESTINATION /usr/lib/systemd/system) INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/packaging/rndis.sh DESTINATION /usr/bin) diff --git a/conf/input.conf b/conf/input.conf new file mode 100644 index 0000000..b4efd24 --- /dev/null +++ b/conf/input.conf @@ -0,0 +1,102 @@ +# [EventAction] - define event and corresponding action +# Name=string +# - define mnemonic for the event, and it is only used for logging +# Enum=integer +# - define an integer that represents the event. deviced uses this +# integer in broadcasting dbus signal. +# Keycode=string +# - define keycode to filter key event. +# as support key/button definitions in linux/input.h, put the same string definitions. +# For example, keycode=KEY_POWER +# DetectionRangeMsec=integer,integer +# - define time window in milisecond for filtering key event. -1 means no limit. +# TriggerType=level/edge +# - define event type +# ActionBroadcast=yes +# - Broadcast upon occuring an event, default no. +# ActionChangeState=current,next +# - define state transition action for the event. +# WakeLockDurationSec= +# - acquire wakelock for a specfied timeout + +# [EventAction] +# Name=PWKEY_SHORT_EDGE +# Enum=1000 +# Keycode=KEY_POWER +# DetectionRangeMsec=0,2000 +# TriggerType=edge +# ActionBroadcast=yes +# WakeLockDurationSec=5 + +# [EventAction] +# Name=PWKEY_LONG_LEVEL +# Enum=1001 +# Keycode=KEY_POWER +# DetectionRangeMsec=2000,-1 +# TriggerType=level +# ActionBroadcast=yes +# WakeLockDurationSec=5 + +# [EventAction] +# Name=PWKEY_LONG_EDGE +# Enum=1002 +# Keycode=KEY_POWER +# DetectionRangeMsec=2000,7000 +# TriggerType=edge +# ActionChangeState=normal,sleep +# ActionChangeState=sleep,normal + +# [EventAction] +# Name=PWKEY_LONGEST_LEVEL +# Enum=1003 +# Keycode=KEY_POWER +# DetectionRangeMsec=7000,-1 +# TriggerType=level +# ActionBroadcast=yes +# WakeLockDurationSec=5 + +# [EventAction] +# Name=PWKEY_LONGEST_EDGE_WO_CHARGER +# Enum=1004 +# Keycode=KEY_POWER +# DetectionRangeMsec=7000,-1 +# TriggerType=edge +# ConditionVconf=memory/sysman/charger_status,int,0 +# ActionChangeState=normal,poweroff +# ActionChangeState=sleep,normal + +# [EventAction] +# Name=PWKEY_LONGEST_EDGE_W_CHARGER +# Enum=1004 +# Keycode=KEY_POWER +# DetectionRangeMsec=7000,-1 +# TriggerType=edge +# ConditionVconf=memory/sysman/charger_status,int,1 +# ActionChangeState=normal,sleep +# ActionChangeState=sleep,normal + +# [EventAction] +# Name=BTKEY_SHORT_EDGE +# Enum=1005 +# Keycode=KEY_BLUETOOTH +# DetectionRangeMsec=0,2000 +# TriggerType=edge +# ActionBroadcast=yes +# WakeLockDurationSec=5 + +# [EventAction] +# Name=BTKEY_LONG_LEVEL +# Enum=1006 +# Keycode=KEY_BLUETOOTH +# DetectionRangeMsec=2000,-1 +# TriggerType=level +# ActionBroadcast=yes +# WakeLockDurationSec=5 + +# [EventAction] +# Name=BTKEY_LONG_EDGE +# Enum=1007 +# Keycode=KEY_BLUETOOTH +# DetectionRangeMsec=2000,7000 +# TriggerType=edge +# ActionBroadcast=yes diff --git a/packaging/input.conf b/packaging/input.conf deleted file mode 100644 index 93a41ff..0000000 --- a/packaging/input.conf +++ /dev/null @@ -1,102 +0,0 @@ -# [EventAction] - define event and corresponding action -# Name=string -# - define mnemonic for the event, and it is only used for logging -# Enum=integer -# - define an integer that represents the event. deviced uses this -# integer in broadcasting dbus signal. -# Keycode=string -# - define keycode to filter key event. -# as support key/button definitions in linux/input.h, put the same string definitions. -# For example, keycode=KEY_POWER -# DetectionRangeMsec=integer,integer -# - define time window in milisecond for filtering key event. -1 means no limit. -# TriggerType=level/edge -# - define event type -# ActionBroadcast=yes -# - Broadcast upon occuring an event, default no. -# ActionChangeState=current,next -# - define state transition action for the event. -# WakeLockDurationSec= -# - acquire wakelock for a specfied timeout - -#[EventAction] -#Name=PWKEY_SHORT_EDGE -#Enum=1000 -#Keycode=KEY_POWER -#DetectionRangeMsec=0,2000 -#TriggerType=edge -#ActionBroadcast=yes -#WakeLockDurationSec=5 - -#[EventAction] -#Name=PWKEY_LONG_LEVEL -#Enum=1001 -#Keycode=KEY_POWER -#DetectionRangeMsec=2000,-1 -#TriggerType=level -#ActionBroadcast=yes -#WakeLockDurationSec=5 - -#[EventAction] -#Name=PWKEY_LONG_EDGE -#Enum=1002 -#Keycode=KEY_POWER -#DetectionRangeMsec=2000,7000 -#TriggerType=edge -#ActionChangeState=normal,sleep -#ActionChangeState=sleep,normal - -#[EventAction] -#Name=PWKEY_LONGEST_LEVEL -#Enum=1003 -#Keycode=KEY_POWER -#DetectionRangeMsec=7000,-1 -#TriggerType=level -#ActionBroadcast=yes -#WakeLockDurationSec=5 - -#[EventAction] -#Name=PWKEY_LONGEST_EDGE_WO_CHARGER -#Enum=1004 -#Keycode=KEY_POWER -#DetectionRangeMsec=7000,-1 -#TriggerType=edge -#ConditionVconf=memory/sysman/charger_status,int,0 -#ActionChangeState=normal,poweroff -#ActionChangeState=sleep,normal - -#[EventAction] -#Name=PWKEY_LONGEST_EDGE_W_CHARGER -#Enum=1004 -#Keycode=KEY_POWER -#DetectionRangeMsec=7000,-1 -#TriggerType=edge -#ConditionVconf=memory/sysman/charger_status,int,1 -#ActionChangeState=normal,sleep -#ActionChangeState=sleep,normal - -#[EventAction] -#Name=BTKEY_SHORT_EDGE -#Enum=1005 -#Keycode=KEY_BLUETOOTH -#DetectionRangeMsec=0,2000 -#TriggerType=edge -#ActionBroadcast=yes -#WakeLockDurationSec=5 - -#[EventAction] -#Name=BTKEY_LONG_LEVEL -#Enum=1006 -#Keycode=KEY_BLUETOOTH -#DetectionRangeMsec=2000,-1 -#TriggerType=level -#ActionBroadcast=yes -#WakeLockDurationSec=5 - -#[EventAction] -#Name=BTKEY_LONG_EDGE -#Enum=1007 -#Keycode=KEY_BLUETOOTH -#DetectionRangeMsec=2000,7000 -#TriggerType=edge -#ActionBroadcast=yes diff --git a/packaging/system-plugin-deviced-headless.spec b/packaging/system-plugin-deviced-headless.spec index 996598b..78592da 100644 --- a/packaging/system-plugin-deviced-headless.spec +++ b/packaging/system-plugin-deviced-headless.spec @@ -48,7 +48,7 @@ make %{?jobs:-j%jobs} %manifest %{name}.manifest %license LICENSE.Apache-2.0 %{SYSTEM_PLUGIN_LIBDIR}/libplugin-backend-deviced-input.so -%config %{_sysconfdir}/deviced/input.conf +%config %{_sysconfdir}/deviced/conf.d/input.conf %config %{_sysconfdir}/deviced/power.conf %{_unitdir}/rndis.service %{_bindir}/rndis.sh diff --git a/src/deviced-input/deviced-input.c b/src/deviced-input/deviced-input.c index 4adbd5d..e911984 100644 --- a/src/deviced-input/deviced-input.c +++ b/src/deviced-input/deviced-input.c @@ -43,7 +43,7 @@ #define EXPORT __attribute__ ((visibility("default"))) -#define INPUT_CONF_PATH "/etc/deviced/input.conf" +#define INPUT_CONF_PATH "/etc/deviced/conf.d/input.conf" struct key_info { const char *key_name; @@ -1027,13 +1027,16 @@ void init_hash_table_with_key_infos(GHashTable *hash_table) static int deviced_input_init(void **data) { + int ret = 0; GHashTable *hash_table_key_infos = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); *data = (void *)&g_input_funcs; - /* Parse /etc/deviced/input.conf */ + /* Parse /etc/deviced/conf.d/input.conf */ init_hash_table_with_key_infos(hash_table_key_infos); - syscommon_config_parse_by_section(INPUT_CONF_PATH, parse_event_action, hash_table_key_infos); + ret = syscommon_config_parse_by_section(INPUT_CONF_PATH, parse_event_action, hash_table_key_infos); + if (ret < 0) + _W("Cannot parse input.conf file: ret(%d)", ret); g_hash_table_destroy(g_steal_pointer(&hash_table_key_infos)); return 0; } diff --git a/src/deviced-input/input-config.c b/src/deviced-input/input-config.c index d5ddf44..5b73f2c 100644 --- a/src/deviced-input/input-config.c +++ b/src/deviced-input/input-config.c @@ -31,7 +31,7 @@ #include "input-config.h" -#define INPUT_CONF_PATH "/etc/deviced/input.conf" +#define INPUT_CONF_PATH "/etc/deviced/conf.d/input.conf" /* input config list */ static GList *input_config_list;