summaryrefslogtreecommitdiff
path: root/remotecfg/common.h (plain)
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
20extern unsigned char dbg_flag;
21
22#define prDbg(fmt, ...) \
23{ \
24 if (dbg_flag) \
25 fprintf(stdout, fmt, ##__VA_ARGS__); \
26}
27
28enum {
29 SUCC = 0,
30 FAIL = -1,
31};
32
33enum {
34 CONFIG_LEVEL,
35 KEYMAP_LEVEL,
36 MOUSEMAP_LEVEL,
37 ADCMAP_LEVEL,
38};
39
40typedef int (*pfileHandle)(char *, char *, void *);
41
42typedef struct {
43 struct ir_map_tab tab;
44}S_TAB_FILE_T;
45
46typedef 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
55int SetTabPara(int devFd, S_TAB_FILE_T *tabFile);
56int SetCfgPara(int devFd, const char *sysDir, S_CFG_FILE_T *cfgFile);
57int ParseFile(const char *file, pfileHandle handler, void *data);
58int CheckVersion(int fd);
59int OpenDevice(char *filename);
60int CloseDevice(int fd);
61
62
63
64#endif
65