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