From owner-freebsd-multimedia@FreeBSD.ORG Sat Mar 5 20:50:21 2011 Return-Path: Delivered-To: freebsd-multimedia@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4607E106566B; Sat, 5 Mar 2011 20:50:21 +0000 (UTC) (envelope-from nox@jelal.kn-bremen.de) Received: from smtp.kn-bremen.de (gelbbaer.kn-bremen.de [78.46.108.116]) by mx1.freebsd.org (Postfix) with ESMTP id CCAC58FC16; Sat, 5 Mar 2011 20:50:20 +0000 (UTC) Received: by smtp.kn-bremen.de (Postfix, from userid 10) id E41981E000FA; Sat, 5 Mar 2011 21:50:19 +0100 (CET) Received: from triton8.kn-bremen.de (noident@localhost [127.0.0.1]) by triton8.kn-bremen.de (8.14.4/8.14.3) with ESMTP id p25KmMVE028727; Sat, 5 Mar 2011 21:48:22 +0100 (CET) (envelope-from nox@triton8.kn-bremen.de) Received: (from nox@localhost) by triton8.kn-bremen.de (8.14.4/8.14.3/Submit) id p25KmMO5028726; Sat, 5 Mar 2011 21:48:22 +0100 (CET) (envelope-from nox) From: Juergen Lock Date: Sat, 5 Mar 2011 21:48:22 +0100 To: freebsd-multimedia@FreeBSD.org Message-ID: <20110305204822.GA28311@triton8.kn-bremen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Cc: decke@FreeBSD.org Subject: patch: xbmc and lirc X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Mar 2011 20:50:21 -0000 Hi! So the xbmc port atm doesn't build its lirc client code because that code uses inotify() which is a Linuxism. Today I took a closer look and found it actually only uses inotify() to find out when lircd is stopped, which at least on FreeBSD it will also find out by receiving an eof from the socket fd so we can actually just disable the inotify() code. Did that, added an autoconf check for good measure, and that got lirc working. :) I've put the patch here: http://people.freebsd.org/~nox/dvb/xbmc/patch-xbmc-lirc.txt (the first hunk is actually redundant, instead you should just remove files/patch-guilib__common__Makefile.in - I'll add the patch without it at the end.) The mceusb remote works as is then with webcamd, for dvb tuner remotes supported by the Linux code webcamd uses you can start with this ~/.xbmc/userdata/Lircmap.xml : http://people.freebsd.org/~nox/dvb/xbmc/Lircmap.xml note the comments at the beginning, you may need to remap important buttons for your particular remote. Also see here: http://wiki.xbmc.org/index.php?title=HOW-TO_setup_Lirc_to_talk_to_XBMC And here comes the patch. Enjoy, :) Juergen --- guilib/system.h.orig +++ guilib/system.h @@ -135,9 +135,7 @@ #define HAS_GLX #define HAS_LINUX_NETWORK #define HAS_SDL_AUDIO -#if !defined(__FreeBSD__) #define HAS_LIRC -#endif #define HAS_SDL_WIN_EVENTS #ifdef HAVE_LIBPULSE #define HAS_PULSEAUDIO --- configure.in.orig +++ configure.in @@ -516,7 +516,7 @@ AC_FUNC_STRFTIME AC_FUNC_STRTOD AC_FUNC_UTIME_NULL AC_FUNC_VPRINTF -AC_CHECK_FUNCS([atexit dup2 fdatasync floor fs_stat_dev ftime ftruncate getcwd gethostbyaddr gethostbyname gethostname getpagesize getpass gettimeofday inet_ntoa lchown localeconv memchr memmove memset mkdir modf munmap pow rmdir select setenv setlocale socket sqrt strcasecmp strchr strcspn strdup strerror strncasecmp strpbrk strrchr strspn strstr strtol strtoul sysinfo tzset utime]) +AC_CHECK_FUNCS([atexit dup2 fdatasync floor fs_stat_dev ftime ftruncate getcwd gethostbyaddr gethostbyname gethostname getpagesize getpass gettimeofday inet_ntoa inotify lchown localeconv memchr memmove memset mkdir modf munmap pow rmdir select setenv setlocale socket sqrt strcasecmp strchr strcspn strdup strerror strncasecmp strpbrk strrchr strspn strstr strtol strtoul sysinfo tzset utime]) # Check for various sizes AC_CHECK_SIZEOF([int]) --- guilib/common/LIRC.cpp.orig +++ guilib/common/LIRC.cpp @@ -19,11 +19,14 @@ * */ +#include "config.h" #include #include #include #include +#ifdef HAVE_INOTIFY #include +#endif #include #include #include "LIRC.h" @@ -92,12 +95,14 @@ void CRemoteControl::Disconnect() close(m_fd); m_fd = -1; m_file = NULL; +#ifdef HAVE_INOTIFY if (m_inotify_wd >= 0) { inotify_rm_watch(m_inotify_fd, m_inotify_wd); m_inotify_wd = -1; } if (m_inotify_fd >= 0) close(m_inotify_fd); +#endif m_inReply = false; m_nrSending = 0; @@ -148,6 +153,7 @@ void CRemoteControl::Initialize() { if ((m_file = fdopen(m_fd, "r+")) != NULL) { +#ifdef HAVE_INOTIFY // Setup inotify so we can disconnect if lircd is restarted if ((m_inotify_fd = inotify_init()) >= 0) { @@ -168,6 +174,10 @@ void CRemoteControl::Initialize() } } } +#else + m_bInitialized = true; + CLog::Log(LOGINFO, "LIRC %s: sucessfully started", __FUNCTION__); +#endif } else CLog::Log(LOGERROR, "LIRC %s: fdopen failed: %s", __FUNCTION__, strerror(errno)); @@ -206,6 +216,7 @@ void CRemoteControl::Initialize() } bool CRemoteControl::CheckDevice() { +#ifdef HAVE_INOTIFY if (m_inotify_fd < 0 || m_inotify_wd < 0) return true; // inotify wasn't setup for some reason, assume all is well int bufsize = sizeof(struct inotify_event) + PATH_MAX; @@ -220,6 +231,7 @@ bool CRemoteControl::CheckDevice() { } i += sizeof(struct inotify_event)+e->len; } +#endif return true; }