ir-ctl: add optional header to manchester encoding
PATCH 1/2 ir-ctl: add optional header to manchester encoding
The optional header was not included when transmitting.
Signed-off-by Sean Young <[email protected]>
--- utils/ir-ctl/bpf_encoder.c | 8 ++++++++ 1 file changed, 8 insertions(+)
utils/ir-ctl/bpf_encoder.c +8 -0
@@ -101,6 +101,14 @@ static void encode_manchester(struct keymap *map, uint32_t scancode, int *buf, i {int len =0 , bits, i; +int header_pulse =keymap_param (map,"header_pulse" ,0 ); +int header_space =keymap_param (map,"header_space" ,0 ); + +if (header_pulse >0 ) { +manchester_advance_pulse (buf, &len, header_pulse); +manchester_advance_space (buf, &len, header_space); + } + bits =keymap_param (map,"bits" ,14 );for (i = bits -1 ; i >=0 ; i--) {
Signature · 1 line
2.44.0
PATCH 2/2 ir-ctl: fix encoding pulse_length bpf encoder
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 <[email protected]>
--- utils/ir-ctl/bpf_encoder.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
utils/ir-ctl/bpf_encoder.c +10 -9
@@ -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)
Signature · 1 line
2.44.0