JackOfAll wrote: 
> Adrian,
> 
> Sad, the things I go to sleep dreaming about.... And this is just me
> hypothesising rather than debugging and proving it....
> 
> I think I know where the problem is..... Just getting rid of the break
> at line 123 in ir.c, will cure this if I am right. 
> 
> Basically, you need to keep calling lirc_code2char until you get a NULL
> char or a non zero return. At the moment you break the inner while
> (lircrc lookup) loop after the first lookup success, and then continue
> the outer loop, but what is happening on second remote key press, is
> that lirc_code2char returns the NULL char for the previous loop lookup,
> the first time it is called for the second event. So the second (and
> every alternate button press isn't lokked up.) ISTR, seeing this when I
> did debug the original interactive patch. And I'm pretty sure removing
> the break will fix it and result in the last mapping from the lircrc
> file being used, rather than the first, at the point there are several
> mappings, which is the behaviour I'd want anyway. Hope that makes sense.
> ;) Will try this myself, after I finish typing this and confirm.

OK - but we can't send two result codes to the other thread without a
buffer of some sort - so suggest the following:

Code:
--------------------
    
  --- a/ir.c
  +++ b/ir.c
  @@ -114,13 +114,15 @@ static void *ir_thread() {
  
  if (config) {
  // allow lirc_client to decode then lookup cmd in our table
  -                       // we can only send one IR event to slimproto so 
break after first one
  +                       // we can only send one IR event to slimproto so take 
the first one
  char *c;
  while (lirc_code2char(config, code, &c) == 0 && c != NULL) {
  -                               ir_code = ir_cmd_map(c);
  -                               if (ir_code) {
  +                               u32_t ir = ir_cmd_map(c);
  +                               if (ir && !ir_code) {
  +                                       ir_code = ir;
  LOG_DEBUG("ir cmd: %s -> %x", c, ir_code);
  -                                       break;
  +                               } else {
  +                                       LOG_DEBUG("ignored ir: %s", c);
  }
  }
  }
  
--------------------


------------------------------------------------------------------------
Triode's Profile: http://forums.slimdevices.com/member.php?userid=17
View this thread: http://forums.slimdevices.com/showthread.php?t=97046

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to