16 #include <linux/module.h>
20 #define NEC_UNIT 562500
21 #define NEC_HEADER_PULSE (16 * NEC_UNIT)
22 #define NECX_HEADER_PULSE (8 * NEC_UNIT)
23 #define NEC_HEADER_SPACE (8 * NEC_UNIT)
24 #define NEC_REPEAT_SPACE (4 * NEC_UNIT)
25 #define NEC_BIT_PULSE (1 * NEC_UNIT)
26 #define NEC_BIT_0_SPACE (1 * NEC_UNIT)
27 #define NEC_BIT_1_SPACE (3 * NEC_UNIT)
28 #define NEC_TRAILER_PULSE (1 * NEC_UNIT)
29 #define NEC_TRAILER_SPACE (10 * NEC_UNIT)
30 #define NECX_REPEAT_BITS 1
50 struct nec_dec *
data = &dev->
raw->nec;
53 bool send_32bits =
false;
58 if (!is_timing_event(ev)) {
64 IR_dprintk(2,
"NEC decode started at state %d (%uus %s)\n",
67 switch (data->state) {
74 data->is_nec_x =
false;
75 data->necx_repeat =
false;
77 data->is_nec_x =
true;
94 IR_dprintk(1,
"Discarding last key repeat: event after key up\n");
128 data->necx_repeat =
false;
161 address = bitrev8((data->bits >> 24) & 0xff);
162 not_address = bitrev8((data->bits >> 16) & 0xff);
163 command = bitrev8((data->bits >> 8) & 0xff);
164 not_command = bitrev8((data->bits >> 0) & 0xff);
166 if ((command ^ not_command) != 0xff) {
167 IR_dprintk(1,
"NEC checksum error: received 0x%08x\n",
175 scancode = data->bits;
176 IR_dprintk(1,
"NEC (modified) scancode 0x%08x\n", scancode);
177 }
else if ((address ^ not_address) != 0xff) {
179 scancode = address << 16 |
182 IR_dprintk(1,
"NEC (Ext) scancode 0x%06x\n", scancode);
185 scancode = address << 8 |
command;
186 IR_dprintk(1,
"NEC scancode 0x%04x\n", scancode);
190 data->necx_repeat =
true;
197 IR_dprintk(1,
"NEC decode failed at count %d state %d (%uus %s)\n",
205 .decode = ir_nec_decode,
208 static int __init ir_nec_decode_init(
void)
216 static void __exit ir_nec_decode_exit(
void)