IR/streamzap: enable functional in-kernel decoding
Subsystems (2)
PATCH 1/1 IR/streamzap: enable functional in-kernel decoding
This patch makes in-kernel decoding with the stock Streamzap PC Remote work out of the box. There are quite a few things going on in this patch, all (mostly) related to getting this working:
1) I had to enable reporting of a long space at the end of each signal, or I had weird buffering and keybounce issues.
2) The keymap has been reworked slightly to match actual decoded values, the first edition was missing the pre-data bits present in the lirc config file for this remote.
3) There's a whole new decoder included, specifically for the not-quite-RC5 15-bit protocol variant used by the Streamzap PC Remote. The decoder, while usable with other recievers (tested with an mceusb receiver), will only be loaded by the streamzap driver, as its likely not of use in almost all other situations. This can be revisited if/when all keytable loading (and disabling of unneeded protocol decoder engines) is moved to userspace, but for now, I think this makes the most sense.
Note that I did try to enable handling the streamzap RC5-ish protocol in the current RC5 decoder, but there's no particularly easy way to tell if its 14-bit RC5 or 15-bit Streamzap until we see bit 14, and even then, in testing an attempted decoder merge, only 2/3 of the keys were properly recognized as being the 15-bit variant and decoded correctly, the rest were close enough to compliant with 14-bit that they were decoded as such (but they have overlap with one another, and thus we can't just shrug and use the 14-bit decoded values).
Also of note in this patch is the removal of the streamzap driver's internal delay buffer. Per discussion w/Christoph, it shouldn't be needed by lirc any longer anyway, and it doesn't seem to make any difference to the in-kernel decoder engine. That being the case, I'm yanking it all out, as it greatly simplifies the driver code (net result is that streamzap.c is now 252 lines less than lirc_streamzap.c was).
--- drivers/media/IR/Kconfig | 12 + drivers/media/IR/Makefile | 1 + drivers/media/IR/ir-core-priv.h | 6 + drivers/media/IR/ir-rc5-sz-decoder.c | 153 ++++++++++++ drivers/media/IR/ir-sysfs.c | 1 + drivers/media/IR/keymaps/Makefile | 2 +- drivers/media/IR/keymaps/rc-rc5-streamzap.c | 81 ------ drivers/media/IR/keymaps/rc-streamzap.c | 82 ++++++ drivers/media/IR/streamzap.c | 358 +++++++-------------------- include/media/rc-map.h | 5 +- 10 files changed, 352 insertions(+), 349 deletions(-) create mode 100644 drivers/media/IR/ir-rc5-sz-decoder.c delete mode 100644 drivers/media/IR/keymaps/rc-rc5-streamzap.c create mode 100644 drivers/media/IR/keymaps/rc-streamzap.c
drivers/media/IR/Kconfig +12 -0
@@ -79,6 +79,18 @@ config IR_SONY_DECODER Enable this option if you have an infrared remote control which uses the Sony protocol, and you need software decoding support. +config IR_RC5_SZ_DECODER + tristate "Enable IR raw decoder for the RC-5 (streamzap) protocol" + depends on IR_CORE + select BITREVERSE + default y + + ---help--- + Enable this option if you have IR with RC-5 (streamzap) protocol, + and if the IR is decoded in software. (The Streamzap PC Remote + uses an IR protocol that is almost standard RC-5, but not quite, + as it uses an additional bit). + config IR_LIRC_CODEC tristate "Enable IR to LIRC bridge" depends on IR_CORE
drivers/media/IR/Makefile +1 -0
@@ -11,6 +11,7 @@ obj-$(CONFIG_IR_RC5_DECODER) += ir-rc5-decoder.o obj-$(CONFIG_IR_RC6_DECODER) += ir-rc6-decoder.o obj-$(CONFIG_IR_JVC_DECODER) += ir-jvc-decoder.o obj-$(CONFIG_IR_SONY_DECODER) += ir-sony-decoder.o +obj-$(CONFIG_IR_RC5_SZ_DECODER) += ir-rc5-sz-decoder.o obj-$(CONFIG_IR_LIRC_CODEC) += ir-lirc-codec.o # stand-alone IR receivers/transmitters
drivers/media/IR/ir-core-priv.h +6 -0
@@ -76,6 +76,12 @@ struct ir_raw_event_ctrl {bool first;bool toggle; } jvc; +struct rc5_sz_dec { +int state; +u32 bits; +unsigned count; +unsigned wanted_bits; + } rc5_sz;struct lirc_codec {struct ir_input_dev *ir_dev;struct lirc_driver *drv;
drivers/media/IR/ir-rc5-sz-decoder.c new file +153 -0
153 lines not on this page · raw message
drivers/media/IR/ir-sysfs.c +1 -0
@@ -43,6 +43,7 @@ static struct { { IR_TYPE_RC6, "rc-6" }, { IR_TYPE_JVC, "jvc" }, { IR_TYPE_SONY, "sony" }, + { IR_TYPE_RC5_SZ, "rc-5-sz" }, { IR_TYPE_LIRC, "lirc" }, };
drivers/media/IR/keymaps/Makefile +1 -1
@@ -58,10 +58,10 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ rc-purpletv.o \ rc-pv951.o \ rc-rc5-hauppauge-new.o \ - rc-rc5-streamzap.o \ rc-rc5-tv.o \ rc-rc6-mce.o \ rc-real-audio-220-32-keys.o \ + rc-streamzap.o \ rc-tbs-nec.o \ rc-terratec-cinergy-xs.o \ rc-tevii-nec.o \
drivers/media/IR/keymaps/rc-rc5-streamzap.c deleted +0 -81
81 lines not on this page · raw message
drivers/media/IR/keymaps/rc-streamzap.c new file +82 -0
82 lines not on this page · raw message
drivers/media/IR/streamzap.c +93 -265
503 lines not on this page · raw message
include/media/rc-map.h +3 -2
@@ -17,12 +17,13 @@#define IR_TYPE_RC6 (1 << 2)/* Philips RC6 protocol */ #define IR_TYPE_JVC (1 << 3)/* JVC protocol */ #define IR_TYPE_SONY (1 << 4)/* Sony12/15/20 protocol */ +#define IR_TYPE_RC5_SZ (1 << 5)/* RC5 variant used by Streamzap */ #define IR_TYPE_LIRC (1 << 30)/* Pass raw IR to lirc userspace */ #define IR_TYPE_OTHER (1u << 31)#define IR_TYPE_ALL (IR_TYPE_RC5 | IR_TYPE_NEC | IR_TYPE_RC6 | \ IR_TYPE_JVC | IR_TYPE_SONY | IR_TYPE_LIRC | \ - IR_TYPE_OTHER) + IR_TYPE_RC5_SZ | IR_TYPE_OTHER)struct ir_scancode {u32 scancode;
@@ -114,10 +115,10 @@ void rc_map_init(void);#define RC_MAP_PURPLETV "rc-purpletv"#define RC_MAP_PV951 "rc-pv951"#define RC_MAP_RC5_HAUPPAUGE_NEW "rc-rc5-hauppauge-new" -#define RC_MAP_RC5_STREAMZAP "rc-rc5-streamzap"#define RC_MAP_RC5_TV "rc-rc5-tv"#define RC_MAP_RC6_MCE "rc-rc6-mce"#define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys" +#define RC_MAP_STREAMZAP "rc-streamzap"#define RC_MAP_TBS_NEC "rc-tbs-nec"#define RC_MAP_TERRATEC_CINERGY_XS "rc-terratec-cinergy-xs"#define RC_MAP_TEVII_NEC "rc-tevii-nec"
Signature · 5 lines
1.7.2.1 -- Jarod Wilson [email protected]