mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Fixed generating k_Release key events for LIRC remote controls
This commit is contained in:
parent
c9c15a727d
commit
6edfcda43a
5
HISTORY
5
HISTORY
@ -9056,7 +9056,7 @@ Video Disk Recorder Revision History
|
|||||||
- Fixed detecting the inclusion of STL header files in tools.h (thanks to Jasmin
|
- Fixed detecting the inclusion of STL header files in tools.h (thanks to Jasmin
|
||||||
Jessich).
|
Jessich).
|
||||||
|
|
||||||
2017-05-29: Version 2.3.6
|
2017-05-30: Version 2.3.6
|
||||||
|
|
||||||
- Added debug output for checking the correct sequence of locking global lists
|
- Added debug output for checking the correct sequence of locking global lists
|
||||||
(with help and suggestions from Jasmin Jessich). To activate this, define the
|
(with help and suggestions from Jasmin Jessich). To activate this, define the
|
||||||
@ -9081,3 +9081,6 @@ Video Disk Recorder Revision History
|
|||||||
- Added clearing CiResourceHandlers before shutting down the plugin manager.
|
- Added clearing CiResourceHandlers before shutting down the plugin manager.
|
||||||
- Fixed a double channel switch when pressing the Channel+/- keys while no menu
|
- Fixed a double channel switch when pressing the Channel+/- keys while no menu
|
||||||
or channel display is open.
|
or channel display is open.
|
||||||
|
- Fixed generating k_Release key events for LIRC remote controls (due to the short
|
||||||
|
timeout another normal key was sometimes put into the queue after the generated
|
||||||
|
release). Also removed some code redundancy and added some buffer checks.
|
||||||
|
21
lirc.c
21
lirc.c
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* LIRC support added by Carsten Koch <Carsten.Koch@icem.de> 2000-06-16.
|
* LIRC support added by Carsten Koch <Carsten.Koch@icem.de> 2000-06-16.
|
||||||
*
|
*
|
||||||
* $Id: lirc.c 3.2 2013/10/29 12:32:12 kls Exp $
|
* $Id: lirc.c 4.1 2017/05/30 11:02:17 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "lirc.h"
|
#include "lirc.h"
|
||||||
@ -20,7 +20,7 @@ cLircRemote::cLircRemote(const char *DeviceName)
|
|||||||
,cThread("LIRC remote control")
|
,cThread("LIRC remote control")
|
||||||
{
|
{
|
||||||
addr.sun_family = AF_UNIX;
|
addr.sun_family = AF_UNIX;
|
||||||
strcpy(addr.sun_path, DeviceName);
|
strn0cpy(addr.sun_path, DeviceName, sizeof(addr.sun_path));
|
||||||
if (!Connect())
|
if (!Connect())
|
||||||
f = -1;
|
f = -1;
|
||||||
Start();
|
Start();
|
||||||
@ -94,12 +94,12 @@ void cLircRemote::Action(void)
|
|||||||
}
|
}
|
||||||
int Delta = ThisTime.Elapsed(); // the time between two subsequent LIRC events
|
int Delta = ThisTime.Elapsed(); // the time between two subsequent LIRC events
|
||||||
ThisTime.Set();
|
ThisTime.Set();
|
||||||
if (count == 0) {
|
if (count == 0) { // new key pressed
|
||||||
if (strcmp(KeyName, LastKeyName) == 0 && FirstTime.Elapsed() < (uint)Setup.RcRepeatDelay)
|
if (strcmp(KeyName, LastKeyName) == 0 && FirstTime.Elapsed() < (uint)Setup.RcRepeatDelay)
|
||||||
continue; // skip keys coming in too fast
|
continue; // skip keys coming in too fast
|
||||||
if (repeat)
|
if (repeat)
|
||||||
Put(LastKeyName, false, true);
|
Put(LastKeyName, false, true); // generated release for previous repeated key
|
||||||
strcpy(LastKeyName, KeyName);
|
strn0cpy(LastKeyName, KeyName, sizeof(LastKeyName));
|
||||||
pressed = true;
|
pressed = true;
|
||||||
repeat = false;
|
repeat = false;
|
||||||
FirstTime.Set();
|
FirstTime.Set();
|
||||||
@ -112,25 +112,20 @@ void cLircRemote::Action(void)
|
|||||||
else {
|
else {
|
||||||
pressed = true;
|
pressed = true;
|
||||||
repeat = true;
|
repeat = true;
|
||||||
timeout = Delta * 10 / 9;
|
timeout = Delta * 3 / 2;
|
||||||
}
|
}
|
||||||
if (pressed) {
|
if (pressed) {
|
||||||
LastTime.Set();
|
LastTime.Set();
|
||||||
Put(KeyName, repeat);
|
Put(KeyName, repeat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (pressed && repeat) { // the last one was a repeat, so let's generate a release
|
else {
|
||||||
|
if (pressed && repeat) // the last one was a repeat, so let's generate a release
|
||||||
Put(LastKeyName, false, true);
|
Put(LastKeyName, false, true);
|
||||||
pressed = false;
|
pressed = false;
|
||||||
repeat = false;
|
repeat = false;
|
||||||
*LastKeyName = 0;
|
*LastKeyName = 0;
|
||||||
timeout = -1;
|
timeout = -1;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
pressed = false;
|
|
||||||
repeat = false;
|
|
||||||
*LastKeyName = 0;
|
|
||||||
timeout = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user