Skip to contentSkip to conversation

ir-ctl: add ability to send scancodes in most protocols

PATCH New Sean Young 1 participant 1 message Nov 9, 2016 Media (V4L/DVB)

lore
Share & tools
lore

Sean Young

author
#0 lore raw

PATCH 1/3 ir-ctl: add ability to send scancodes in most protocols

Teach ir-ctl to send scancodes. This has a number of uses:

1. Controlling devices through IR transmission aka blasting
2. Testing the in-kernel software IR decoders (2 bugs uncovered so far)
3. Testing the capability of hardware IR decoders

All protocols supported by the kernel are supported except for XMP and the MCE Keyboard.

---
 utils/ir-ctl/Makefile.am |   2 +-
 utils/ir-ctl/ir-ctl.1.in |  82 ++++++---
 utils/ir-ctl/ir-ctl.c    | 130 ++++++++++++++-
 utils/ir-ctl/ir-encode.c | 427 +++++++++++++++++++++++++++++++++++++++++++++++
 utils/ir-ctl/ir-encode.h |  35 ++++
 5 files changed, 653 insertions(+), 23 deletions(-)
 create mode 100644 utils/ir-ctl/ir-encode.c
 create mode 100644 utils/ir-ctl/ir-encode.h
utils/ir-ctl/Makefile.am +1 -1
index 9a1bfed..4c148e5 100644
@@ -1,6 +1,6 @@
 bin_PROGRAMS = ir-ctl
 man_MANS = ir-ctl.1
 
-ir_ctl_SOURCES = ir-ctl.c
+ir_ctl_SOURCES = ir-ctl.c ir-encode.c
 ir_ctl_LDADD = @LIBINTL@
 ir_ctl_LDFLAGS = $(ARGP_LIBS)
utils/ir-ctl/ir-ctl.1.in +62 -20

127 lines not on this page · raw message

utils/ir-ctl/ir-ctl.c +128 -2

184 lines not on this page · raw message

utils/ir-ctl/ir-encode.c new file +427 -0

427 lines not on this page · raw message

utils/ir-ctl/ir-encode.h new file +35 -0
new file mode 100644
index 0000000..b2542ec
@@ -0,0 +1,35 @@
+
+#ifndef __IR_ENCODE_H__
+#define __IR_ENCODE_H__
+
+enum rc_proto {
+	RC_PROTO_RC5,
+	RC_PROTO_RC5X,
+	RC_PROTO_RC5_SZ,
+	RC_PROTO_JVC,
+	RC_PROTO_SONY12,
+	RC_PROTO_SONY15,
+	RC_PROTO_SONY20,
+	RC_PROTO_NEC,
+	RC_PROTO_NECX,
+	RC_PROTO_NEC32,
+	RC_PROTO_SANYO,
+	RC_PROTO_MCE_KBD,
+	RC_PROTO_RC6_0,
+	RC_PROTO_RC6_6A_20,
+	RC_PROTO_RC6_6A_24,
+	RC_PROTO_RC6_6A_32,
+	RC_PROTO_RC6_MCE,
+	RC_PROTO_SHARP,
+	RC_PROTO_XMP,
+	RC_PROTO_COUNT
+};
+
+bool protocol_match(const char *name, enum rc_proto *proto);
+unsigned protocol_carrier(enum rc_proto proto);
+unsigned protocol_max_size(enum rc_proto proto);
+unsigned protocol_scancode_mask(enum rc_proto proto);
+unsigned protocol_encode(enum rc_proto proto, unsigned scancode, unsigned *buf);
+const char *protocol_name(enum rc_proto proto);
+
+#endif
Signature · 1 line
2.7.4