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