1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#include "firesat.h"
#include "firesat-rc.h"
#include <linux/input.h>
static u16 firesat_irtable[] = {
KEY_ESC,
KEY_F9,
KEY_1,
KEY_2,
KEY_3,
KEY_4,
KEY_5,
KEY_6,
KEY_7,
KEY_8,
KEY_9,
KEY_I,
KEY_0,
KEY_ENTER,
KEY_RED,
KEY_UP,
KEY_GREEN,
KEY_F10,
KEY_SPACE,
KEY_F11,
KEY_YELLOW,
KEY_DOWN,
KEY_BLUE,
KEY_Z,
KEY_P,
KEY_PAGEDOWN,
KEY_LEFT,
KEY_W,
KEY_RIGHT,
KEY_P,
KEY_M,
KEY_R,
KEY_V,
KEY_C,
0
};
static struct input_dev firesat_idev;
int firesat_register_rc(void)
{
int index;
memset(&firesat_idev, 0, sizeof(firesat_idev));
firesat_idev.evbit[0] = BIT(EV_KEY);
for (index = 0; firesat_irtable[index] != 0; index++)
set_bit(firesat_irtable[index], firesat_idev.keybit);
return input_register_device(&firesat_idev);
}
int firesat_unregister_rc(void)
{
input_unregister_device(&firesat_idev);
return 0;
}
int firesat_got_remotecontrolcode(u16 code)
{
u16 keycode;
if (code > 0x4500 && code < 0x4520)
keycode = firesat_irtable[code - 0x4501];
else if (code > 0x453f && code < 0x4543)
keycode = firesat_irtable[code - 0x4521];
else {
printk(KERN_DEBUG "%s: invalid key code 0x%04x\n", __func__,
code);
return -EINVAL;
}
input_report_key(&firesat_idev, keycode, 1);
input_report_key(&firesat_idev, keycode, 0);
return 0;
}
|