kernel-fxtec-pro1x/drivers/media/IR/keymaps/rc-streamzap.c
Jarod Wilson 7a569f524d V4L/DVB: IR/streamzap: 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 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.

Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:04:47 -02:00

82 lines
2.1 KiB
C

/* rc-streamzap.c - Keytable for Streamzap PC Remote, for use
* with the Streamzap PC Remote IR Receiver.
*
* Copyright (c) 2010 by Jarod Wilson <jarod@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <media/rc-map.h>
static struct ir_scancode streamzap[] = {
/*
* The Streamzap remote is almost, but not quite, RC-5, as it has an extra
* bit in it, which throws the in-kernel RC-5 decoder for a loop. Currently,
* an additional RC-5-sz decoder is being deployed to support it, but it
* may be possible to merge it back with the standard RC-5 decoder.
*/
{ 0x28c0, KEY_NUMERIC_0 },
{ 0x28c1, KEY_NUMERIC_1 },
{ 0x28c2, KEY_NUMERIC_2 },
{ 0x28c3, KEY_NUMERIC_3 },
{ 0x28c4, KEY_NUMERIC_4 },
{ 0x28c5, KEY_NUMERIC_5 },
{ 0x28c6, KEY_NUMERIC_6 },
{ 0x28c7, KEY_NUMERIC_7 },
{ 0x28c8, KEY_NUMERIC_8 },
{ 0x28c9, KEY_NUMERIC_9 },
{ 0x28ca, KEY_POWER },
{ 0x28cb, KEY_MUTE },
{ 0x28cc, KEY_CHANNELUP },
{ 0x28cd, KEY_VOLUMEUP },
{ 0x28ce, KEY_CHANNELDOWN },
{ 0x28cf, KEY_VOLUMEDOWN },
{ 0x28d0, KEY_UP },
{ 0x28d1, KEY_LEFT },
{ 0x28d2, KEY_OK },
{ 0x28d3, KEY_RIGHT },
{ 0x28d4, KEY_DOWN },
{ 0x28d5, KEY_MENU },
{ 0x28d6, KEY_EXIT },
{ 0x28d7, KEY_PLAY },
{ 0x28d8, KEY_PAUSE },
{ 0x28d9, KEY_STOP },
{ 0x28da, KEY_BACK },
{ 0x28db, KEY_FORWARD },
{ 0x28dc, KEY_RECORD },
{ 0x28dd, KEY_REWIND },
{ 0x28de, KEY_FASTFORWARD },
{ 0x28e0, KEY_RED },
{ 0x28e1, KEY_GREEN },
{ 0x28e2, KEY_YELLOW },
{ 0x28e3, KEY_BLUE },
};
static struct rc_keymap streamzap_map = {
.map = {
.scan = streamzap,
.size = ARRAY_SIZE(streamzap),
.ir_type = IR_TYPE_RC5_SZ,
.name = RC_MAP_STREAMZAP,
}
};
static int __init init_rc_map_streamzap(void)
{
return ir_register_map(&streamzap_map);
}
static void __exit exit_rc_map_streamzap(void)
{
ir_unregister_map(&streamzap_map);
}
module_init(init_rc_map_streamzap)
module_exit(exit_rc_map_streamzap)
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Jarod Wilson <jarod@redhat.com>");