From: Janusz Krzysztofik <jkrzyszt@ti...> - 2009-08-18 17:45:25
Maybe my LIRC application is not very common, but it behaves very well. I use
lircd/lircexec with devinput driver on my ARM/OMAP based Amstrad E3 (Delta)
videophone for controlling Asterisk PBX daemon from the machine (phone)
keypad (and not from a remote, like most of LIRC users). That works almost
out of the box, with some reasonable effort on lircexec configuration.
However, the machine is equipped with one more source of input events except
keypad: a phone hook switch. It is different from a key or a button in that
it generates events of type EV_SW. Since it is a switch, not a toggle key,
both ON (press) and OFF (release) events are equally important to my
application. Unfortunately, for events of type EV_SW, devinput driver doesn't
translate different state changes to distinctive codes, like it does for
EV_KEY, so I was not able to distinguish going off-hook from on-hook without
patching the driver.
The patch that works for me follows. I hope you accept it even if my
application may be the only one that needs it, as there are probably not many
remotes equipped with switches, not buttons :).
Created and tested against lirc-0.8.5.
Signed-off-by: Janusz Krzysztofik <jkrzyszt@...>
--- lirc-0.8.5/daemons/hw_devinput.c.orig 2009-08-18 18:57:53.000000000 +0200
+++ lirc-0.8.5/daemons/hw_devinput.c 2009-08-18 18:59:13.000000000 +0200
@@ -279,7 +279,8 @@ char *devinput_rec(struct ir_remote *rem
event.type, event.code, event.value);
- code = (event.type == EV_KEY && event.value != 0) ? 0x80000000 : 0;
+ code = ((event.type == EV_KEY || event.type == EV_SW) &&
+ event.value != 0) ? 0x80000000 : 0;
code |= ((event.type & 0x7fff) << 16);
code |= event.code;
Janusz Krzysztofik "jkrzyszt@..." wrote:
> The patch that works for me follows. I hope you accept it even if my
> application may be the only one that needs it, as there are probably not
> many remotes equipped with switches, not buttons :).
I applied the patch. A proper solution would be to use more than 32 bits
in the lircd.conf for devinput devices and also add the event value to the
button code, but it would mean that everyone would have to change the
Get latest updates about Open Source Projects, Conferences and News.