25 #ifdef HAVE_KERNEL_LIRC_H
26 #include <linux/lirc.h>
28 #include "media/lirc.h"
31 #include "lirc/release.h"
32 #include "lirc/receive.h"
33 #include "lirc/lirc_log.h"
37 static struct timeval release_time;
39 static struct ir_ncode* release_ncode;
41 static int release_reps;
42 static lirc_t release_gap;
45 static struct ir_ncode* release_ncode2;
54 if (release_remote == NULL)
58 gap.tv_usec = release_gap;
60 gettimeofday(&release_time, NULL);
61 timeradd(&release_time, &gap, &release_time);
69 if (reps == 0 && release_remote != NULL) {
70 release_remote2 = release_remote;
71 release_ncode2 = release_ncode;
72 release_code2 = release_code;
75 release_remote = remote;
76 release_ncode = ncode;
80 release_gap = upper_limit(remote,
83 + receive_timeout(upper_limit(remote,
86 log_trace(
"release_gap: %lu", release_gap);
90 void get_release_data(
const char** remote_name,
91 const char** button_name,
94 if (release_remote != NULL) {
95 *remote_name = release_remote->
name;
96 *button_name = release_ncode->
name;
99 *remote_name = *button_name =
"(NULL)";
104 void set_release_suffix(
const char* s)
114 const char* check_release_event(
const char** remote_name,
115 const char** button_name)
119 if (release_remote2 != NULL) {
120 *remote_name = release_remote2->
name;
121 *button_name = release_ncode2->
name;
124 release_remote2->
name,
125 release_ncode2->
name,
129 release_remote2 = NULL;
130 release_ncode2 = NULL;
145 const char** button_name)
149 if (release_remote != NULL) {
151 *remote_name = release_remote->
name;
152 *button_name = release_ncode->
name;
155 release_remote->
name,
160 timerclear(&release_time);
161 release_remote = NULL;
162 release_ncode = NULL;
175 const char* release_map_remotes(
struct ir_remote* old,
177 const char** remote_name,
178 const char** button_name)
183 if (release_remote2 != NULL) {
185 log_error(
"release_remote2 still in use");
186 release_remote2 = NULL;
192 if (remote && ncode) {
193 release_remote = remote;
194 release_ncode = ncode;
One remote as represented in the configuration file.
lirc_t max_total_signal_length
how long is the longest signal including gap
void get_release_time(struct timeval *tv)
Get time for pending release event if it exists, else a noop.
const char * name
name of remote control
struct ir_ncode * get_code_by_name(const struct ir_remote *remote, const char *name)
Return code with given name in remote's list of codes or NULL.
struct ir_remote * get_ir_remote(const struct ir_remote *remotes, const char *name)
Return ir_remote with given name in remotes list, or NULL if not found.
lirc_t min_gap_length
how long is the shortest gap
#define PACKET_SIZE
IR transmission packet size.
logchannel_t
Log channels used to filter messages.
char * name
Name of command.
#define log_trace2(fmt,...)
Log a trace2 message.
#define log_error(fmt,...)
Log an error message.
const char * trigger_release_event(const char **remote_name, const char **button_name)
If there is a release event pending clears the release timer and formats a complete client message...
void register_button_press(struct ir_remote *remote, struct ir_ncode *ncode, ir_code code, int reps)
Set up pending release events for given button, including the release_gap.
int write_message(char *buffer, size_t size, const char *remote_name, const char *button_name, const char *button_suffix, ir_code code, int reps)
Formats the arguments into a readable string.
#define log_trace(fmt,...)
Log a trace message.
void register_input(void)
If there is a pending release event, set timer to current time + release_gap.
const struct ir_remote * is_in_remotes(const struct ir_remote *remotes, const struct ir_remote *remote)
Test if a given remote is in a list of remotes.
#define LIRC_RELEASE_SUFFIX
Suffix added to release events.
IR Command, corresponding to one (command defining) line of the configuration file.
int release_detected
set by release generator
uint64_t ir_code
Denotes an internal coded representation for an IR transmission.