This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:

Subject: ir-ctl: fix encoding pulse_length bpf encoder
Author:  Sean Young <s...@mess.org>
Date:    Tue Apr 23 17:53:06 2024 +0100

Transmitting pulse_length is broken and never worked. The most common
user of this protocol is Sony, which already has its own encoder.

Signed-off-by: Sean Young <s...@mess.org>

 utils/ir-ctl/bpf_encoder.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=3944af31f58db873129d25db42a7a39c1ac3942d
diff --git a/utils/ir-ctl/bpf_encoder.c b/utils/ir-ctl/bpf_encoder.c
index 886f046f4b6d..2bc7b5417cff 100644
--- a/utils/ir-ctl/bpf_encoder.c
+++ b/utils/ir-ctl/bpf_encoder.c
@@ -61,24 +61,25 @@ static void encode_pulse_length(struct keymap *map, 
uint32_t scancode, int *buf,
        if (keymap_param(map, "reverse", 0)) {
                for (i = 0; i < bits; i++) {
                        if (scancode & (1 << i))
-                               buf[len++] = keymap_param(map, "bit_1_space", 
1625);
+                               buf[len++] = keymap_param(map, "bit_1_pulse", 
1625);
                        else
-                               buf[len++] = keymap_param(map, "bit_0_space", 
375);
+                               buf[len++] = keymap_param(map, "bit_0_pulse", 
375);
 
-                       buf[len++] = keymap_param(map, "bit_pulse", 625);
+                       buf[len++] = keymap_param(map, "bit_space", 625);
                }
        } else {
                for (i = bits - 1; i >= 0; i--) {
                        if (scancode & (1 << i))
-                               buf[len++] = keymap_param(map, "bit_1_space", 
1625);
+                               buf[len++] = keymap_param(map, "bit_1_pulse", 
1625);
                        else
-                               buf[len++] = keymap_param(map, "bit_0_space", 
375);
+                               buf[len++] = keymap_param(map, "bit_0_pulse", 
375);
 
-                       buf[len++] = keymap_param(map, "bit_pulse", 625);
+                       buf[len++] = keymap_param(map, "bit_space", 625);
                }
        }
 
-       *length = len;
+       /* drop trailing space */
+       *length = len - 1;
 }
 
 static void manchester_advance_space(int *buf, int *len, unsigned length)
@@ -121,8 +122,8 @@ static void encode_manchester(struct keymap *map, uint32_t 
scancode, int *buf, i
                }
        }
 
-       /* drop any trailing pulse */
-        *length = (len % 2) ? len : len + 1;
+       /* drop any trailing space */
+       *length = (len % 2) ? len : len + 1;
 }
 
 bool encode_bpf_protocol(struct keymap *map, uint32_t scancode, int *buf, int 
*length)

Reply via email to