diff options
Diffstat (limited to 'meta-rcar-gen3-adas/recipes-support')
32 files changed, 1598 insertions, 0 deletions
diff --git a/meta-rcar-gen3-adas/recipes-support/ctemplate/ctemplate.inc b/meta-rcar-gen3-adas/recipes-support/ctemplate/ctemplate.inc new file mode 100644 index 0000000..3caba6b --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/ctemplate/ctemplate.inc @@ -0,0 +1,12 @@ +SUMMARY = "CTemplate is a simple but powerful template language for C++. It emphasizes separating logic from presentation: it is impossible to embed application logic in this template language." +HOMEPAGE = "https://code.google.com/p/ctemplate/" +LICENSE = "GOOGLE-NEW-BSD" +SECTION = "libs" + +inherit autotools pkgconfig + +LIC_FILES_CHKSUM = "file://COPYING;md5=762732742c73dc6c7fbe8632f06c059a" + +BBCLASSEXTEND = "native nativesdk" + + diff --git a/meta-rcar-gen3-adas/recipes-support/ctemplate/ctemplate_2.3.bb b/meta-rcar-gen3-adas/recipes-support/ctemplate/ctemplate_2.3.bb new file mode 100644 index 0000000..8383c12 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/ctemplate/ctemplate_2.3.bb @@ -0,0 +1,9 @@ +require ctemplate.inc + +SRC_URI = "svn://ctemplate.googlecode.com/svn/;module=tags/ctemplate-2.3;protocol=http" +SRC_URI[md5sum] = "" +SRC_URI[sha256sum] = "" +SRCREV = "r141" +S = "${WORKDIR}/tags/ctemplate-2.3" +B = "${WORKDIR}/tags/ctemplate-2.3" + diff --git a/meta-rcar-gen3-adas/recipes-support/ctemplate/ctemplate_svn.bb b/meta-rcar-gen3-adas/recipes-support/ctemplate/ctemplate_svn.bb new file mode 100644 index 0000000..c51ed40 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/ctemplate/ctemplate_svn.bb @@ -0,0 +1,11 @@ +require ctemplate.inc + +SRC_URI = "svn://ctemplate.googlecode.com/svn/;module=trunk;protocol=http" +SRC_URI[md5sum] = "" +SRC_URI[sha256sum] = "" +SRCREV = "${AUTOREV}" +S = "${WORKDIR}/trunk" + +PV = "2.3+svnr${SRCREV}" + +DEFAULT_PREFERENCE = "-1" diff --git a/meta-rcar-gen3-adas/recipes-support/gflags/gflags_git.bb b/meta-rcar-gen3-adas/recipes-support/gflags/gflags_git.bb new file mode 100644 index 0000000..79b5116 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/gflags/gflags_git.bb @@ -0,0 +1,20 @@ +SUMMARY = "GFlags library" +DESCRIPTION = "The gflags package contains a C++ library that implements commandline flags processing" + +LICENSE = "BSD" +LIC_FILES_CHKSUM = "file://${S}/COPYING.txt;md5=c80d1a3b623f72bb85a4c75b556551df" + +SRC_URI = "git://github.com/gflags/gflags.git" +SRCREV = "14c0e93755d5a32c3d2029d83094564b8823b7b4" + +S = "${WORKDIR}/git" + +inherit cmake + +RDEPENDS_${PN} += "bash" + +EXTRA_OECMAKE = "-DBUILD_SHARED_LIBS=ON -DINSTALL_HEADERS=ON -DINSTALL_SHARED_LIBS=ON" + +FILES_${PN}-dev += " \ + ${libdir}/cmake \ +" diff --git a/meta-rcar-gen3-adas/recipes-support/glm/glm.inc b/meta-rcar-gen3-adas/recipes-support/glm/glm.inc new file mode 100644 index 0000000..a550a73 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/glm/glm.inc @@ -0,0 +1,16 @@ +SUMMARY = "OpenGL Mathematics" +HOMEPAGE = "http://glm.g-truc.net" +DESCRIPTION = "OpenGL Mathematics (GLM) is a header only C++ mathematics library for graphics software based on the OpenGL Shading Language (GLSL) specifications." +LICENSE = "MIT" +SECTION = "multimedia" + +inherit pkgconfig cmake + +LIC_FILES_CHKSUM = " \ + file://copying.txt;md5=6ba02d5f908587c6f3942e76bf6d92d6 \ +" + +ALLOW_EMPTY_${PN} = "1" + +FILES_${PN}-dev += "/usr/lib/cmake/" + diff --git a/meta-rcar-gen3-adas/recipes-support/glm/glm/0001-Fix-cmake-pathes.patch b/meta-rcar-gen3-adas/recipes-support/glm/glm/0001-Fix-cmake-pathes.patch new file mode 100644 index 0000000..5ca3daa --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/glm/glm/0001-Fix-cmake-pathes.patch @@ -0,0 +1,25 @@ +From 4a3e9a475a6688abc81f336a5089e99b15cb5b14 Mon Sep 17 00:00:00 2001 +From: Petr Nechaev <petr.nechaev@cogentembedded.com> +Date: Fri, 28 Aug 2015 16:16:09 +0300 +Subject: [PATCH] Fix cmake pathes + +--- + CMakeLists.txt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 860a6ee..174f35d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -164,7 +164,7 @@ configure_file( + # install tree package config + configure_package_config_file( + cmake/glmConfig.cmake.in +- ${GLM_INSTALL_CONFIGDIR}/glmConfig.cmake ++ ${CMAKE_CURRENT_BINARY_DIR}/${GLM_INSTALL_CONFIGDIR}/glmConfig.cmake + INSTALL_DESTINATION ${GLM_INSTALL_CONFIGDIR} + PATH_VARS CMAKE_INSTALL_INCLUDEDIR + NO_CHECK_REQUIRED_COMPONENTS_MACRO +-- +1.9.3 + diff --git a/meta-rcar-gen3-adas/recipes-support/glm/glm_0.9.7.0.bb b/meta-rcar-gen3-adas/recipes-support/glm/glm_0.9.7.0.bb new file mode 100644 index 0000000..0ba9214 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/glm/glm_0.9.7.0.bb @@ -0,0 +1,10 @@ +require glm.inc + +SRC_URI = "\ + https://github.com/g-truc/${BPN}/archive/${PV}.tar.gz \ + file://0001-Fix-cmake-pathes.patch \ +" + +SRC_URI[md5sum] = "33025d322f08e7783f6513272ef60aff" +SRC_URI[sha256sum] = "71f95cb20602dff9e799e7f4854d4173474382dbd9d0efc6f77bde6d289351fa" + diff --git a/meta-rcar-gen3-adas/recipes-support/glm/glm_git.bb b/meta-rcar-gen3-adas/recipes-support/glm/glm_git.bb new file mode 100644 index 0000000..68f0d3e --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/glm/glm_git.bb @@ -0,0 +1,13 @@ +require glm.inc + +SRC_URI = "\ + git://github.com/g-truc/glm.git \ + file://0001-Fix-cmake-pathes.patch \ +" + +SRCREV = "ebdd48fa6f4a3f1436badeb43580a7910551740e" +S = "${WORKDIR}/git" + +PV = "0.999+git${SRCREV}" + +DEFAULT_PREFERENCE = "-1" diff --git a/meta-rcar-gen3-adas/recipes-support/libiio/libiio.inc b/meta-rcar-gen3-adas/recipes-support/libiio/libiio.inc new file mode 100644 index 0000000..81662a5 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/libiio/libiio.inc @@ -0,0 +1,11 @@ +DESCRIPTION = "Library for interfacing with IIO devices" +HOMEPAGE = "http://wiki.analog.com/resources/tools-software/linux-software/libiio" +SECTION = "System/Libraries" +LICENSE = "LGPL-2.1" + +LIC_FILES_CHKSUM ??= "file://COPYING.txt;md5=7c13b3376cea0ce68d2d2da0a1b3a72c" + +inherit cmake pkgconfig + +DEPENDS = "libxml2 bison-native flex-native systemd" + diff --git a/meta-rcar-gen3-adas/recipes-support/libiio/libiio_0.5.bb b/meta-rcar-gen3-adas/recipes-support/libiio/libiio_0.5.bb new file mode 100644 index 0000000..664dc96 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/libiio/libiio_0.5.bb @@ -0,0 +1,9 @@ +require ${BPN}.inc + +SRC_URI = "https://github.com/analogdevicesinc/${BPN}/archive/v${PV}.tar.gz" +SRC_URI[md5sum] = "4496c24dabdce60bdcf231ebe19bb501" +SRC_URI[sha256sum] = "c41cdcfeae8717e72f1100b4dac9d7cc9d86f4e0731da3354149cb7e051666f3" + +LIC_FILES_CHKSUM ??= "file://COPYING;md5=7c13b3376cea0ce68d2d2da0a1b3a72c" + +S = "${WORKDIR}/${BPN}-${PV}" diff --git a/meta-rcar-gen3-adas/recipes-support/libiio/libiio_git.bb b/meta-rcar-gen3-adas/recipes-support/libiio/libiio_git.bb new file mode 100644 index 0000000..0c02133 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/libiio/libiio_git.bb @@ -0,0 +1,8 @@ +require ${BPN}.inc + +SRC_URI = "git://github.com/analogdevicesinc/${BPN}.git" +S = "${WORKDIR}/git" +SRCREV = "7ce5cd5b508389077aedaaa4d5f1c0b08b78ded5" + +DEFAULT_PREFERENCE = "1" + diff --git a/meta-rcar-gen3-adas/recipes-support/libusbg/libusbg.inc b/meta-rcar-gen3-adas/recipes-support/libusbg/libusbg.inc new file mode 100644 index 0000000..eb62395 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/libusbg/libusbg.inc @@ -0,0 +1,10 @@ +SUMMARY = "USB Gadget Configfs Library" + +LICENSE = "GPLv2 & LGPLv2.1" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://COPYING.LGPL;md5=4fbd65380cdd255951079008b364516c" + +DEPENDS += " libconfig " + +inherit autotools pkgconfig + diff --git a/meta-rcar-gen3-adas/recipes-support/libusbg/libusbg_0.1.0.bb b/meta-rcar-gen3-adas/recipes-support/libusbg/libusbg_0.1.0.bb new file mode 100644 index 0000000..b63bcd4 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/libusbg/libusbg_0.1.0.bb @@ -0,0 +1,9 @@ +require libusbg.inc + +SRC_URI = "https://github.com/libusbg/libusbg/archive/v${PV}.tar.gz" + +SRC_URI[md5sum] = "2d3af961f7007a35ed3816de6b712ac1" +SRC_URI[sha256sum] = "82fa5c71741a70477148ed455c307611075a4f9af6886ab3e7a4471377dfd2c7" + +S = "${WORKDIR}/libusbg-${PV}" + diff --git a/meta-rcar-gen3-adas/recipes-support/libusbg/libusbg_git.bb b/meta-rcar-gen3-adas/recipes-support/libusbg/libusbg_git.bb new file mode 100644 index 0000000..4f873da --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/libusbg/libusbg_git.bb @@ -0,0 +1,9 @@ +require libusbg.inc + +PV = "0.1.0b" +SRCREV = "f1613aab97513188478087e001defbfca6847eca" +SRC_URI = "git://github.com/kopasiak/libusbg.git" + +S = "${WORKDIR}/git" + +DEFAULT_PREFERENCE = "1" diff --git a/meta-rcar-gen3-adas/recipes-support/netevent/netevent/0001-fix-endian-for-cross-arch.patch b/meta-rcar-gen3-adas/recipes-support/netevent/netevent/0001-fix-endian-for-cross-arch.patch new file mode 100644 index 0000000..e984447 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/netevent/netevent/0001-fix-endian-for-cross-arch.patch @@ -0,0 +1,113 @@ +From d9e02e86cacb6771381c4cde45f6badd71ec01cf Mon Sep 17 00:00:00 2001 +From: Andrey Gusakov <andrey.gusakov@cogentembedded.com> +Date: Tue, 13 Sep 2016 15:51:33 +0300 +Subject: [PATCH 1/2] fix endian for cross-arch + + +Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com> +--- + reader.cpp | 21 +++++++++++++++------ + write.cpp | 21 ++++++++++++++++----- + 2 files changed, 31 insertions(+), 11 deletions(-) + +diff --git a/reader.cpp b/reader.cpp +index ab047bd..651967a 100644 +--- a/reader.cpp ++++ b/reader.cpp +@@ -3,9 +3,18 @@ + #include <signal.h> + #include <sys/wait.h> + #include <sys/types.h> ++#include <arpa/inet.h> + #include <stdint.h> + #include <unistd.h> + ++int64_t htonll(int64_t value){ ++ int num = 42; ++ if(*(char *)&num == 42) //test big/little endian ++ return (((int64_t)htonl(value)) << 32) + htonl(value >> 32); ++ else ++ return value; ++} ++ + static bool running = true; + bool on = true; + static int fd = 0; +@@ -159,7 +168,7 @@ int read_device(const char *devfile) + + // First thing to write is the size of the structures as a 16 bit uint! + uint16_t strsz; +- strsz = sizeof(dev); ++ strsz = htons(sizeof(dev)); + if (!cout.write((const char*)&strsz, sizeof(strsz))) + exit(1); + if (cout.eof()) +@@ -272,11 +281,11 @@ int read_device(const char *devfile) + } + else if (on) { + input_event_t et; +- et.tv_sec = ev.time.tv_sec; +- et.tv_usec = ev.time.tv_usec; +- et.type = ev.type; +- et.code = ev.code; +- et.value = ev.value; ++ et.tv_sec = htonll(ev.time.tv_sec); ++ et.tv_usec = htonl(ev.time.tv_usec); ++ et.type = htons(ev.type); ++ et.code = htons(ev.code); ++ et.value = htonl(ev.value); + if (!cout.write((const char*)&et, sizeof(et))) + exit(1); + if (cout.eof()) +diff --git a/write.cpp b/write.cpp +index 7d58bf6..91c956c 100644 +--- a/write.cpp ++++ b/write.cpp +@@ -1,9 +1,18 @@ + #include "main.h" + #include <sys/wait.h> + #include <sys/types.h> ++#include <arpa/inet.h> + #include <stdint.h> + #include <unistd.h> + ++int64_t ntohll(int64_t value){ ++ int num = 42; ++ if(*(char *)&num == 42) //test big/little endian ++ return value; ++ else ++ return (((int64_t)ntohl(value)) << 32) + ntohl(value >> 32); ++} ++ + static const char *uinput_file[] = { + "/dev/uinput", + "/dev/input/uinput", +@@ -35,6 +44,7 @@ int spawn_device() + struct input_event ev; + + cin.read((char*)&strsz, sizeof(strsz)); ++ strsz = ntohs(strsz); + if (strsz != sizeof(uinput_user_dev)) { + cerr << "Device information field sizes do not match. Sorry." << endl; + return 1; +@@ -126,11 +136,12 @@ int spawn_device() + cerr << "End of data" << endl; + break; + } +- ev.time.tv_sec = et.tv_sec; +- ev.time.tv_usec = et.tv_usec; +- ev.type = et.type; +- ev.code = et.code; +- ev.value = et.value; ++ ev.time.tv_sec = ntohll(et.tv_sec); ++ ev.time.tv_usec = ntohl(et.tv_usec); ++ ev.type = ntohs(et.type); ++ ev.code = ntohs(et.code); ++ ev.value = ntohl(et.value); ++ //cErr << "EV " << ev.time.tv_sec << "." << ev.time.tv_usec << ": type " << ev.type << ", code " << ev.code << ", value " << ev.value << endl; + if (hotkey_hook(ev.type, ev.code, ev.value)) + continue; + if (write(fd, &ev, sizeof(ev)) < (ssize_t)sizeof(ev)) { +-- +1.7.10.4 + diff --git a/meta-rcar-gen3-adas/recipes-support/netevent/netevent/0002-fix-cross-compile.patch b/meta-rcar-gen3-adas/recipes-support/netevent/netevent/0002-fix-cross-compile.patch new file mode 100644 index 0000000..cca70ba --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/netevent/netevent/0002-fix-cross-compile.patch @@ -0,0 +1,70 @@ +From 7b30e567552535d9546e34d4fc38337095347224 Mon Sep 17 00:00:00 2001 +From: Andrey Gusakov <andrey.gusakov@cogentembedded.com> +Date: Tue, 13 Sep 2016 15:51:55 +0300 +Subject: [PATCH 2/2] fix cross-compile + + +Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com> +--- + Makefile | 19 ++++++++++--------- + reader.cpp | 1 + + 2 files changed, 11 insertions(+), 9 deletions(-) + +diff --git a/Makefile b/Makefile +index 02d25c7..9bbe82e 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,14 +1,15 @@ +-prefix = /usr/local +-bindir = $(prefix)/bin +-CXX = g++ +-CC = gcc +-CFLAGS = -Wall -pthread +-LDFLAGS = -g -pthread ++PREFIX ?= /usr ++SBINDIR ?= $(PREFIX)/bin ++CXX ?= g++ ++CC ?= gcc ++CFLAGS += -Wall -pthread ++LDFLAGS += -g ++LIBS = -lpthread + + SOURCES = main.cpp reader.cpp write.cpp showev.cpp + + ifneq ($(inotify),no) +- CFLAGS += -DWITH_INOTIFY ++ GCC_FLAGS += -DWITH_INOTIFY + endif + + all: build netevent devname +@@ -23,13 +24,13 @@ build/%.o: %.c + $(CC) $(CFLAGS) -c -o $@ $*.c -MMD -MF build/$*.d -MT $@ + + netevent: $(patsubst %.cpp,build/%.o,$(SOURCES)) +- $(CXX) $(LDFLAGS) -o $@ $^ ++ $(CXX) $(LDFLAGS) -o $@ $^ $(LIBS) + + devname: build/devname.o + $(CC) -o $@ $^ + + install: all +- install -m 755 -p -t "$(DESTDIR)$(bindir)" netevent devname ++ install -m 755 -p -t "$(DESTDIR)$(SBINDIR)" netevent devname + + clean: + -rm -rf build +diff --git a/reader.cpp b/reader.cpp +index 651967a..07fa64a 100644 +--- a/reader.cpp ++++ b/reader.cpp +@@ -6,6 +6,7 @@ + #include <arpa/inet.h> + #include <stdint.h> + #include <unistd.h> ++#include <pthread.h> + + int64_t htonll(int64_t value){ + int num = 42; +-- +1.7.10.4 + diff --git a/meta-rcar-gen3-adas/recipes-support/netevent/netevent/0003-use-socket-instead-of-stdout.patch b/meta-rcar-gen3-adas/recipes-support/netevent/netevent/0003-use-socket-instead-of-stdout.patch new file mode 100644 index 0000000..4fb3039 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/netevent/netevent/0003-use-socket-instead-of-stdout.patch @@ -0,0 +1,653 @@ +From 68944103c94f4957c2dbc0d246bf1360d28bd5b4 Mon Sep 17 00:00:00 2001 +From: Andrey Gusakov <andrey.gusakov@cogentembedded.com> +Date: Wed, 14 Sep 2016 18:16:47 +0300 +Subject: [PATCH] use socket instead of stdout + +--- + main.cpp | 16 +++--- + reader.cpp | 181 +++++++++++++++++++++++++++++++++++++------------------------ + write.cpp | 139 ++++++++++++++++++++++++++++++++++++----------- + 3 files changed, 226 insertions(+), 110 deletions(-) + +diff --git a/main.cpp b/main.cpp +index da512b0..e695328 100644 +--- a/main.cpp ++++ b/main.cpp +@@ -9,15 +9,15 @@ bool no_grab = false; + bool count_syn = false; + bool be_quiet = false; + +-int read_device(const char *devname); +-int spawn_device(); ++int read_device(const char *devname, const char *hostname, int port); ++int spawn_device(int port); + int show_events(int count, const char *devname); + + static void usage(const char *arg0) + { + size_t len = strlen(arg0); +- cerr << "usage: " << arg0 << " [options] -read <device>" << endl; +- cerr << " " << std::string(len, ' ') << " -write" << endl; ++ cerr << "usage: " << arg0 << " [options] -read <device> <ip/hostname> <port>" << endl; ++ cerr << " " << std::string(len, ' ') << " -write <port>" << endl; + cerr << " " << std::string(len, ' ') << " [options] -showevents <count> <device>" << endl; + cerr << "options are:" << endl; + cerr << " -ontoggle <command> Command to execute when grabbing is toggled." << endl; +@@ -53,12 +53,14 @@ int main(int argc, char **argv) + usage(arg0); + } + else if (command == "-read") { +- if (argc < 3) ++ if (argc < 5) + usage(arg0); +- return read_device(argv[2]); ++ return read_device(argv[2], argv[3], atoi(argv[4])); + } + else if (command == "-write") { +- return spawn_device(); ++ if (argc < 3) ++ usage(arg0); ++ return spawn_device(atoi(argv[2])); + } + else if (command == "-toggler") { + if (argc < 3) +diff --git a/reader.cpp b/reader.cpp +index 07fa64a..0b6de20 100644 +--- a/reader.cpp ++++ b/reader.cpp +@@ -3,10 +3,14 @@ + #include <signal.h> + #include <sys/wait.h> + #include <sys/types.h> ++#include <sys/socket.h> + #include <arpa/inet.h> + #include <stdint.h> ++#include <stdio.h> + #include <unistd.h> + #include <pthread.h> ++#include <netinet/in.h> ++#include <netdb.h> + + int64_t htonll(int64_t value){ + int num = 42; +@@ -50,26 +54,26 @@ static void *tog_func(void *ign) + #if !defined( WITH_INOTIFY ) + struct stat st; + if (lstat(toggle_file, &st) != 0) { +- cErr << "stat failed on " << toggle_file << ": " << err << endl; ++ fprintf(stderr, "stat failed on %s, %d\n", toggle_file, errno); + tog_on = false; + } + else + { + if (!S_ISFIFO(st.st_mode)) { +- cerr << "The toggle file is not a fifo, and inotify support has not been compiled in." << endl; +- cerr << "This is evil, please compile with inotify support." << endl; ++ fprintf(stderr, "The toggle file is not a fifo, and inotify support has not been compiled in.\n"); ++ fprintf(stderr, "This is evil, please compile with inotify support.\n"); + tog_on = false; + } + } + #else + inf_fd = inotify_init(); + if (inf_fd == -1) { +- cErr << "inotify_init failed: " << err << endl; ++ fprintf(stderr, "inotify_init failed: %d\n"); + tog_on = false; + } else { + watch_fd = inotify_add_watch(inf_fd, toggle_file, IN_CLOSE_WRITE | IN_CREATE); + if (watch_fd == -1) { +- cErr << "inotify_add_watch failed: " << err << endl; ++ fprintf(stderr, "inotify_add_watch failed: %d\n", err); + tog_on = false; + } + } +@@ -79,17 +83,17 @@ static void *tog_func(void *ign) + #if defined( WITH_INOTIFY ) + inotify_event iev; + if (read(inf_fd, &iev, sizeof(iev)) != (ssize_t)sizeof(iev)) { +- cErr << "Failed to read from inotify watch: " << err << endl; ++ fprintf(stderr, "Failed to read from inotify watch: %d\n", err); + break; + } + if (iev.wd != watch_fd) { +- cerr << "Inotify sent is bogus information..." << endl; ++ fprintf(stderr, "Inotify sent is bogus information...\n"); + continue; + } + #endif + tfd = open(toggle_file, O_RDONLY); + if (tfd < 0) { +- cErr << "Failed to open '" << toggle_file << "': " << err << endl; ++ fprintf(stderr, "Failed to open '%s', %d\n", toggle_file, errno); + break; + } + memset(dat, 0, sizeof(dat)); +@@ -110,22 +114,58 @@ static void *tog_func(void *ign) + static void toggle_hook() + { + if (ioctl(fd, EVIOCGRAB, (on ? (void*)1 : (void*)0)) == -1) { +- cErr << "Grab failed: " << err << endl; ++ fprintf(stderr, "Grab failed: %d\n", errno); + } + setenv("GRAB", (on ? "1" : "0"), -1); +- if (toggle_cmd) { ++ if (toggle_cmd) { + if (!fork()) { + execlp("sh", "sh", "-c", toggle_cmd, NULL); +- cErr << "Failed to run command: " << err << endl; +- exit(1); ++ fprintf(stderr, "Failed to run command: %d\n", errno); ++ exit(1); + } + +- } ++ } ++} ++ ++int socket_open(const char *hostname, int port) ++{ ++ int ret; ++ int sockfd; ++ struct sockaddr_in serv_addr; ++ struct hostent *server; ++ ++ printf("connecting to %s:%d\n", hostname, port); ++ ++ sockfd = socket(AF_INET, SOCK_STREAM, 0); ++ if (sockfd < 0) { ++ fprintf(stderr, "ERROR opening socket\n"); ++ return sockfd; ++ } ++ ++ server = gethostbyname(hostname); ++ if (server == NULL) { ++ fprintf(stderr, "ERROR, no such host\n"); ++ return -1; ++ } ++ ++ bzero((char *) &serv_addr, sizeof(serv_addr)); ++ serv_addr.sin_family = AF_INET; ++ bcopy((char *)server->h_addr, ++ (char *)&serv_addr.sin_addr.s_addr, ++ server->h_length); ++ serv_addr.sin_port = htons(port); ++ ret = connect(sockfd,(struct sockaddr *)&serv_addr,sizeof(serv_addr)); ++ if (ret < 0) { ++ fprintf(stderr, "ERROR connecting %d, %d\n", ret, errno); ++ return ret; ++ } ++ return sockfd; + } + +-int read_device(const char *devfile) ++int read_device_new(const char *devfile, const char *hostname, int port) + { + struct input_event ev; ++ int sock_fd; + size_t i; + ssize_t s; + //int e = 0; +@@ -136,14 +176,13 @@ int read_device(const char *devfile) + + if (fd < 0) { + std::string err(strerror(errno)); +- cerr << "Failed to open device '" << devfile << "': " << err << endl; ++ fprintf(stderr, "Failed to open device '%s', %d\n", devfile, errno); + return 1; + } + + if (on) { + if (ioctl(fd, EVIOCGRAB, (void*)1) == -1) { +- std::string err(strerror(errno)); +- cerr << "Failed to grab device: " << err << endl; ++ fprintf(stderr, "Failed to grab device: %d\n", errno); + } + setenv("GRAB", "1", -1); + } +@@ -154,59 +193,54 @@ int read_device(const char *devfile) + memset(&dev, 0, sizeof(dev)); + + if (ioctl(fd, EVIOCGNAME(sizeof(dev.name)), dev.name) == -1) { +- cErr << "Failed to get device name: " << err << endl; ++ fprintf(stderr, "Failed to get device name: %d\n", errno); + goto error; + } + + if (ioctl(fd, EVIOCGID, &dev.id) == -1) { +- cErr << "Failed to get device id: " << err << endl; ++ fprintf(stderr, "Failed to get device id: %d\n", errno); + goto error; + } + +- cerr << " Device: " << dev.name << endl; +- cerr << " Id: " << dev.id.version << endl; +- cerr << "BusType: " << dev.id.bustype << endl; ++ fprintf(stderr, " Device: %s\n", dev.name); ++ fprintf(stderr, " Id: %d\n", dev.id.version); ++ fprintf(stderr, "BusType: %d\n", dev.id.bustype); ++ ++ sock_fd = socket_open(hostname, port); ++ if (sock_fd < 0) ++ goto error; + + // First thing to write is the size of the structures as a 16 bit uint! + uint16_t strsz; + strsz = htons(sizeof(dev)); +- if (!cout.write((const char*)&strsz, sizeof(strsz))) +- exit(1); +- if (cout.eof()) +- exit(0); +- +- if (!cout.write(dev.name, sizeof(dev.name))) +- exit(1); +- if (cout.eof()) +- exit(0); +- if (!cout.write((const char*)&dev.id, sizeof(dev.id))) +- exit(1); +- if (cout.eof()) +- exit(0); +- +- cerr << "Getting input bits." << endl; ++ if (!write(sock_fd, (const char*)&strsz, sizeof(strsz))) ++ goto err_close; ++ ++ if (!write(sock_fd, dev.name, sizeof(dev.name))) ++ goto err_close; ++ ++ if (!write(sock_fd, (const char*)&dev.id, sizeof(dev.id))) ++ goto err_close; ++ ++ fprintf(stderr, "Getting input bits.\n"); + if (ioctl(fd, EVIOCGBIT(0, sizeof(input_bits)), &input_bits) == -1) { +- cErr << "Failed to get input-event bits: " << err << endl; ++ fprintf(stderr, "Failed to get input-event bits: %d\n", errno); + goto error; + } +- if (!cout.write((const char*)input_bits, sizeof(input_bits))) +- exit(1); +- if (cout.eof()) +- exit(0); ++ if (!write(sock_fd, (const char*)input_bits, sizeof(input_bits))) ++ goto err_close; + + #define TransferBitsFor(REL, rel, REL_MAX) \ + do { \ + if (testbit(input_bits, EV_##REL)) { \ + unsigned char bits##rel[1+REL_MAX/8]; \ +- cerr << "Getting " #rel "-bits." << endl; \ ++ fprintf(stderr, "Getting " #rel "-bits.\n"); \ + if (ioctl(fd, EVIOCGBIT(EV_##REL, sizeof(bits##rel)), bits##rel) == -1) { \ +- cErr << "Failed to get " #rel " bits: " << err << endl; \ ++ fprintf(stderr, "Failed to get " #rel " bits: %d\n", errno); \ + goto error; \ + } \ +- if (!cout.write((const char*)&bits##rel, sizeof(bits##rel))) \ +- exit(1); \ +- if (cout.eof()) \ +- exit(0); \ ++ if (!write(sock_fd, (const char*)&bits##rel, sizeof(bits##rel))) \ ++ goto err_close; \ + } \ + } while(0) + +@@ -220,16 +254,14 @@ int read_device(const char *devfile) + #define TransferDataFor(KEY, key, KEY_MAX) \ + do { \ + if (testbit(input_bits, EV_##KEY)) { \ +- cerr << "Getting " #key "-state." << endl; \ ++ fprintf(stderr, "Getting " #key "-state.\n"); \ + unsigned char bits##key[1+KEY_MAX/8]; \ + if (ioctl(fd, EVIOCG##KEY(sizeof(bits##key)), bits##key) == -1) { \ +- cErr << "Failed to get " #key " state: " << err << endl; \ ++ fprintf(stderr, "Failed to get " #key " state: %d\n", errno); \ + goto error; \ + } \ +- if (!cout.write((const char*)bits##key, sizeof(bits##key))) \ +- exit(1); \ +- if (cout.eof()) \ +- exit(0); \ ++ if (!write(sock_fd, (const char*)bits##key, sizeof(bits##key))) \ ++ goto err_close; \ + } \ + } while(0) + +@@ -239,39 +271,35 @@ int read_device(const char *devfile) + + if (testbit(input_bits, EV_ABS)) { + struct input_absinfo ai; +- cerr << "Getting abs-info." << endl; ++ fprintf(stderr, "Getting abs-info.\n"); + for (i = 0; i < ABS_MAX; ++i) { + if (ioctl(fd, EVIOCGABS(i), &ai) == -1) { +- cErr << "Failed to get device id: " << err << endl; ++ fprintf(stderr, "Failed to get device id: %d\n", errno); + goto error; + } +- if (!cout.write((const char*)&ai, sizeof(ai))) +- exit(1); +- if (cout.eof()) +- exit(0); ++ if (!write(sock_fd, (const char*)&ai, sizeof(ai))) ++ goto err_close; + } + } + +- cout.flush(); +- + if (toggle_file) { + if (pthread_create(&tog_thread, 0, &tog_func, 0) != 0) { +- cErr << "Failed to create toggling-thread: " << err << endl; ++ fprintf(stderr, "Failed to create toggling-thread: %d\n", errno); + goto error; + } + } + +- cerr << "Transferring input events." << endl; ++ fprintf(stderr, "Transferring input events.\n"); + while (running) { + int dummy; + waitpid(0, &dummy, WNOHANG); + s = read(fd, &ev, sizeof(ev)); + if (!s) { +- cerr << "EOF" << endl; ++ fprintf(stderr, "EOF\n"); + break; + } + else if (s < 0) { +- cErr << "When reading from device: " << err << endl; ++ fprintf(stderr, "When reading from device: %d\n", errno); + goto error; + } + +@@ -282,20 +310,22 @@ int read_device(const char *devfile) + } + else if (on) { + input_event_t et; ++ ++ //fprintf(stderr, "EV %d.%06d: type %d, code %d, value %d\n", ++ // (int)ev.time.tv_sec, (int)ev.time.tv_usec, (int)ev.type, ev.code, ev.value); + et.tv_sec = htonll(ev.time.tv_sec); + et.tv_usec = htonl(ev.time.tv_usec); + et.type = htons(ev.type); + et.code = htons(ev.code); + et.value = htonl(ev.value); +- if (!cout.write((const char*)&et, sizeof(et))) +- exit(1); +- if (cout.eof()) +- exit(0); +- cout.flush(); ++ if (!write(sock_fd, (const char*)&et, sizeof(et))) ++ goto err_close; + } + } + + goto end; ++err_close: ++ close(sock_fd); + error: + //e = 1; + end: +@@ -306,3 +336,12 @@ end: + + return 0; + } ++ ++int read_device(const char *devfile, const char *hostname, int port) ++{ ++ while (1) { ++ read_device_new(devfile, hostname, port); ++ sleep(1); ++ } ++ return 0; ++} +\ No newline at end of file +diff --git a/write.cpp b/write.cpp +index 91c956c..dc6c3bc 100644 +--- a/write.cpp ++++ b/write.cpp +@@ -1,9 +1,13 @@ + #include "main.h" + #include <sys/wait.h> + #include <sys/types.h> ++#include <sys/socket.h> + #include <arpa/inet.h> + #include <stdint.h> ++#include <stdio.h> + #include <unistd.h> ++#include <netinet/in.h> ++#include <netdb.h> + + int64_t ntohll(int64_t value){ + int num = 42; +@@ -22,12 +26,55 @@ static const size_t uinput_cnt = sizeof(uinput_file) / sizeof(uinput_file[0]); + + static uint16_t strsz; + +-int spawn_device() ++int socket_start_listen(int port) ++{ ++ int ret; ++ int sockfd; ++ struct sockaddr_in serv_addr; ++ ++ printf("starting on port %d\n", port); ++ ++ sockfd = socket(AF_INET, SOCK_STREAM, 0); ++ if (sockfd < 0) { ++ fprintf(stderr, "ERROR opening socket %d", sockfd); ++ return sockfd; ++ } ++ bzero((char *) &serv_addr, sizeof(serv_addr)); ++ serv_addr.sin_family = AF_INET; ++ serv_addr.sin_addr.s_addr = INADDR_ANY; ++ serv_addr.sin_port = htons(port); ++ ret = bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)); ++ if (ret < 0) { ++ fprintf(stderr, "ERROR on binding %d", ret); ++ return ret; ++ } ++ listen(sockfd, 1); ++ return sockfd; ++} ++ ++int socket_wait_connection(int sockfd) ++{ ++ int newsockfd; ++ struct sockaddr_in cli_addr; ++ socklen_t clilen; ++ ++ clilen = sizeof(cli_addr); ++ newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, &clilen); ++ if (newsockfd < 0) { ++ fprintf(stderr, "ERROR on accept %d", newsockfd); ++ return newsockfd; ++ } ++ return newsockfd; ++} ++ ++int spawn_device_new(int sock_con) + { + int e; + int fd; +- size_t i; ++ int i; + ssize_t si; ++ struct uinput_user_dev dev; ++ struct input_event ev; + + for (i = 0; i < uinput_cnt; ++i) { + fd = open(uinput_file[i], O_WRONLY | O_NDELAY); +@@ -36,30 +83,28 @@ int spawn_device() + } + + if (i >= uinput_cnt) { +- cerr << "Failed to open uinput device file. Please specify." << endl; ++ fprintf(stderr, "Failed to open uinput device file. Please specify.\n"); + return 1; + } + +- struct uinput_user_dev dev; +- struct input_event ev; +- +- cin.read((char*)&strsz, sizeof(strsz)); ++ read(sock_con, (char*)&strsz, sizeof(strsz)); + strsz = ntohs(strsz); + if (strsz != sizeof(uinput_user_dev)) { +- cerr << "Device information field sizes do not match. Sorry." << endl; +- return 1; ++ fprintf(stderr, "Device information field sizes do not match (%d != %d). Sorry.\n", ++ strsz, (int)sizeof(uinput_user_dev)); ++ goto err_close; + } + + memset(&dev, 0, sizeof(dev)); +- cin.read((char*)dev.name, sizeof(dev.name)); +- cin.read((char*)&dev.id, sizeof(dev.id)); ++ read(sock_con, dev.name, sizeof(dev.name)); ++ read(sock_con, &dev.id, sizeof(dev.id)); + +- cin.read((char*)input_bits, sizeof(input_bits)); ++ read(sock_con, input_bits, sizeof(input_bits)); + for (i = 0; i < EV_MAX; ++i) { + if (!testbit(input_bits, i)) + continue; + if (ioctl(fd, UI_SET_EVBIT, i) == -1) { +- cErr << "Failed to set evbit " << i << ": " << err << endl; ++ fprintf(stderr, "Failed to set evbit %d, %d\n", i, errno); + goto error; + } + } +@@ -68,13 +113,13 @@ int spawn_device() + do { \ + if (testbit(input_bits, EV_##REL)) { \ + unsigned char bits##rel[1+REL_MAX/8]; \ +- cerr << "Reading " #rel "-bits" << endl; \ +- cin.read((char*)bits##rel, sizeof(bits##rel)); \ ++ fprintf(stderr, "Reading " #rel "-bits\n"); \ ++ read(sock_con, (char*)bits##rel, sizeof(bits##rel)); \ + for (i = 0; i < REL_MAX; ++i) { \ + if (!testbit(bits##rel, i)) continue; \ + if (ioctl(fd, UI_SET_##RELBIT, i) == -1) { \ +- cErr << "Failed to set " #rel "-bit: " << i << ": " << err << endl; \ +- goto error; \ ++ fprintf(stderr, "Failed to set " #rel "-bit: %d, %d\n", i, errno); \ ++ goto err_close; \ + } \ + } \ + } \ +@@ -91,13 +136,13 @@ int spawn_device() + do { \ + if (testbit(input_bits, EV_##KEY)) { \ + unsigned char bits##key[1+KEY_MAX/8]; \ +- cerr << "Reading " #key "-data" << endl; \ +- cin.read((char*)bits##key, sizeof(bits##key)); \ ++ fprintf(stderr, "Reading " #key "-data\n"); \ ++ read(sock_con, (char*)bits##key, sizeof(bits##key)); \ + for (i = 0; i < KEY_MAX; ++i) { \ + if (!testbit(bits##key, i)) continue; \ + if (ioctl(fd, UI_SET_##KEYBIT, i) == -1) { \ +- cErr << "Failed to activate " #key "-bit: " << i << ": " << err << endl; \ +- goto error; \ ++ fprintf(stderr, "Failed to activate " #key "-bit: %d, %d\n", i, errno); \ ++ goto err_close; \ + } \ + } \ + } \ +@@ -110,7 +155,7 @@ int spawn_device() + if (testbit(input_bits, EV_ABS)) { + struct input_absinfo ai; + for (i = 0; i < ABS_MAX; ++i) { +- cin.read((char*)&ai, sizeof(ai)); ++ read(sock_con, (char*)&ai, sizeof(ai)); + dev.absmin[i] = ai.minimum; + dev.absmax[i] = ai.maximum; + } +@@ -118,22 +163,22 @@ int spawn_device() + + si = write(fd, &dev, sizeof(dev)); + if (si < (ssize_t)sizeof(dev)) { +- cErr << "Failed to write initial data to device: " << err << endl; +- goto error; ++ fprintf(stderr, "Failed to write initial data to device: %d\n", errno); ++ goto err_close; + } + + if (ioctl(fd, UI_DEV_CREATE) == -1) { +- cErr << "Failed to create device: " << err << endl; +- goto error; ++ fprintf(stderr, "Failed to create device: %d\n", errno); ++ goto err_close; + } + +- cerr << "Transferring input events." << endl; ++ fprintf(stderr, "Transferring input events.\n"); + while (true) { + input_event_t et; + int dummy; + waitpid(0, &dummy, WNOHANG); +- if (!cin.read((char*)&et, sizeof(et))) { +- cerr << "End of data" << endl; ++ if (!read(sock_con, (char*)&et, sizeof(et))) { ++ fprintf(stderr, "End of data\n"); + break; + } + ev.time.tv_sec = ntohll(et.tv_sec); +@@ -141,16 +186,21 @@ int spawn_device() + ev.type = ntohs(et.type); + ev.code = ntohs(et.code); + ev.value = ntohl(et.value); +- //cErr << "EV " << ev.time.tv_sec << "." << ev.time.tv_usec << ": type " << ev.type << ", code " << ev.code << ", value " << ev.value << endl; ++ //fprintf(stderr, "EV %d.%06d: type %d, code %d, value %d\n", ++ // (int)ev.time.tv_sec, (int)ev.time.tv_usec, (int)ev.type, ev.code, ev.value); + if (hotkey_hook(ev.type, ev.code, ev.value)) + continue; + if (write(fd, &ev, sizeof(ev)) < (ssize_t)sizeof(ev)) { +- cErr << "Write error: " << err << endl; +- goto error; ++ fprintf(stderr, "Write error: %d\n", errno); ++ goto err_close; + } + } + + goto end; ++ ++err_close: ++ if (sock_con > 0) ++ close(sock_con); + error: + e = 1; + end: +@@ -159,3 +209,28 @@ end: + + return e; + } ++ ++int spawn_device(int port) ++{ ++ int ret; ++ int sock_listen, sock_con; ++ printf("...%d\n", port); ++ ++ sock_listen = socket_start_listen(port); ++ if (sock_listen < 0) ++ return sock_listen; ++ ++ printf("Got connection on port %d\n", port); ++ while(1) { ++ sock_con = socket_wait_connection(sock_listen); ++ if (sock_con < 0) ++ goto err_close; ++ ret = spawn_device_new(sock_con); ++ printf("connection closed %d\n", ret); ++ sleep(1); ++ } ++ return 0; ++err_close: ++ close(sock_listen); ++ return -1; ++} +\ No newline at end of file +-- +2.7.4 + diff --git a/meta-rcar-gen3-adas/recipes-support/netevent/netevent/0004-Add-TCP-keep-alive-to-handle-peer-death-properly.patch b/meta-rcar-gen3-adas/recipes-support/netevent/netevent/0004-Add-TCP-keep-alive-to-handle-peer-death-properly.patch new file mode 100644 index 0000000..f84f113 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/netevent/netevent/0004-Add-TCP-keep-alive-to-handle-peer-death-properly.patch @@ -0,0 +1,162 @@ +From 0d797dca82a714688657523a89a14c37ae7767cf Mon Sep 17 00:00:00 2001 +From: Grigory Kletsko <grigory.kletsko@cogentembedded.com> +Date: Wed, 5 Oct 2016 22:15:25 +0300 +Subject: [PATCH] Add TCP keep alive to handle peer death properly + +--- + reader.cpp | 32 +++++++++++++++++++++++++++++++- + write.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++-- + 2 files changed, 75 insertions(+), 3 deletions(-) + +diff --git a/reader.cpp b/reader.cpp +index 0b6de20..e1a26e3 100644 +--- a/reader.cpp ++++ b/reader.cpp +@@ -11,6 +11,8 @@ + #include <pthread.h> + #include <netinet/in.h> + #include <netdb.h> ++#include <netinet/in.h> ++#include <netinet/tcp.h> + + int64_t htonll(int64_t value){ + int num = 42; +@@ -131,6 +133,8 @@ int socket_open(const char *hostname, int port) + { + int ret; + int sockfd; ++ int val; ++ + struct sockaddr_in serv_addr; + struct hostent *server; + +@@ -159,6 +163,32 @@ int socket_open(const char *hostname, int port) + fprintf(stderr, "ERROR connecting %d, %d\n", ret, errno); + return ret; + } ++ ++ val = 5; ++ ret = setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPCNT, &val, ++ sizeof(val)); ++ if (ret < 0) { ++ fprintf(stderr, "ERROR on setsockopt %d", ret); ++ return ret; ++ } ++ ++ val = 1; ++ ret = setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE, &val, ++ sizeof(val)); ++ if (ret < 0) { ++ fprintf(stderr, "ERROR on setsockopt %d", ret); ++ return ret; ++ } ++ ++ val = 1; ++ ret = setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL, &val, ++ sizeof(val)); ++ if (ret < 0) { ++ fprintf(stderr, "ERROR on setsockopt %d", ret); ++ return ret; ++ } ++ ++ + return sockfd; + } + +@@ -344,4 +374,4 @@ int read_device(const char *devfile, const char *hostname, int port) + sleep(1); + } + return 0; +-} +\ No newline at end of file ++} +diff --git a/write.cpp b/write.cpp +index dc6c3bc..67ce412 100644 +--- a/write.cpp ++++ b/write.cpp +@@ -8,6 +8,9 @@ + #include <unistd.h> + #include <netinet/in.h> + #include <netdb.h> ++#include <sys/socket.h> ++#include <netinet/in.h> ++#include <netinet/tcp.h> + + int64_t ntohll(int64_t value){ + int num = 42; +@@ -30,6 +33,8 @@ int socket_start_listen(int port) + { + int ret; + int sockfd; ++ int val; ++ + struct sockaddr_in serv_addr; + + printf("starting on port %d\n", port); +@@ -48,7 +53,41 @@ int socket_start_listen(int port) + fprintf(stderr, "ERROR on binding %d", ret); + return ret; + } ++ ++ val = 1; ++ ret = setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &val, ++ sizeof(val)); ++ if (ret < 0) { ++ fprintf(stderr, "ERROR on setsockopt %d", ret); ++ return ret; ++ } ++ ++ val = 5; ++ ret = setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPCNT, &val, ++ sizeof(val)); ++ if (ret < 0) { ++ fprintf(stderr, "ERROR on setsockopt %d", ret); ++ return ret; ++ } ++ ++ val = 1; ++ ret = setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE, &val, ++ sizeof(val)); ++ if (ret < 0) { ++ fprintf(stderr, "ERROR on setsockopt %d", ret); ++ return ret; ++ } ++ ++ val = 1; ++ ret = setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL, &val, ++ sizeof(val)); ++ if (ret < 0) { ++ fprintf(stderr, "ERROR on setsockopt %d", ret); ++ return ret; ++ } ++ + listen(sockfd, 1); ++ + return sockfd; + } + +@@ -174,10 +213,13 @@ int spawn_device_new(int sock_con) + + fprintf(stderr, "Transferring input events.\n"); + while (true) { ++ int ret; + input_event_t et; + int dummy; + waitpid(0, &dummy, WNOHANG); +- if (!read(sock_con, (char*)&et, sizeof(et))) { ++ ret = read(sock_con, (char*)&et, sizeof(et)); ++ ++ if (ret <= 0) { + fprintf(stderr, "End of data\n"); + break; + } +@@ -233,4 +275,4 @@ int spawn_device(int port) + err_close: + close(sock_listen); + return -1; +-} +\ No newline at end of file ++} +-- +2.7.4 + diff --git a/meta-rcar-gen3-adas/recipes-support/netevent/netevent_git.bb b/meta-rcar-gen3-adas/recipes-support/netevent/netevent_git.bb new file mode 100644 index 0000000..7dde8f5 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/netevent/netevent_git.bb @@ -0,0 +1,29 @@ +SUMMARY = "netevent - share input devices over net" +SECTION = "misc" + +LICENSE = "CLOSED" + +PN = "netevent" +PE = "1" +PV = "0.1" +PR = "r1" + +SRC_URI = "git://github.com/Blub/netevent.git \ + file://0001-fix-endian-for-cross-arch.patch \ + file://0002-fix-cross-compile.patch \ + file://0003-use-socket-instead-of-stdout.patch \ + file://0004-Add-TCP-keep-alive-to-handle-peer-death-properly.patch \ +" + +SRCREV = "06f1fe545f2063ae882fc8b66dc07f1ced85d1da" + +S = "${WORKDIR}/git" + +B = "${S}" + +do_install() { + install -d ${D}${bindir} + + install -m 0755 netevent ${D}${bindir}/ + install -m 0755 devname ${D}${bindir}/ +} diff --git a/meta-rcar-gen3-adas/recipes-support/nlopt/nlopt.inc b/meta-rcar-gen3-adas/recipes-support/nlopt/nlopt.inc new file mode 100644 index 0000000..245fef2 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/nlopt/nlopt.inc @@ -0,0 +1,32 @@ +DESCRIPTION = "library for nonlinear optimization, wrapping many algorithms for global and local, constrained or unconstrained, optimization" +HOMEPAGE = "http://ab-initio.mit.edu/wiki/index.php/NLopt" +SECTION = "System/Libraries" +LICENSE = "LGPL-2.1 | MIT" + +LIC_FILES_CHKSUM ??= "file://COPYING;md5=7036bf07f719818948a837064b1af213" + +inherit autotools pkgconfig + +DEPENDS += "swig-native" + +# remove dead weight from the build +EXTRA_OECONF += " \ + --without-guile \ + --without-python \ + --without-octave \ + --without-matlab \ + --enable-shared \ +" + +# see https://github.com/stevengj/nlopt/issues/29 +EXTRA_OECONF += "--enable-maintainer-mode" + +EXTRA_OECONF_remove = "--disable-static" + +# see https://github.com/stevengj/nlopt/issues/9 +do_configure_prepend () { + touch ${S}/swig/nlopt.scm.in +} + +SRC_URI_append = " file://0001-Fix-compilation-error.patch" + diff --git a/meta-rcar-gen3-adas/recipes-support/nlopt/nlopt/0001-Fix-compilation-error.patch b/meta-rcar-gen3-adas/recipes-support/nlopt/nlopt/0001-Fix-compilation-error.patch new file mode 100644 index 0000000..10b3594 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/nlopt/nlopt/0001-Fix-compilation-error.patch @@ -0,0 +1,25 @@ +From 994c3fdbde7ce1b2a31d4bd3053aed7cdc857760 Mon Sep 17 00:00:00 2001 +From: Petr Nechaev <petr.nechaev@cogentembedded.com> +Date: Sat, 31 Oct 2015 15:24:11 +0300 +Subject: [PATCH 1/1] Fix compilation error + +--- + swig/Makefile.am | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/swig/Makefile.am b/swig/Makefile.am +index 5ccbfe1..d55ac28 100644 +--- a/swig/Makefile.am ++++ b/swig/Makefile.am +@@ -44,8 +44,6 @@ if MAINTAINER_MODE + + nlopt-guile.cpp nlopt.scm.in: $(SWIG_SRC) nlopt-guile.i $(HDR) + swig -I$(top_srcdir)/api -outdir $(builddir) -c++ -guile -scmstub -o $@ $(srcdir)/nlopt.i +- rm -f nlopt.scm.in +- mv nlopt.scm nlopt.scm.in + + nlopt-python.cpp nlopt.py: $(SWIG_SRC) nlopt-python.i numpy.i $(HDR) + swig -I$(top_srcdir)/api -outdir $(builddir) -c++ -python -o $@ $(srcdir)/nlopt.i +-- +2.4.3 + diff --git a/meta-rcar-gen3-adas/recipes-support/nlopt/nlopt_2.4.2.bb b/meta-rcar-gen3-adas/recipes-support/nlopt/nlopt_2.4.2.bb new file mode 100644 index 0000000..5c72a31 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/nlopt/nlopt_2.4.2.bb @@ -0,0 +1,7 @@ +require ${PN}.inc + +SRC_URI = "https://github.com/stevengj/${BPN}/archive/${BPN}-${PV}.tar.gz" +SRC_URI[md5sum] = "5f60160dd0cb0f7c4fed983940bd5224" +SRC_URI[sha256sum] = "d838b5b4b1c6b6493666ff61a8817a4ebcee924f54fb95f6f64e5f727ddbf2a6" + +S = "${WORKDIR}/${BPN}-${BPN}-${PV}" diff --git a/meta-rcar-gen3-adas/recipes-support/nlopt/nlopt_git.bb b/meta-rcar-gen3-adas/recipes-support/nlopt/nlopt_git.bb new file mode 100644 index 0000000..dd425d9 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/nlopt/nlopt_git.bb @@ -0,0 +1,8 @@ +require ${PN}.inc + +SRC_URI = "git://github.com/stevengj/${BPN}.git" +S = "${WORKDIR}/git" +SRCREV = "cc413c5491df015c93992ddedd43b222d4369b45" + +DEFAULT_PREFERENCE = "-1" + diff --git a/meta-rcar-gen3-adas/recipes-support/spacenav/libspnav/0001-libspnav-cross-compile.patch b/meta-rcar-gen3-adas/recipes-support/spacenav/libspnav/0001-libspnav-cross-compile.patch new file mode 100644 index 0000000..3a33da1 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/spacenav/libspnav/0001-libspnav-cross-compile.patch @@ -0,0 +1,42 @@ +diff -pruN libspnav-0.2.3.orig/configure libspnav-0.2.3/configure +--- libspnav-0.2.3.orig/configure 2011-11-25 18:36:43.000000000 -0800 ++++ libspnav-0.2.3/configure 2016-03-18 04:46:31.327083251 -0700 +@@ -8,7 +8,7 @@ DBG=yes + X11=yes + + srcdir="`dirname "$0"`" +-libdir=lib ++libdir=lib64 + + #if [ "`uname -m`" = 'x86_64' ]; then + # libdir=lib64 +diff -pruN libspnav-0.2.3.orig/Makefile.in libspnav-0.2.3/Makefile.in +--- libspnav-0.2.3.orig/Makefile.in 2014-08-17 18:38:31.000000000 -0700 ++++ libspnav-0.2.3/Makefile.in 2016-03-18 04:46:31.339083251 -0700 +@@ -8,10 +8,11 @@ lib_a = lib$(name).a + incpaths = -I. -I/usr/local/include -I/usr/X11R6/include + libpaths = -L/usr/local/lib -L/usr/X11R6/lib + +-CC = gcc +-AR = ar +-CFLAGS = $(opt) $(dbg) -std=c89 $(pic) -pedantic -Wall -fno-strict-aliasing $(incpaths) $(user_cflags) +-LDFLAGS = $(libpaths) $(user_ldflags) $(xlib) ++CC ?= gcc ++AR ?= ar ++CFLAGS ?= -std=c89 -pedantic -Wall -fno-strict-aliasing ++CFLAGS += $(opt) $(dbg) $(pic) -I. $(user_cflags) ++LDFLAGS ?= $(libpaths) $(user_ldflags) $(xlib) + + ifeq ($(shell uname -s), Darwin) + lib_so = libspnav.dylib +@@ -54,8 +55,8 @@ install: $(lib_a) $(lib_so) + cp $(lib_so) $(DESTDIR)$(PREFIX)/$(libdir)/$(lib_so) + [ -n "$(soname)" ] && \ + rm -f $(DESTDIR)$(PREFIX)/$(libdir)/$(soname) $(DESTDIR)$(PREFIX)/$(libdir)/$(devlink) && \ +- ln -s $(DESTDIR)$(PREFIX)/$(libdir)/$(lib_so) $(DESTDIR)$(PREFIX)/$(libdir)/$(soname) && \ +- ln -s $(DESTDIR)$(PREFIX)/$(libdir)/$(soname) $(DESTDIR)$(PREFIX)/$(libdir)/$(devlink) || \ ++ ln -s $(lib_so) $(DESTDIR)$(PREFIX)/$(libdir)/$(soname) && \ ++ ln -s $(soname) $(DESTDIR)$(PREFIX)/$(libdir)/$(devlink) || \ + true + for h in $(hdr); do cp -p $(srcdir)/$$h $(DESTDIR)$(PREFIX)/include/; done + diff --git a/meta-rcar-gen3-adas/recipes-support/spacenav/libspnav/0002-Fix-configuration-for-libdir.patch b/meta-rcar-gen3-adas/recipes-support/spacenav/libspnav/0002-Fix-configuration-for-libdir.patch new file mode 100644 index 0000000..8976eb6 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/spacenav/libspnav/0002-Fix-configuration-for-libdir.patch @@ -0,0 +1,87 @@ +From c79af49c33f8ce705f63dee9dbc48cd716064e98 Mon Sep 17 00:00:00 2001 +From: Andrey Vostrikov <andrey.vostrikov@cogentembedded.com> +Date: Fri, 22 Apr 2016 13:38:21 +0300 +Subject: [PATCH] Fix configuration for libdir + +Signed-off-by: Andrey Vostrikov <andrey.vostrikov@cogentembedded.com> +--- + Makefile.in | 18 +++++++++--------- + configure | 13 +++++++------ + 2 files changed, 16 insertions(+), 15 deletions(-) + +diff --git a/Makefile.in b/Makefile.in +index eb996a9..6808e44 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -50,22 +50,22 @@ distclean: + + .PHONY: install + install: $(lib_a) $(lib_so) +- mkdir -p $(DESTDIR)$(PREFIX)/$(libdir) $(DESTDIR)$(PREFIX)/include +- cp $(lib_a) $(DESTDIR)$(PREFIX)/$(libdir)/$(lib_a) +- cp $(lib_so) $(DESTDIR)$(PREFIX)/$(libdir)/$(lib_so) ++ mkdir -p $(DESTDIR)/$(libdir) $(DESTDIR)$(PREFIX)/include ++ cp $(lib_a) $(DESTDIR)/$(libdir)/$(lib_a) ++ cp $(lib_so) $(DESTDIR)/$(libdir)/$(lib_so) + [ -n "$(soname)" ] && \ +- rm -f $(DESTDIR)$(PREFIX)/$(libdir)/$(soname) $(DESTDIR)$(PREFIX)/$(libdir)/$(devlink) && \ +- ln -s $(lib_so) $(DESTDIR)$(PREFIX)/$(libdir)/$(soname) && \ +- ln -s $(soname) $(DESTDIR)$(PREFIX)/$(libdir)/$(devlink) || \ ++ rm -f $(DESTDIR)/$(libdir)/$(soname) $(DESTDIR)/$(libdir)/$(devlink) && \ ++ ln -s $(lib_so) $(DESTDIR)/$(libdir)/$(soname) && \ ++ ln -s $(soname) $(DESTDIR)/$(libdir)/$(devlink) || \ + true + for h in $(hdr); do cp -p $(srcdir)/$$h $(DESTDIR)$(PREFIX)/include/; done + + .PHONY: uninstall + uninstall: +- rm -f $(DESTDIR)$(PREFIX)/$(libdir)/$(lib_a) +- rm -f $(DESTDIR)$(PREFIX)/$(libdir)/$(lib_so) ++ rm -f $(DESTDIR)/$(libdir)/$(lib_a) ++ rm -f $(DESTDIR)/$(libdir)/$(lib_so) + [ -n "$(soname)" ] && \ +- rm -f $(DESTDIR)$(PREFIX)/$(libdir)/$(soname) $(DESTDIR)$(PREFIX)/$(libdir)/$(devlink) || \ ++ rm -f $(DESTDIR)/$(libdir)/$(soname) $(DESTDIR)/$(libdir)/$(devlink) || \ + true + for i in $(hdr); do rm -f $(DESTDIR)$(PREFIX)/include/$$i; done + +diff --git a/configure b/configure +index 6f85fec..7f6289d 100755 +--- a/configure ++++ b/configure +@@ -8,18 +8,18 @@ DBG=yes + X11=yes + + srcdir="`dirname "$0"`" +-libdir=lib64 +- +-#if [ "`uname -m`" = 'x86_64' ]; then +-# libdir=lib64 +-#fi +- ++libdir=/usr/lib ++echo "initial $prefix" + for arg; do + case "$arg" in + --prefix=*) + value=`echo $arg | sed 's/--prefix=//'` + PREFIX=${value:-$prefix} + ;; ++ --libdir=*) ++ value=`echo $arg | sed 's/--libdir=//'` ++ libdir=${value:-$libdir} ++ ;; + + --enable-opt) + OPT=yes;; +@@ -53,6 +53,7 @@ for arg; do + done + + echo " prefix: $PREFIX" ++echo " libdir: $libdir" + echo " optimize for speed: $OPT" + echo " include debugging symbols: $DBG" + echo " x11 communication method: $X11" +-- +2.1.4 + diff --git a/meta-rcar-gen3-adas/recipes-support/spacenav/libspnav/libspnav-0.2.3.tar.gz b/meta-rcar-gen3-adas/recipes-support/spacenav/libspnav/libspnav-0.2.3.tar.gz Binary files differnew file mode 100644 index 0000000..ed9da47 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/spacenav/libspnav/libspnav-0.2.3.tar.gz diff --git a/meta-rcar-gen3-adas/recipes-support/spacenav/libspnav_0.2.3.bb b/meta-rcar-gen3-adas/recipes-support/spacenav/libspnav_0.2.3.bb new file mode 100644 index 0000000..8586a7c --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/spacenav/libspnav_0.2.3.bb @@ -0,0 +1,24 @@ +SUMMARY = "SpaceNavigator 3D-mouse daemon interface library" +SECTION = "libs/multimedia" +LICENSE = "BSD" +LIC_FILES_CHKSUM = "file://README;md5=a8f5600270c9340ba8f2d956133a91d3" + +SRC_URI = " \ + file://libspnav-0.2.3.tar.gz \ + file://0001-libspnav-cross-compile.patch \ + file://0002-Fix-configuration-for-libdir.patch \ +" + +SRC_URI[md5sum] = "44d840540d53326d4a119c0f1aa7bf0a" +SRC_URI[sha256sum] = "7ae4d7bb7f6a5dda28b487891e01accc856311440f582299760dace6ee5f1f93" + +S = "${WORKDIR}/libspnav-${PV}" + +inherit autotools pkgconfig + +B = "${WORKDIR}/libspnav-${PV}" + +# Disable X11 protocol +EXTRA_OECONF = "--disable-x11" + +FILES_${PN} = " ${libdir} " diff --git a/meta-rcar-gen3-adas/recipes-support/spacenav/spacenavd/0001-spacenavd-cross-compile.patch b/meta-rcar-gen3-adas/recipes-support/spacenav/spacenavd/0001-spacenavd-cross-compile.patch new file mode 100644 index 0000000..ed4cc51 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/spacenav/spacenavd/0001-spacenavd-cross-compile.patch @@ -0,0 +1,95 @@ +diff -pruN spacenavd-0.6.orig/configure spacenavd-0.6/configure +--- spacenavd-0.6.orig/configure 2012-05-16 20:56:12.000000000 -0700 ++++ spacenavd-0.6/configure 2016-03-18 04:35:24.259067397 -0700 +@@ -154,25 +154,25 @@ cat "$srcdir/Makefile.in" >>Makefile + + # create config.h + echo 'creating config.h' +-echo '#ifndef CONFIG_H_' >src/config.h +-echo '#define CONFIG_H_' >>src/config.h +-echo >>src/config.h ++echo '#ifndef CONFIG_H_' >$srcdir/src/config.h ++echo '#define CONFIG_H_' >>$srcdir/src/config.h ++echo >>$srcdir/src/config.h + if [ "$X11" = yes ]; then +- echo '#define USE_X11' >>src/config.h +- echo >>src/config.h ++ echo '#define USE_X11' >>$srcdir/src/config.h ++ echo >>$srcdir/src/config.h + fi + if [ "$HOTPLUG" = yes ]; then +- echo '#define USE_NETLINK' >>src/config.h +- echo >>src/config.h ++ echo '#define USE_NETLINK' >>$srcdir/src/config.h ++ echo >>$srcdir/src/config.h + fi +-echo '#define VERSION "'$VER'"' >>src/config.h +-echo >>src/config.h ++echo '#define VERSION "'$VER'"' >>$srcdir/src/config.h ++echo >>$srcdir/src/config.h + + # check for alloca.h +-check_header alloca.h >>src/config.h ++check_header alloca.h >>$srcdir/src/config.h + +-echo >>src/config.h +-echo '#endif /* CONFIG_H_ */' >>src/config.h ++echo >>$srcdir/src/config.h ++echo '#endif /* CONFIG_H_ */' >>$srcdir/src/config.h + + echo '' + echo 'Done. You can now type make (or gmake) to compile spacenavd.' +diff -pruN spacenavd-0.6.orig/Makefile.in spacenavd-0.6/Makefile.in +--- spacenavd-0.6.orig/Makefile.in 2013-06-25 17:12:28.000000000 -0700 ++++ spacenavd-0.6/Makefile.in 2016-03-18 04:44:10.451079903 -0700 +@@ -1,14 +1,14 @@ +-src = $(wildcard src/*.c) $(wildcard src/serial/*.c) $(wildcard src/magellan/*.c) +-hdr = $(wildcard src/*.h) $(wildcard src/serial/*.h) $(wildcard src/magellan/*.h) ++src = $(wildcard $(srcdir)/src/*.c) $(wildcard $(srcdir)/src/serial/*.c) $(wildcard $(srcdir)/src/magellan/*.c) ++hdr = $(wildcard $(srcdir)/src/*.h) $(wildcard $(srcdir)/src/serial/*.h) $(wildcard $(srcdir)/src/magellan/*.h) + obj = $(src:.c=.o) + dep = $(obj:.o=.d) + bin = spacenavd +-ctl = spnavd_ctl + +-CC = gcc ++CC ?= gcc + INSTALL = install +-CFLAGS = -pedantic -Wall $(dbg) $(opt) -fno-strict-aliasing -I$(srcdir)/src -I/usr/local/include $(add_cflags) +-LDFLAGS = -L/usr/local/lib $(xlib) $(add_ldflags) ++CFLAGS ?= -pedantic -Wall -fno-strict-aliasing -I/usr/local/include $(add_cflags) ++CFLAGS += $(dbg) $(opt) -I$(srcdir)/src ++LDFLAGS ?= -L/usr/local/lib $(xlib) $(add_ldflags) + + $(bin): $(obj) + $(CC) -o $@ $(obj) $(LDFLAGS) +@@ -36,7 +36,6 @@ cleandep: + install: $(bin) + $(INSTALL) -d $(DESTDIR)$(PREFIX)/bin + $(INSTALL) -m 755 $(bin) $(DESTDIR)$(PREFIX)/bin/$(bin) +- $(INSTALL) -m 755 $(srcdir)/$(ctl) $(DESTDIR)$(PREFIX)/bin/$(ctl) + cd $(srcdir) && ./setup_init --no-install + + # [ -d /etc/hal/fdi/policy ] && \ +@@ -45,7 +44,5 @@ install: $(bin) + .PHONY: uninstall + uninstall: + rm -f $(DESTDIR)$(PREFIX)/bin/$(bin) +- rm -f $(DESTDIR)$(PREFIX)/bin/$(ctl) +- rm -f $(DESTDIR)/etc/hal/fdi/policy/spacenav.fdi + + # cd $(srcdir) && ./setup_init remove +diff -pruN spacenavd-0.6.orig/src/config.h spacenavd-0.6/src/config.h +--- spacenavd-0.6.orig/src/config.h 1969-12-31 16:00:00.000000000 -0800 ++++ spacenavd-0.6/src/config.h 2016-03-18 04:35:24.295067398 -0700 +@@ -0,0 +1,10 @@ ++#ifndef CONFIG_H_ ++#define CONFIG_H_ ++ ++#define USE_NETLINK ++ ++#define VERSION "" ++ ++#define HAVE_ALLOCA_H ++ ++#endif /* CONFIG_H_ */ diff --git a/meta-rcar-gen3-adas/recipes-support/spacenav/spacenavd/0002-Fix-build-configuration.patch b/meta-rcar-gen3-adas/recipes-support/spacenav/spacenavd/0002-Fix-build-configuration.patch new file mode 100644 index 0000000..a2500b9 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/spacenav/spacenavd/0002-Fix-build-configuration.patch @@ -0,0 +1,27 @@ +From 10138bf87a7d4c23ce3c067455fb299410b37a49 Mon Sep 17 00:00:00 2001 +From: Andrey Vostrikov <andrey.vostrikov@cogentembedded.com> +Date: Fri, 22 Apr 2016 13:36:28 +0300 +Subject: [PATCH] Fix build configuration + +Signed-off-by: Andrey Vostrikov <andrey.vostrikov@cogentembedded.com> +--- + Makefile.in | 6 +++--- + configure | 16 ++++++++-------- + 2 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/Makefile.in b/Makefile.in +index 27d1a21..48dc517 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -8,7 +8,7 @@ CC ?= gcc + INSTALL = install + CFLAGS ?= -pedantic -Wall -fno-strict-aliasing -I/usr/local/include $(add_cflags) + CFLAGS += $(dbg) $(opt) -I$(srcdir)/src +-LDFLAGS ?= -L/usr/local/lib $(xlib) $(add_ldflags) ++LDFLAGS ?= -L/usr/lib64 $(xlib) $(add_ldflags) + + $(bin): $(obj) + $(CC) -o $@ $(obj) $(LDFLAGS) +diff --git a/configure b/configure +index 2795a3c..c016b33 100755 + diff --git a/meta-rcar-gen3-adas/recipes-support/spacenav/spacenavd/spacenavd-0.6.tar.gz b/meta-rcar-gen3-adas/recipes-support/spacenav/spacenavd/spacenavd-0.6.tar.gz Binary files differnew file mode 100644 index 0000000..fa9fa37 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/spacenav/spacenavd/spacenavd-0.6.tar.gz diff --git a/meta-rcar-gen3-adas/recipes-support/spacenav/spacenavd/spacenavd.service b/meta-rcar-gen3-adas/recipes-support/spacenav/spacenavd/spacenavd.service new file mode 100644 index 0000000..46302a6 --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/spacenav/spacenavd/spacenavd.service @@ -0,0 +1,13 @@ +[Unit] +Description=Spacenavd startup +RequiresMountsFor=/run + +[Service] +User=root +EnvironmentFile=-/etc/default/spacenavd +ExecStart=/usr/bin/spacenavd $OPTARGS +Type=forking + +[Install] +WantedBy=multi-user.target + diff --git a/meta-rcar-gen3-adas/recipes-support/spacenav/spacenavd_0.6.bb b/meta-rcar-gen3-adas/recipes-support/spacenav/spacenavd_0.6.bb new file mode 100644 index 0000000..943aa9a --- /dev/null +++ b/meta-rcar-gen3-adas/recipes-support/spacenav/spacenavd_0.6.bb @@ -0,0 +1,39 @@ +SUMMARY = "Userspace library to SpaceNavigator 3D-mouse" +SECTION = "libs/multimedia" +LICENSE = "GPLv3" +LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" + +BBCLASSEXTEND = "native nativesdk" + +SRC_URI = " \ + file://spacenavd-0.6.tar.gz \ + file://0001-spacenavd-cross-compile.patch \ + file://0002-Fix-build-configuration.patch \ +" + +SRC_URI[md5sum] = "7e2c04fb8dbb7d39b9ee7b64565e0c4f" +SRC_URI[sha256sum] = "c2d203bf96c5a959590146a43fe5d6e5e8c5c38a8b2f55aa199d967d0d88d0ab" + +S = "${WORKDIR}/spacenavd-${PV}" +B = "${S}" + +inherit autotools pkgconfig useradd systemd + +# Don't configure udev by default since it will cause a circular +# dependecy with udev package, which depends on libusb +EXTRA_OECONF = " --disable-x11" + +SRC_URI_append = " file://spacenavd.service" + +SYSTEMD_SERVICE_${PN} = "spacenavd.service" + +USERADD_PACKAGES = "${PN}" +GROUPADD_PARAM_${PN} = "--system spacenavd" + +do_install_append() { + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}${systemd_unitdir}/system/ + install -m 0644 ${WORKDIR}/spacenavd.service ${D}${systemd_unitdir}/system/ + fi +} + |