input: Add support of loading /etc/deviced/conf.d/input.conf for headless profile 46/320346/1 tizen_8.0
authorYunhee Seo <yuni.seo@samsung.com>
Thu, 17 Oct 2024 01:34:53 +0000 (10:34 +0900)
committerYunhee Seo <yuni.seo@samsung.com>
Wed, 19 Feb 2025 05:02:50 +0000 (14:02 +0900)
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 <yuni.seo@samsung.com>
CMakeLists.txt
conf/input.conf [new file with mode: 0644]
packaging/input.conf [deleted file]
packaging/system-plugin-deviced-headless.spec
src/deviced-input/deviced-input.c
src/deviced-input/input-config.c

index 4553799b7f5295d856c9890d1917054b4dfbf3d3..0c39ee2c105b7d504a8151f651c720b627f3e754 100644 (file)
@@ -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 (file)
index 0000000..b4efd24
--- /dev/null
@@ -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 (file)
index 93a41ff..0000000
+++ /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
index 996598b4957884eacad8586f7427e1cc02ccb864..78592da31ba5b4661bc6b9a343c4719e42c16e7d 100644 (file)
@@ -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
index 4adbd5d549fd3c4c25ce1fd7bb71fba1713fd1ad..e9119848a338968a9e79710f3b7246f04fc80f59 100644 (file)
@@ -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;
 }
index d5ddf4459ff6c025e14d2b384a64e474a0528cc7..5b73f2ce02a705a5168e3a2d23cfc08b949f5096 100644 (file)
@@ -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;