Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

175 lines (162 sloc) 5.02 KB
diff -ruN lirc-0.9.4c.orig/lib/ir_remote.h lirc-0.9.4c/lib/ir_remote.h
--- lirc-0.9.4c.orig/lib/ir_remote.h 2016-10-22 13:21:56.000000000 +0900
+++ lirc-0.9.4c/lib/ir_remote.h 2019-03-05 13:58:45.000000000 +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.9.4c.orig/lib/irrecord.c lirc-0.9.4c/lib/irrecord.c
--- lirc-0.9.4c.orig/lib/irrecord.c 2016-10-22 13:21:56.000000000 +0900
+++ lirc-0.9.4c/lib/irrecord.c 2019-03-07 15:22:04.000000000 +0900
@@ -1388,9 +1388,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;
@@ -1462,6 +1469,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 {
@@ -1500,7 +1511,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;
}
@@ -1801,22 +1812,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;
}
@@ -1960,7 +1973,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.9.4c.orig/lib/lirc/ir_remote.h lirc-0.9.4c/lib/lirc/ir_remote.h
--- lirc-0.9.4c.orig/lib/lirc/ir_remote.h 2016-10-22 13:23:41.000000000 +0900
+++ lirc-0.9.4c/lib/lirc/ir_remote.h 2019-03-05 00:18:07.000000000 +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.9.4c.orig/tools/mode2.cpp lirc-0.9.4c/tools/mode2.cpp
--- lirc-0.9.4c.orig/tools/mode2.cpp 2016-10-22 13:21:56.000000000 +0900
+++ lirc-0.9.4c/tools/mode2.cpp 2019-03-05 23:30:47.000000000 +0900
@@ -312,12 +312,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",
- (__u32)(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 */
--- lirc-0.9.4c.orig/lib/config_file.c 2016-06-29 19:26:59.000000000 +0900
+++ lirc-0.9.4c/lib/config_file.c 2019-06-05 22:59:36.978089163 +0900
@@ -70,7 +70,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";
You can’t perform that action at this time.