blob: 84988897f3ae4a30c8bbe4d5c29357301c5abd4a
1 | #ifndef _COMMON_H_ |
2 | #define _COMMON_H_ |
3 | |
4 | #include <stdio.h> |
5 | #include <string.h> |
6 | #include <errno.h> |
7 | #include <strings.h> |
8 | #include "keydefine.h" |
9 | #include "rc_common.h" |
10 | |
11 | #define MAX_LINE_LEN 1024 |
12 | |
13 | #define MAPCODE(scancode, keycode)\ |
14 | ((((scancode) & 0xFFFF)<<16) | ((keycode) & 0xFFFF)) |
15 | |
16 | #define MATCH(s,d) (strcasecmp(s, d) == 0) |
17 | |
18 | #define IS_NULL(s) (strlen(s) == 0) |
19 | |
20 | extern unsigned char dbg_flag; |
21 | |
22 | #define prDbg(fmt, ...) \ |
23 | { \ |
24 | if (dbg_flag) \ |
25 | fprintf(stdout, fmt, ##__VA_ARGS__); \ |
26 | } |
27 | |
28 | enum { |
29 | SUCC = 0, |
30 | FAIL = -1, |
31 | }; |
32 | |
33 | enum { |
34 | CONFIG_LEVEL, |
35 | KEYMAP_LEVEL, |
36 | MOUSEMAP_LEVEL, |
37 | ADCMAP_LEVEL, |
38 | }; |
39 | |
40 | typedef int (*pfileHandle)(char *, char *, void *); |
41 | |
42 | typedef struct { |
43 | struct ir_map_tab tab; |
44 | }S_TAB_FILE_T; |
45 | |
46 | typedef struct { |
47 | unsigned int workMode; |
48 | unsigned int repeatEnable; |
49 | unsigned int debugEnable; |
50 | /*software decode*/ |
51 | struct ir_sw_decode_para sw_data; |
52 | } S_CFG_FILE_T; |
53 | |
54 | |
55 | int SetTabPara(int devFd, S_TAB_FILE_T *tabFile); |
56 | int SetCfgPara(int devFd, const char *sysDir, S_CFG_FILE_T *cfgFile); |
57 | int ParseFile(const char *file, pfileHandle handler, void *data); |
58 | int CheckVersion(int fd); |
59 | int OpenDevice(char *filename); |
60 | int CloseDevice(int fd); |
61 | |
62 | |
63 | |
64 | #endif |
65 |