
On Thu, Feb 21, 2002 at 04:11:47PM +0100, Jean-Paul Saman wrote:
> Sigmund Augdal wrote:
> >>  Woops, sorry. Fixed. But isn't there a way to have lirc_nextcode()
> >>timeout after a specified delay ? Blocking like this is a pretty
> >>annoying behaviour.
> >>
> >
> >I agree and tried to look into that. lirc_nextcode() has noe timeout 
> >option. It seems that it uses read() to read from the lirc-socket, and i 
> >susspect that this is where it sleeps. read() also has noe timeout 
> >options, but to be honest my knowledge is rapidly runnig out here.
> >
> >I thougth maybe I could make another interface-plugin do the dirty work, 
> >but looking at the existing code I found little room for running two 
> >interface-plugins at once, but didn't somone say that this was planed?
> >
> >Sigmund 
> >
> >
> 
> Do a non-blocking read
> 
> From "man open"
> 	O_NONBLOCK or O_NDELAY
>               When  possible,  the file is opened in non-blocking
>               mode.
> 
> Then you could use a polling method to do your own timeout mechanism
> -- 
> Kind greetings,
> 
> Jean-Paul Saman
> 
> e-mail (work): saman@natlab.research.philips.com
> phone  (work): 040 27 42909
> ------------------------------------------------------------
> Ordina TA,
> Science Park Eindhoven 5602, Postbus 293, 5600 AG Eindhoven
> e-mail : jean-paul.saman@ordina.nl
> phone  : 040 2601200
> fax    : 040 2601199
> 
> 
> -- 
> This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
> To unsubscribe, please read http://www.videolan.org/lists.html
> If you are in trouble, please contact <postmaster@videolan.org>


Thanks for the help, I've learned a lot to day. The read() is inside the 
lib, and it reads from a socket so there's no open() but this seems to 
be the way to do it. This patch flawless for me.


Sigmund


-- Attached file included as plaintext by Listar --

? patch
Index: lirc.c
===================================================================
RCS file: /var/cvs/videolan/vlc/plugins/lirc/lirc.c,v
retrieving revision 1.6
diff -r1.6 lirc.c
29c29
< 
---
> #include <fcntl.h>
97a98
>     int fd,a;
104c105
<     };
---
>     }
106c107,109
<     if( lirc_init("vlc", 1) == -1 )
---
>     /*lirc_init returns a filedescriptor for the lircsocket*/
>     fd = lirc_init("vlc", 1);
>     if( fd == -1 )
111a115,116
>     a = fcntl( fd, F_GETFL );
>     fcntl( fd, F_SETFL, a | O_NONBLOCK ); /*we want polling!*/
143,145d147
<     /* Manage core vlc functions through the callback */
<     p_intf->pf_manage( p_intf );
< 
149a152,153
> 	    p_intf->pf_manage( p_intf );
> 	    msleep( INTF_IDLE_SLEEP );
267,268d270
<         free( code );
< 
270c272,274
<         p_intf->pf_manage( p_intf );
---
> 	p_intf->pf_manage( p_intf );
>         msleep( INTF_IDLE_SLEEP );
> 	free( code );


-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://www.videolan.org/lists.html
If you are in trouble, please contact <postmaster@videolan.org>

