Source: lirc Version: 0.10.1-7.2 Severity: important Tags: patch User: debian-h...@lists.debian.org Usertags: hurd X-Debbugs-CC: debian-h...@lists.debian.org
Hi, lirc FTBFS on hurd-i386. (Built in the past, last successful build version was 0.10.1-5.2) This is due to usage of __u32 in the patch 0007-lirc-gpio-ir-0.10.patch, which is not defined on GNU/Hurd. This patch was added to version 0.10.1-6 in 2019. Attached is that patch updated to use uint32_t which is defined. (In fact uint32_t is used in an earlier statement in that patch.) Moreover, MODINFO is not available on GNU/Hurd since Hurd does not use modules at all. This change is reflected in the second patch for debian/rules. The two patches enabling a successful build on GNU/Hurd are attached: The updated patch 0007-lirc-gpio-ir-0.10.patch and debian_rules.patch. I'm sending this bug report to Debian instead of upstream since this package has been NMU-ed twice, and the second patch is Debian-specific. Thanks!
From: Debian Lirc Team <team+debian-l...@tracker.debian.org> Date: Thu, 12 May 2022 21:07:56 +0200 Subject: lirc-gpio-ir-0.10 Origin: https://github.com/neuralassembly/raspi/blob/master/lirc-gpio-ir-0.10.patch Bug-Debian: bugs.debian.org/931078 --- lib/config_file.c | 2 +- lib/ir_remote.h | 9 +++++++-- lib/irrecord.c | 41 +++++++++++++++++++++++++++-------------- lib/lirc/ir_remote.h | 9 +++++++-- tools/mode2.cpp | 18 +++++++++++++++--- 5 files changed, 57 insertions(+), 22 deletions(-) Index: lirc-0.10.1/lib/config_file.c =================================================================== --- lirc-0.10.1.orig/lib/config_file.c +++ lirc-0.10.1/lib/config_file.c @@ -71,7 +71,7 @@ struct void_array { 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"; Index: lirc-0.10.1/lib/ir_remote.h =================================================================== --- lirc-0.10.1.orig/lib/ir_remote.h +++ lirc-0.10.1/lib/ir_remote.h @@ -110,12 +110,17 @@ static inline ir_code reverse(ir_code da 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) Index: lirc-0.10.1/lib/irrecord.c =================================================================== --- lirc-0.10.1.orig/lib/irrecord.c +++ lirc-0.10.1/lib/irrecord.c @@ -1398,9 +1398,16 @@ enum lengths_status get_lengths(struct l 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 @@ enum lengths_status get_lengths(struct l 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 @@ enum lengths_status get_lengths(struct l /* 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 @@ ssize_t raw_read(void* buffer, size_t si 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 @@ enum button_status record_buttons(struct 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) { Index: lirc-0.10.1/lib/lirc/ir_remote.h =================================================================== --- lirc-0.10.1.orig/lib/lirc/ir_remote.h +++ lirc-0.10.1/lib/lirc/ir_remote.h @@ -110,12 +110,17 @@ static inline ir_code reverse(ir_code da 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) Index: lirc-0.10.1/tools/mode2.cpp =================================================================== --- lirc-0.10.1.orig/tools/mode2.cpp +++ lirc-0.10.1/tools/mode2.cpp @@ -326,12 +326,24 @@ unsigned int get_codelength(int fd, int 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", (uint32_t)(data & PULSE_MASK)); + } else if (msg == LIRC_MODE2_SPACE) { + printf("space %u\n", (uint32_t)(data & PULSE_MASK)); + } else if (msg == LIRC_MODE2_TIMEOUT) { + printf("timeout %u\n", (uint32_t)(data & PULSE_MASK)); + leading_space = true; + } break; case 1: { /* print output like irrecord raw config file data */
--- a/debian/rules 2022-12-28 12:25:42.000000000 +0100 +++ b/debian/rules 2023-11-18 15:13:23.000000000 +0100 @@ -29,7 +29,7 @@ else dh_auto_configure -- \ SH_PATH=/bin/sh \ - MODINFO=/sbin/modinfo \ + MODINFO= \ --disable-uinput --disable-devinput \ --enable-silent-rules endif