summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeka Friedrich <friedrix@gmail.com>2022-02-20 22:44:46 +0100
committerJeka Friedrich <friedrix@gmail.com>2022-02-20 22:44:46 +0100
commit2230f59949cfe8ff9e83993704943a168d969908 (patch)
tree5aff0ddc41ff9dbfb6735cf1f58ce8f4c2fde658
parentea3eb6b70478b3c4860dbbf51d307a783d6c0687 (diff)
parente8a3b193a0d2f98593bb1d81a51a71898caf41e8 (diff)
downloadwayland-ivi-extension-2230f59949cfe8ff9e83993704943a168d969908.tar.gz
Merge remote-tracking branch 'upstream/pull/107'
* upstream/pull/107 simple-weston-client: remove unused variable simple-weston-client: use correct dlt header simple-weston-client: make dlt optional Reviewed-by: Eugen Friedrich <efriedrich@de.adit-jv.com>
-rw-r--r--ivi-layermanagement-examples/simple-weston-client/CMakeLists.txt7
-rw-r--r--ivi-layermanagement-examples/simple-weston-client/src/simple-weston-client.c26
2 files changed, 23 insertions, 10 deletions
diff --git a/ivi-layermanagement-examples/simple-weston-client/CMakeLists.txt b/ivi-layermanagement-examples/simple-weston-client/CMakeLists.txt
index b34633e..0c4f5df 100644
--- a/ivi-layermanagement-examples/simple-weston-client/CMakeLists.txt
+++ b/ivi-layermanagement-examples/simple-weston-client/CMakeLists.txt
@@ -26,7 +26,7 @@ pkg_check_modules(LIBWESTON_PROTOCOLS libweston-6-protocols QUIET)
if(${LIBWESTON_PROTOCOLS_FOUND})
#check for DLT
- pkg_check_modules(DLT automotive-dlt REQUIRED)
+ pkg_check_modules(DLT automotive-dlt QUIET)
#import the pkgdatadir from libweston-protocols pkgconfig file
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir libweston-6-protocols
@@ -118,8 +118,13 @@ add_dependencies(${PROJECT_NAME} ${LIBS})
add_definitions(${DLT_CFLAGS})
+if(${DLT_FOUND})
+ add_definitions(-DDLT)
+endif(${DLT_FOUND})
+
if(${LIBWESTON_PROTOCOLS_FOUND})
add_definitions(-DLIBWESTON_DEBUG_PROTOCOL)
+ target_link_libraries(${PROJECT_NAME} pthread)
endif(${LIBWESTON_PROTOCOLS_FOUND})
target_link_libraries(${PROJECT_NAME} ${LIBS})
diff --git a/ivi-layermanagement-examples/simple-weston-client/src/simple-weston-client.c b/ivi-layermanagement-examples/simple-weston-client/src/simple-weston-client.c
index 6b77f01..ab63390 100644
--- a/ivi-layermanagement-examples/simple-weston-client/src/simple-weston-client.c
+++ b/ivi-layermanagement-examples/simple-weston-client/src/simple-weston-client.c
@@ -36,17 +36,18 @@
#include <ivi-application-client-protocol.h>
#ifdef LIBWESTON_DEBUG_PROTOCOL
-#include "dlt_common.h"
-#include "dlt_user.h"
#include "weston-debug-client-protocol.h"
+#define MAXSTRLEN 1024
+#endif
+
+#ifdef DLT
+#include "dlt.h"
#define WESTON_DLT_APP_DESC "messages from weston debug protocol"
#define WESTON_DLT_CONTEXT_DESC "weston debug context"
#define WESTON_DLT_APP "WESN"
#define WESTON_DLT_CONTEXT "WESC"
-
-#define MAXSTRLEN 1024
#endif
#ifndef MIN
@@ -700,19 +701,19 @@ static void *
weston_dlt_thread_function(void *data)
{
WaylandContextStruct* wlcontext;
+
+#ifdef DLT
+ /*init dlt*/
char apid[DLT_ID_SIZE];
char ctid[DLT_ID_SIZE];
DLT_DECLARE_CONTEXT(weston_dlt_context)
-
- wlcontext = (WaylandContextStruct*)data;
-
- /*init dlt*/
dlt_set_id(apid, WESTON_DLT_APP);
dlt_set_id(ctid, WESTON_DLT_CONTEXT);
DLT_REGISTER_APP(apid, WESTON_DLT_APP_DESC);
DLT_REGISTER_CONTEXT(weston_dlt_context, ctid, WESTON_DLT_CONTEXT_DESC);
-
+#endif
+ wlcontext = (WaylandContextStruct*)data;
/*make the stdin as read end of the pipe*/
dup2(wlcontext->pipefd[0], STDIN_FILENO);
@@ -730,12 +731,19 @@ weston_dlt_thread_function(void *data)
if (strcmp(str,"")!=0)
{
+#ifdef DLT
DLT_LOG(weston_dlt_context, DLT_LOG_INFO, DLT_STRING(str));
+#else
+ fprintf(stderr,"%s",str);
+#endif
}
}
+#ifdef DLT
DLT_UNREGISTER_CONTEXT(weston_dlt_context);
DLT_UNREGISTER_APP();
+#endif
+
pthread_exit(NULL);
}
#endif