blob: 0ad34ca2f476402f9c80327432e0bd957bcb0db5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include <lirc/lirc_client.h>
#include "lirc.h"
static struct lirc_config *lc = NULL;
static int lirc_socket = 0;
int ncmpc_lirc_open()
{
if ((lirc_socket = lirc_init("ncmpc", 0)) == -1)
return -1;
if (lirc_readconfig(NULL, &lc, NULL)) {
lirc_deinit();
return -1;
}
return lirc_socket;
}
void ncmpc_lirc_close()
{
if (lc)
lirc_freeconfig(lc);
lirc_deinit();
}
command_t ncmpc_lirc_get_command()
{
char *code = NULL, *cmd = NULL;
if (lirc_nextcode(&code) != 0)
return CMD_NONE;
if (lirc_code2char(lc, code, &cmd) != 0)
return CMD_NONE;
if (!cmd)
return CMD_NONE;
return get_key_command_from_name(cmd);
}
|