e_info: support log feature to enable/disable specific log 19/310619/1
authorDoyoun Kang <doyoun.kang@samsung.com>
Thu, 2 May 2024 09:04:40 +0000 (18:04 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Fri, 3 May 2024 00:00:59 +0000 (09:00 +0900)
We add a "-log" command to enable/disable a specific log which is enabled/disabled by configuration.
Usage: winfo -log {log_type} (0 | 1)

Change-Id: I55c68e5d3b6cf4f3cbbfca5c256f928a9b5eeee5

src/bin/e_info_client.c
src/bin/e_info_server.c
src/include/e_info_shared_types.h

index ee2bd4cab943b0da3470b07cc68ed43dc0486737..4fbe704b0c72ce635d4bd1544b492f27f03f55fb 100644 (file)
@@ -6643,6 +6643,58 @@ finish:
    return;
 }
 
+static void
+_e_info_client_log_control(int argc, char **argv)
+{
+   const char *type;
+   Eldbus_Message *msg;
+   Eldbus_Message_Iter *itr;
+   Eldbus_Pending *p;
+   uint32_t onoff;
+
+   if (argc < 4)
+     {
+        printf("Error Check Args (Need more arguments)\n");
+        printf(": enlightenment_info -log [type] [1:on, 0:off]\n");
+        return;
+     }
+
+   onoff = atoi(argv[3]);
+   if ((onoff != 0) && (onoff != 1))
+     {
+        printf("Error Check Args (Allowed 0 or 1)\n");
+        printf(": enlightenment_info -log [type] [1:on, 0:off]\n");
+        return;
+     }
+
+   type = argv[2];
+   if (eina_streq(type, "key_input_ttrace_enable") ||
+       eina_streq(type, "input_log_enable"))
+     {
+        msg = eldbus_proxy_method_call_new(e_info_client.proxy, "log_control");
+        itr = eldbus_message_iter_get(msg);
+        eldbus_message_iter_basic_append(itr, 's', type);
+        eldbus_message_iter_basic_append(itr, 'i', onoff);
+
+        p = eldbus_proxy_send(e_info_client.proxy, msg,
+                              _e_info_client_eldbus_message_cb,
+                              NULL, -1);
+        if (!p)
+          {
+             printf("Failed to call eldbus_proxy_send");
+             return;
+          }
+
+        ecore_main_loop_begin();
+     }
+   else
+     {
+        // not supported log
+        printf("Error Check Args (Not supported log type)\n");
+        printf(": enlightenment_info -log [type] [1:on, 0:off]\n");
+     }
+}
+
 typedef struct _ProcInfo
 {
    const char *option;
@@ -7047,6 +7099,12 @@ static ProcInfo procs_to_execute[] =
       "Set/Unset transparent of the kvm service window",
       _e_info_client_proc_kvm_transparent_set
    },
+   {
+      "log",
+      USAGE_LOG_CONTROL,
+      "Enable/Disable specific log",
+      _e_info_client_log_control
+   },
 };
 
 ProcInfo procs_to_input[] =
index b84fd8161170d9605ad891391f8d560e0d3380d4..36bbdc1db94ff73a41212b8865d0c647b6c0035c 100644 (file)
@@ -7221,6 +7221,31 @@ _e_info_server_cb_kvm_transparent_set(const Eldbus_Service_Interface *iface EINA
    return reply;
 }
 
+static Eldbus_Message *
+_e_info_server_cb_log_control(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
+{
+   Eldbus_Message *reply = eldbus_message_method_return_new(msg);
+   const char *type;
+   uint32_t onoff;
+
+   if (!eldbus_message_arguments_get(msg, "si", &type, &onoff))
+     {
+        ERR("Error getting arguments.");
+        return reply;
+     }
+
+   if (!e_util_strcmp("key_input_ttrace_enable", type))
+     {
+        e_config->key_input_ttrace_enable = onoff;
+     }
+   else if (!e_util_strcmp("input_log_enable", type))
+     {
+        e_info_server_input_log_enable_set(onoff);
+     }
+
+   return reply;
+}
+
 //{ "method_name", arguments_from_client, return_values_to_client, _method_cb, ELDBUS_METHOD_FLAG },
 static const Eldbus_Method methods[] = {
    { "get_window_info", NULL, ELDBUS_ARGS({"iiiiisiiia("VALUE_TYPE_FOR_TOPVWINS")", "array of ec"}), _e_info_server_cb_window_info_get, 0 },
@@ -7319,6 +7344,7 @@ static const Eldbus_Method methods[] = {
    { "prop_set", ELDBUS_ARGS({"s","window id" }, {"s", "property"}, {"i", "set value"}), NULL, _e_info_server_cb_prop_set, 0},
    { "input_subtype_set", ELDBUS_ARGS({"ss", "set input device's subtype(subclas)"}), ELDBUS_ARGS({"s", "result message"}), _e_info_server_cb_input_subtype_set, 0 },
    { "kvm_transparent", ELDBUS_ARGS({"i", "set kvm service window to transparent"}), NULL, _e_info_server_cb_kvm_transparent_set, 0 },
+   { "log_control", ELDBUS_ARGS({"s","log type" }, {"i", "enable"}), NULL, _e_info_server_cb_log_control, 0},
    { NULL, NULL, NULL, NULL, 0 }
 };
 
index b70f26c9e74a7d48b9c815f4e4f4d98c1889468b..a4dfde07868f8df6515d241cd47b26a54296e73a 100644 (file)
@@ -357,4 +357,13 @@ typedef enum
    "\twinfo -quickpanel 3 : unset scoll_lock for quickpanel service\n"          \
    "\twinfo -quickpanel 1 0x0a710a07 : show the specific quickpanel service\n"
 
+#define USAGE_LOG_CONTROL                        \
+   "{log type} (1 | 0) \n"                       \
+   "\tlog type : log type to enable/disable\n"   \
+   "\t           input_log_enable\n"             \
+   "\t           key_input_ttrace_enable\n"      \
+   "Example:\n"                                  \
+   "\twinfo -log input_log_enable 1\n"           \
+   "\twinfo -log key_input_ttrace_enable 1\n"
+
 #endif /* end of _E_INFO_SHARED_TYPES_ */