Hi,
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(a)tis.icnet.pl>
---
--- 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.time.tv_sec, event.time.tv_usec,
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;