diff options
Diffstat (limited to 'xine_frontend_lirc.c')
-rw-r--r-- | xine_frontend_lirc.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/xine_frontend_lirc.c b/xine_frontend_lirc.c index bef84f22..d8b9a8cf 100644 --- a/xine_frontend_lirc.c +++ b/xine_frontend_lirc.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: xine_frontend_lirc.c,v 1.5 2006-12-24 17:18:33 phintuka Exp $ + * $Id: xine_frontend_lirc.c,v 1.6 2007-01-01 06:43:46 phintuka Exp $ * */ /* @@ -20,7 +20,7 @@ * * LIRC support added by Carsten Koch <Carsten.Koch@icem.de> 2000-06-16. * - * $Id: xine_frontend_lirc.c,v 1.5 2006-12-24 17:18:33 phintuka Exp $ + * $Id: xine_frontend_lirc.c,v 1.6 2007-01-01 06:43:46 phintuka Exp $ */ @@ -87,7 +87,7 @@ static void lircd_connect(void) } } -void *lirc_receiver_thread(void *fe) +static void *lirc_receiver_thread(void *fe) { int timeout = -1; uint64_t FirstTime = time_ms(); @@ -215,3 +215,32 @@ void *lirc_receiver_thread(void *fe) pthread_exit(NULL); return NULL; /* never reached */ } + +void lirc_start(fe_t *fe, char *lirc_dev, int repeat_emu) +{ + if(lirc_dev) { + int err; + lirc_device_name = lirc_dev; + lirc_repeat_emu = repeat_emu; + if ((err = pthread_create (&lirc_thread, + NULL, lirc_receiver_thread, + (void*)fe)) != 0) { + fprintf(stderr, "can't create new thread for lirc (%s)\n", + strerror(err)); + } + } +} + +void lirc_stop(void) +{ + if(lirc_device_name) { + void *p; + /*free(lirc_device_name);*/ + lirc_device_name = NULL; + if(fd_lirc >= 0) + close(fd_lirc); + fd_lirc = -1; + pthread_cancel (lirc_thread); + pthread_join (lirc_thread, &p); + } +} |