Skip to content

Commit 21f80da

Browse files
committed
Update lirc_client.c to bring it up to date with the version in LIRC release 0.8.6. There are very few changes, primarily providing better handling of exceptional circumstances.
git-svn-id: http://svn.mythtv.org/svn/trunk@25415 7dbf422c-18fa-0310-86e9-fd20926502f2
1 parent 44beec3 commit 21f80da

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

mythtv/libs/libmythui/lirc_client.c

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* NOTE: Extracted from LIRC release 0.8.4a -- dtk */
2+
/* Updated to LIRC release 0.8.6 */
23

34
/****************************************************************************
45
** lirc_client.c ***********************************************************
@@ -1575,14 +1576,19 @@ static int lirc_iscode(struct lirc_config_entry *scan, char *remote,
15751576
if(scan->code->next==NULL || rep==0)
15761577
{
15771578
scan->next_code=scan->next_code->next;
1579+
if(scan->code->next != NULL)
1580+
{
1581+
iscode=1;
1582+
}
15781583
}
15791584
/* sequence completed? */
15801585
if(scan->next_code==NULL)
15811586
{
15821587
scan->next_code=scan->code;
1583-
iscode=scan->code->next!=NULL || rep==0 ||
1588+
if(scan->code->next!=NULL || rep==0 ||
15841589
(scan->rep>0 && rep>scan->rep_delay &&
1585-
((rep-scan->rep_delay-1)%scan->rep)==0);
1590+
((rep-scan->rep_delay-1)%scan->rep)==0))
1591+
iscode=2;
15861592
}
15871593
return iscode;
15881594
}
@@ -1720,6 +1726,7 @@ static int lirc_code2char_internal(const struct lirc_state *state,
17201726
char *remote,*button;
17211727
char *s=NULL;
17221728
struct lirc_config_entry *scan;
1729+
int exec_level;
17231730
int quit_happened;
17241731

17251732
*string=NULL;
@@ -1743,18 +1750,26 @@ static int lirc_code2char_internal(const struct lirc_state *state,
17431750
quit_happened=0;
17441751
while(scan!=NULL)
17451752
{
1746-
if(lirc_iscode(scan,remote,button,rep) &&
1753+
exec_level = lirc_iscode(scan,remote,button,rep);
1754+
if(exec_level > 0 &&
17471755
(scan->mode==NULL ||
17481756
(scan->mode!=NULL &&
17491757
config->current_mode!=NULL &&
17501758
strcasecmp(scan->mode,config->current_mode)==0)) &&
17511759
quit_happened==0
17521760
)
17531761
{
1754-
s=lirc_execute(state,config,scan);
1755-
if(s != NULL && prog != NULL)
1762+
if(exec_level > 1)
1763+
{
1764+
s=lirc_execute(state,config,scan);
1765+
if(s != NULL && prog != NULL)
1766+
{
1767+
*prog = scan->prog;
1768+
}
1769+
}
1770+
else
17561771
{
1757-
*prog = scan->prog;
1772+
s = NULL;
17581773
}
17591774
if(scan->flags&quit)
17601775
{

0 commit comments

Comments
 (0)