2 * some common structs and functions to handle infrared remotes via
5 * (c) 2003 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <linux/version.h>
23 #include <linux/input.h>
27 #define IR_TYPE_OTHER 99
29 #define IR_KEYTAB_TYPE u32
30 #define IR_KEYTAB_SIZE 128 // enougth for rc5, probably need more some day ...
32 #define IR_KEYCODE(tab,code) (((unsigned)code < IR_KEYTAB_SIZE) \
33 ? tab[code] : KEY_RESERVED)
35 struct ir_input_state {
38 IR_KEYTAB_TYPE ir_codes[IR_KEYTAB_SIZE];
41 u32 ir_raw; /* raw data */
42 u32 ir_key; /* ir key code */
43 u32 keycode; /* linux key code */
44 int keypressed; /* current state */
47 extern IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE];
48 extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE];
50 void ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
51 int ir_type, IR_KEYTAB_TYPE *ir_codes);
52 void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir);
53 void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
54 u32 ir_key, u32 ir_raw);
55 u32 ir_extract_bits(u32 data, u32 mask);