2 * Copyright 2004-2005 Timo Hirvonen
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 #include <irman_config.h>
29 static char *button_names
[] = {
46 int irman_config(void)
55 if (fgets(device
, sizeof(device
), stdin
) != NULL
)
59 if (i
> 0 && device
[i
- 1] == '\n')
62 irman
= irman_open(device
);
64 fprintf(stderr
, "error initialising irman: `%s'\n",
68 for (i
= 0; button_names
[i
]; i
++) {
69 char code
[IRMAN_CODE_LEN
];
70 char text
[IRMAN_TEXT_SIZE
];
72 printf("%s: ", button_names
[i
]);
74 if (irman_get_code(irman
, code
)) {
76 fprintf(stderr
, "irman not initialised (bug)\n");
78 fprintf(stderr
, "error reading code: `%s'\n",
84 irman_code_to_text(text
, code
);
85 sconf_set_str_option(&sconf_head
, button_names
[i
], text
);
89 sconf_set_str_option(&sconf_head
, "irman_device", device
);