From 4499d60e60c0c6df6bdcc2425e6d37894e2de550 Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Tue, 23 Jun 2020 23:32:37 +0300 Subject: lirc: Move to dynamic-layers Move lirc to dynamic-layers/meta-python/recipes-connectivity/ to avoid related issues while building rpi-basic-image. Reported-by: Alan Suggested-by: Khem Raj Signed-off-by: Leon Anavi --- .../lirc/lirc/lirc-gpio-ir-0.10.patch | 175 +++++++++++++++++++++ .../recipes-connectivity/lirc/lirc_%.bbappend | 5 + .../lirc/lirc/lirc-gpio-ir-0.10.patch | 175 --------------------- recipes-connectivity/lirc/lirc_%.bbappend | 5 - 4 files changed, 180 insertions(+), 180 deletions(-) create mode 100644 dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lirc-gpio-ir-0.10.patch create mode 100644 dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_%.bbappend delete mode 100644 recipes-connectivity/lirc/lirc/lirc-gpio-ir-0.10.patch delete mode 100644 recipes-connectivity/lirc/lirc_%.bbappend diff --git a/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lirc-gpio-ir-0.10.patch b/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lirc-gpio-ir-0.10.patch new file mode 100644 index 0000000..c0fdd18 --- /dev/null +++ b/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lirc-gpio-ir-0.10.patch @@ -0,0 +1,175 @@ +diff -ruN lirc-0.10.1.orig/lib/config_file.c lirc-0.10.1/lib/config_file.c +--- lirc-0.10.1.orig/lib/config_file.c 2017-09-10 17:52:19.000000000 +0900 ++++ lirc-0.10.1/lib/config_file.c 2019-06-26 00:39:45.734320696 +0900 +@@ -71,7 +71,7 @@ + typedef void* (*array_guest_func)(void* item, void* arg); + + +-#define LINE_LEN 1024 ++#define LINE_LEN 4096 + #define MAX_INCLUDES 10 + + const char* whitespace = " \t"; +diff -ruN lirc-0.10.1.orig/lib/ir_remote.h lirc-0.10.1/lib/ir_remote.h +--- lirc-0.10.1.orig/lib/ir_remote.h 2017-09-10 17:52:19.000000000 +0900 ++++ lirc-0.10.1/lib/ir_remote.h 2019-06-26 00:39:45.714321224 +0900 +@@ -110,12 +110,17 @@ + + static inline int is_pulse(lirc_t data) + { +- return data & PULSE_BIT ? 1 : 0; ++ return ((data & LIRC_MODE2_MASK)==LIRC_MODE2_PULSE) ? 1 : 0; + } + + static inline int is_space(lirc_t data) + { +- return !is_pulse(data); ++ return ((data & LIRC_MODE2_MASK)==LIRC_MODE2_SPACE) ? 1 : 0; ++} ++ ++static inline int is_timeout(lirc_t data) ++{ ++ return ((data & LIRC_MODE2_MASK)==LIRC_MODE2_TIMEOUT) ? 1 : 0; + } + + static inline int has_repeat(const struct ir_remote* remote) +diff -ruN lirc-0.10.1.orig/lib/irrecord.c lirc-0.10.1/lib/irrecord.c +--- lirc-0.10.1.orig/lib/irrecord.c 2017-09-10 17:52:19.000000000 +0900 ++++ lirc-0.10.1/lib/irrecord.c 2019-06-26 00:39:45.724320960 +0900 +@@ -1398,9 +1398,16 @@ + state->retval = 0; + return STS_LEN_TIMEOUT; + } ++ if (is_timeout(state->data)) { ++ return STS_LEN_AGAIN; ++ } + state->count++; + if (state->mode == MODE_GET_GAP) { +- state->sum += state->data & PULSE_MASK; ++ if (state->sum != 0 || is_pulse(state->data)) { ++ state->sum += state->data & PULSE_MASK; ++ }else{ ++ return STS_LEN_AGAIN; ++ } + if (state->average == 0 && is_space(state->data)) { + if (state->data > 100000) { + state->sum = 0; +@@ -1472,6 +1479,10 @@ + state->keypresses = lastmaxcount; + return STS_LEN_AGAIN; + } else if (state->mode == MODE_HAVE_GAP) { ++ if (state->count==1 && is_space(state->data)) { ++ state->count = 0; ++ return STS_LEN_AGAIN; ++ } + if (state->count <= MAX_SIGNALS) { + signals[state->count - 1] = state->data & PULSE_MASK; + } else { +@@ -1510,7 +1521,7 @@ + /* such long pulses may appear with + * crappy hardware (receiver? / remote?) + */ +- else { ++ else if(is_pulse(state->data)) { + remote->gap = 0; + return STS_LEN_NO_GAP_FOUND; + } +@@ -1811,22 +1822,24 @@ + + static int raw_data_ok(struct button_state* btn_state) + { +- int r; ++ int r = 0; + int ref; + +- if (!is_space(btn_state->data)) { ++ if (is_pulse(btn_state->data)) { + r = 0; +- } else if (is_const(&remote)) { +- if (remote.gap > btn_state->sum) { +- ref = (remote.gap - btn_state->sum); +- ref *= (100 - remote.eps); +- ref /= 100; ++ } else if (is_space(btn_state->data)) { ++ if (is_const(&remote)) { ++ if (remote.gap > btn_state->sum) { ++ ref = (remote.gap - btn_state->sum); ++ ref *= (100 - remote.eps); ++ ref /= 100; ++ } else { ++ ref = 0; ++ } ++ r = btn_state->data > ref; + } else { +- ref = 0; ++ r = btn_state->data > (remote.gap * (100 - remote.eps)) / 100; + } +- r = btn_state->data > ref; +- } else { +- r = btn_state->data > (remote.gap * (100 - remote.eps)) / 100; + } + return r; + } +@@ -1970,7 +1983,7 @@ + btn_state->data = remote.gap; + } + if (btn_state->count == 0) { +- if (!is_space(btn_state->data) ++ if (is_pulse(btn_state->data) + || btn_state->data < + remote.gap - remote.gap * remote.eps / + 100) { +diff -ruN lirc-0.10.1.orig/lib/lirc/ir_remote.h lirc-0.10.1/lib/lirc/ir_remote.h +--- lirc-0.10.1.orig/lib/lirc/ir_remote.h 2017-09-10 17:52:58.000000000 +0900 ++++ lirc-0.10.1/lib/lirc/ir_remote.h 2019-06-26 00:39:45.724320960 +0900 +@@ -110,12 +110,17 @@ + + static inline int is_pulse(lirc_t data) + { +- return data & PULSE_BIT ? 1 : 0; ++ return ((data & LIRC_MODE2_MASK)==LIRC_MODE2_PULSE) ? 1 : 0; + } + + static inline int is_space(lirc_t data) + { +- return !is_pulse(data); ++ return ((data & LIRC_MODE2_MASK)==LIRC_MODE2_SPACE) ? 1 : 0; ++} ++ ++static inline int is_timeout(lirc_t data) ++{ ++ return ((data & LIRC_MODE2_MASK)==LIRC_MODE2_TIMEOUT) ? 1 : 0; + } + + static inline int has_repeat(const struct ir_remote* remote) +diff -ruN lirc-0.10.1.orig/tools/mode2.cpp lirc-0.10.1/tools/mode2.cpp +--- lirc-0.10.1.orig/tools/mode2.cpp 2017-09-10 17:52:19.000000000 +0900 ++++ lirc-0.10.1/tools/mode2.cpp 2019-06-26 00:45:38.840404976 +0900 +@@ -326,12 +326,24 @@ + void print_mode2_data(unsigned int data) + { + static int bitno = 1; ++ static bool leading_space = true; ++ unsigned int msg = data & LIRC_MODE2_MASK; + + switch (opt_dmode) { + case 0: +- printf("%s %u\n", ( +- data & PULSE_BIT) ? "pulse" : "space", +- (uint32_t)(data & PULSE_MASK)); ++ if (leading_space && msg == LIRC_MODE2_SPACE ) { ++ break; ++ } else { ++ leading_space = false; ++ } ++ if (msg == LIRC_MODE2_PULSE) { ++ printf("pulse %u\n", (__u32)(data & PULSE_MASK)); ++ } else if (msg == LIRC_MODE2_SPACE) { ++ printf("space %u\n", (__u32)(data & PULSE_MASK)); ++ } else if (msg == LIRC_MODE2_TIMEOUT) { ++ printf("timeout %u\n", (__u32)(data & PULSE_MASK)); ++ leading_space = true; ++ } + break; + case 1: { + /* print output like irrecord raw config file data */ diff --git a/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_%.bbappend b/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_%.bbappend new file mode 100644 index 0000000..d46ce58 --- /dev/null +++ b/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_%.bbappend @@ -0,0 +1,5 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +SRC_URI_append_rpi = " \ + file://lirc-gpio-ir-0.10.patch \ +" diff --git a/recipes-connectivity/lirc/lirc/lirc-gpio-ir-0.10.patch b/recipes-connectivity/lirc/lirc/lirc-gpio-ir-0.10.patch deleted file mode 100644 index c0fdd18..0000000 --- a/recipes-connectivity/lirc/lirc/lirc-gpio-ir-0.10.patch +++ /dev/null @@ -1,175 +0,0 @@ -diff -ruN lirc-0.10.1.orig/lib/config_file.c lirc-0.10.1/lib/config_file.c ---- lirc-0.10.1.orig/lib/config_file.c 2017-09-10 17:52:19.000000000 +0900 -+++ lirc-0.10.1/lib/config_file.c 2019-06-26 00:39:45.734320696 +0900 -@@ -71,7 +71,7 @@ - typedef void* (*array_guest_func)(void* item, void* arg); - - --#define LINE_LEN 1024 -+#define LINE_LEN 4096 - #define MAX_INCLUDES 10 - - const char* whitespace = " \t"; -diff -ruN lirc-0.10.1.orig/lib/ir_remote.h lirc-0.10.1/lib/ir_remote.h ---- lirc-0.10.1.orig/lib/ir_remote.h 2017-09-10 17:52:19.000000000 +0900 -+++ lirc-0.10.1/lib/ir_remote.h 2019-06-26 00:39:45.714321224 +0900 -@@ -110,12 +110,17 @@ - - static inline int is_pulse(lirc_t data) - { -- return data & PULSE_BIT ? 1 : 0; -+ return ((data & LIRC_MODE2_MASK)==LIRC_MODE2_PULSE) ? 1 : 0; - } - - static inline int is_space(lirc_t data) - { -- return !is_pulse(data); -+ return ((data & LIRC_MODE2_MASK)==LIRC_MODE2_SPACE) ? 1 : 0; -+} -+ -+static inline int is_timeout(lirc_t data) -+{ -+ return ((data & LIRC_MODE2_MASK)==LIRC_MODE2_TIMEOUT) ? 1 : 0; - } - - static inline int has_repeat(const struct ir_remote* remote) -diff -ruN lirc-0.10.1.orig/lib/irrecord.c lirc-0.10.1/lib/irrecord.c ---- lirc-0.10.1.orig/lib/irrecord.c 2017-09-10 17:52:19.000000000 +0900 -+++ lirc-0.10.1/lib/irrecord.c 2019-06-26 00:39:45.724320960 +0900 -@@ -1398,9 +1398,16 @@ - state->retval = 0; - return STS_LEN_TIMEOUT; - } -+ if (is_timeout(state->data)) { -+ return STS_LEN_AGAIN; -+ } - state->count++; - if (state->mode == MODE_GET_GAP) { -- state->sum += state->data & PULSE_MASK; -+ if (state->sum != 0 || is_pulse(state->data)) { -+ state->sum += state->data & PULSE_MASK; -+ }else{ -+ return STS_LEN_AGAIN; -+ } - if (state->average == 0 && is_space(state->data)) { - if (state->data > 100000) { - state->sum = 0; -@@ -1472,6 +1479,10 @@ - state->keypresses = lastmaxcount; - return STS_LEN_AGAIN; - } else if (state->mode == MODE_HAVE_GAP) { -+ if (state->count==1 && is_space(state->data)) { -+ state->count = 0; -+ return STS_LEN_AGAIN; -+ } - if (state->count <= MAX_SIGNALS) { - signals[state->count - 1] = state->data & PULSE_MASK; - } else { -@@ -1510,7 +1521,7 @@ - /* such long pulses may appear with - * crappy hardware (receiver? / remote?) - */ -- else { -+ else if(is_pulse(state->data)) { - remote->gap = 0; - return STS_LEN_NO_GAP_FOUND; - } -@@ -1811,22 +1822,24 @@ - - static int raw_data_ok(struct button_state* btn_state) - { -- int r; -+ int r = 0; - int ref; - -- if (!is_space(btn_state->data)) { -+ if (is_pulse(btn_state->data)) { - r = 0; -- } else if (is_const(&remote)) { -- if (remote.gap > btn_state->sum) { -- ref = (remote.gap - btn_state->sum); -- ref *= (100 - remote.eps); -- ref /= 100; -+ } else if (is_space(btn_state->data)) { -+ if (is_const(&remote)) { -+ if (remote.gap > btn_state->sum) { -+ ref = (remote.gap - btn_state->sum); -+ ref *= (100 - remote.eps); -+ ref /= 100; -+ } else { -+ ref = 0; -+ } -+ r = btn_state->data > ref; - } else { -- ref = 0; -+ r = btn_state->data > (remote.gap * (100 - remote.eps)) / 100; - } -- r = btn_state->data > ref; -- } else { -- r = btn_state->data > (remote.gap * (100 - remote.eps)) / 100; - } - return r; - } -@@ -1970,7 +1983,7 @@ - btn_state->data = remote.gap; - } - if (btn_state->count == 0) { -- if (!is_space(btn_state->data) -+ if (is_pulse(btn_state->data) - || btn_state->data < - remote.gap - remote.gap * remote.eps / - 100) { -diff -ruN lirc-0.10.1.orig/lib/lirc/ir_remote.h lirc-0.10.1/lib/lirc/ir_remote.h ---- lirc-0.10.1.orig/lib/lirc/ir_remote.h 2017-09-10 17:52:58.000000000 +0900 -+++ lirc-0.10.1/lib/lirc/ir_remote.h 2019-06-26 00:39:45.724320960 +0900 -@@ -110,12 +110,17 @@ - - static inline int is_pulse(lirc_t data) - { -- return data & PULSE_BIT ? 1 : 0; -+ return ((data & LIRC_MODE2_MASK)==LIRC_MODE2_PULSE) ? 1 : 0; - } - - static inline int is_space(lirc_t data) - { -- return !is_pulse(data); -+ return ((data & LIRC_MODE2_MASK)==LIRC_MODE2_SPACE) ? 1 : 0; -+} -+ -+static inline int is_timeout(lirc_t data) -+{ -+ return ((data & LIRC_MODE2_MASK)==LIRC_MODE2_TIMEOUT) ? 1 : 0; - } - - static inline int has_repeat(const struct ir_remote* remote) -diff -ruN lirc-0.10.1.orig/tools/mode2.cpp lirc-0.10.1/tools/mode2.cpp ---- lirc-0.10.1.orig/tools/mode2.cpp 2017-09-10 17:52:19.000000000 +0900 -+++ lirc-0.10.1/tools/mode2.cpp 2019-06-26 00:45:38.840404976 +0900 -@@ -326,12 +326,24 @@ - void print_mode2_data(unsigned int data) - { - static int bitno = 1; -+ static bool leading_space = true; -+ unsigned int msg = data & LIRC_MODE2_MASK; - - switch (opt_dmode) { - case 0: -- printf("%s %u\n", ( -- data & PULSE_BIT) ? "pulse" : "space", -- (uint32_t)(data & PULSE_MASK)); -+ if (leading_space && msg == LIRC_MODE2_SPACE ) { -+ break; -+ } else { -+ leading_space = false; -+ } -+ if (msg == LIRC_MODE2_PULSE) { -+ printf("pulse %u\n", (__u32)(data & PULSE_MASK)); -+ } else if (msg == LIRC_MODE2_SPACE) { -+ printf("space %u\n", (__u32)(data & PULSE_MASK)); -+ } else if (msg == LIRC_MODE2_TIMEOUT) { -+ printf("timeout %u\n", (__u32)(data & PULSE_MASK)); -+ leading_space = true; -+ } - break; - case 1: { - /* print output like irrecord raw config file data */ diff --git a/recipes-connectivity/lirc/lirc_%.bbappend b/recipes-connectivity/lirc/lirc_%.bbappend deleted file mode 100644 index d46ce58..0000000 --- a/recipes-connectivity/lirc/lirc_%.bbappend +++ /dev/null @@ -1,5 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" - -SRC_URI_append_rpi = " \ - file://lirc-gpio-ir-0.10.patch \ -" -- cgit v1.2.3-54-g00ecf