LIRC libraries LinuxInfraredRemoteControl

- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

- File List
- Globals

input_map.c
Go to the documentation of this file.
1 /****************************************************************************
2 ** input_map.c *************************************************************
3 ****************************************************************************
4 *
5 * input_map.c - button namespace derived from Linux input layer
6 *
7 * Copyright (C) 2008 Christoph Bartelmus <lirc@bartelmus.de>
8 *
9 */
10
17 #include <stdlib.h>
18 #include <string.h>
19
20 #include "lirc/input_map.h"
21
22 struct {
23 char* name;
24 linux_input_code code;
25 } input_map[] = {
26 #include "lirc/input_map.inc"
27 {
28 NULL, 0
29 }
30 };
31
32 int get_input_code(const char* name, linux_input_code* code)
33 {
34 int i;
35
36 for (i = 0; input_map[i].name != NULL; i++) {
37 if (strcasecmp(name, input_map[i].name) == 0) {
38 *code = input_map[i].code;
39 return i;
40 }
41 }
42 return -1;
43 }
44
45 void fprint_namespace(FILE* f)
46 {
47 int i;
48
49 for (i = 0; input_map[i].name != NULL; i++)
50 fprintf(stdout, "%s\n", input_map[i].name);
51 }
52
53 int is_in_namespace(const char* name)
54 {
55 linux_input_code dummy;
56
57 return get_input_code(name, &dummy) == -1 ? 0 : 1;
58 }
ir_ncode::name
char * name
Definition: ir_remote_types.h:74
ir_ncode::code
ir_code code
Definition: ir_remote_types.h:77