diff -Nru libcec-2.1.3/ChangeLog libcec-2.1.4/ChangeLog --- libcec-2.1.3/ChangeLog 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/ChangeLog 2013-12-14 00:02:42.000000000 +0000 @@ -1,3 +1,60 @@ +libcec (2.1.4-1) unstable; urgency=low + + * changed / added: + * set the vendor id of devices handled by libCEC to our vendor id + * added protection against standby without a notification from XBMC and + clock changes. issue #186 + * update system audio mode when audio system devices are activated + * added vendor id and name 'Harman/Kardon' + * added vendor id and name 'Marantz' + * cec-tray: support for away mode + * cec-tray: support for screensaver events + * fixed: + * fixed potential crash when SendCommand returns NULL + * fixed crash when CCECProcessor::Transmit was called after + CCECProcessor::Close + * always call the SourceActivated() callback in + CCECBusDevice::MarkAsActiveSource(), even when we were already active, + and let clients handle dupes. this prevented the screensaver from + being cancelled in XBMC + * send our vendor id when the tv sends it's vendor id + * transmit our physical address when the TV sends it's physical address + * potential deadlock + * leak on exit in CWaitForResponse::Clear() + * also transmit an active source message as response to a set stream path + command when we were already marked as active. bugzid: 3116 + * only send an active source message when receiving a routing change to an + address handled by libCEC. issue #56 + * HandleVendorRemoteButtonUp -> HandleUserControlRelease for all vendors + * silence warning for xx:a0:00:09:b0:00:80:20. bugzid: 2559 + * fixed comboKeyTimeout=0. closes #168 + * Panasonic: doesn't request the active source status when powered up, but + it does send a vendor command. send an active source message when we're + marked as active source after receiving this command. issue #192 + * possible crash when the tv does not respond to polls and the client isn't + registered yet. don't poll the tv in monitoring mode. closes #163 + * Panasonic: standby command + * Panasonic: silence 'unmapped code' warning. bugzid: 2375 + * LG: clean up and attempt to fix issue #176 + * LG: newer firmwares don't send a second power status request after it's + been requested once and replied with 'standby -> on' like previous + versions. send an active source message in an attempt to fix this. issue: + #176 + * Sharp: check whether the 'auto power on' option is disabled and tell the + user how to enable it + * Samsung: respond to vendor command 0x23 sent by samsung. attempt to fix + bugzid: 2164 + * cec-client: try to reconnect when the connection was lost + * cec-tray: crash on load (MissingManifestResourceException) + * cec-tray: crash or deadlock on exit + * cec-tray: crash when the connection to the adapter was lost + * cec-tray: display TV not responding warning on top + * windows: build libCEC and cec-client against toolset v100 (VS2010) + * FreeBSD: proper the adapter detection. credits @fneufneu + * suppress mangling warning. credits @warped-rudi. closes #190 + + -- Pulse-Eight Packaging Sat, 13 Dec 2013 16:02:00 +0100 + libcec (2.1.3-1) unstable; urgency=low * changed / added: diff -Nru libcec-2.1.3/Makefile.in libcec-2.1.4/Makefile.in --- libcec-2.1.3/Makefile.in 2013-05-12 13:12:41.000000000 +0000 +++ libcec-2.1.4/Makefile.in 2013-12-14 00:03:04.000000000 +0000 @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -15,23 +15,6 @@ @SET_MAKE@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ - esac; \ - test $$am__dry = yes; \ - } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -80,11 +63,6 @@ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ @@ -502,10 +480,13 @@ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - $(am__make_dryrun) \ - || test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ @@ -591,7 +572,7 @@ *.zip*) \ unzip $(distdir).zip ;;\ esac - chmod -R a-w $(distdir); chmod u+w $(distdir) + chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) diff -Nru libcec-2.1.3/aclocal.m4 libcec-2.1.4/aclocal.m4 --- libcec-2.1.3/aclocal.m4 2013-05-12 13:12:40.000000000 +0000 +++ libcec-2.1.4/aclocal.m4 2013-12-14 00:03:02.000000000 +0000 @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.11.6 -*- Autoconf -*- +# generated automatically by aclocal 1.11.3 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, @@ -14,8 +14,8 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, -[m4_warning([this file was generated for autoconf 2.69. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, +[m4_warning([this file was generated for autoconf 2.68. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) @@ -1338,14 +1338,7 @@ LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - case `/usr/bin/file conftest.o` in - *x86-64*) - LD="${LD-ld} -m elf32_x86_64" - ;; - *) - LD="${LD-ld} -m elf_i386" - ;; - esac + LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" @@ -1709,8 +1702,7 @@ ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len" && \ - test undefined != "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -2534,6 +2526,17 @@ esac ;; +gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no @@ -2650,7 +2653,7 @@ ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) +linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no @@ -3266,6 +3269,10 @@ fi ;; +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + haiku*) lt_cv_deplibs_check_method=pass_all ;; @@ -3304,7 +3311,7 @@ ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) +linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; @@ -4056,7 +4063,7 @@ ;; esac ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler @@ -4355,7 +4362,7 @@ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -6244,6 +6251,9 @@ _LT_TAGVAR(ld_shlibs, $1)=yes ;; + gnu*) + ;; + haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes @@ -6405,7 +6415,7 @@ _LT_TAGVAR(inherit_rpath, $1)=yes ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler @@ -8794,7 +8804,7 @@ [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.11.6], [], +m4_if([$1], [1.11.3], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -8810,7 +8820,7 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.11.6])dnl +[AM_AUTOMAKE_VERSION([1.11.3])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) diff -Nru libcec-2.1.3/config.sub libcec-2.1.4/config.sub --- libcec-2.1.3/config.sub 2013-05-12 13:12:41.000000000 +0000 +++ libcec-2.1.4/config.sub 2013-12-14 00:03:04.000000000 +0000 @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. -timestamp='2012-04-18' +timestamp='2012-02-10' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -225,12 +225,6 @@ -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; - -lynx*178) - os=-lynxos178 - ;; - -lynx*5) - os=-lynxos5 - ;; -lynx*) os=-lynxos ;; @@ -1543,9 +1537,6 @@ c4x-* | tic4x-*) os=-coff ;; - hexagon-*) - os=-elf - ;; tic54x-*) os=-coff ;; diff -Nru libcec-2.1.3/configure libcec-2.1.4/configure --- libcec-2.1.3/configure 2013-05-12 13:12:40.000000000 +0000 +++ libcec-2.1.4/configure 2013-12-14 00:03:03.000000000 +0000 @@ -1,11 +1,13 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libcec 2:1:0. +# Generated by GNU Autoconf 2.68 for libcec 2:1:0. # # Report bugs to . # # -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -134,31 +136,6 @@ # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh @@ -192,8 +169,7 @@ else exitcode=1; echo positional parameters were not saved. fi -test x\$exitcode = x0 || exit 1 -test -x / || exit 1" +test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && @@ -246,25 +222,21 @@ if test "x$CONFIG_SHELL" != x; then : - export CONFIG_SHELL - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : @@ -367,14 +339,6 @@ } # as_fn_mkdir_p - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take @@ -496,10 +460,6 @@ chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -534,16 +494,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. + # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' + as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -555,8 +515,28 @@ as_mkdir_p=false fi -as_test_x='test -x' -as_executable_p=as_fn_executable_p +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -1272,6 +1252,8 @@ if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1553,9 +1535,9 @@ if $ac_init_version; then cat <<\_ACEOF libcec configure 2:1:0 -generated by GNU Autoconf 2.69 +generated by GNU Autoconf 2.68 -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1669,7 +1651,7 @@ test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || - test -x conftest$ac_exeext + $as_test_x conftest$ac_exeext }; then : ac_retval=0 else @@ -1929,7 +1911,7 @@ test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || - test -x conftest$ac_exeext + $as_test_x conftest$ac_exeext }; then : ac_retval=0 else @@ -2110,7 +2092,7 @@ running configure, to aid debugging if configure makes a mistake. It was created by libcec $as_me 2:1:0, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2529,7 +2511,7 @@ # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -2698,7 +2680,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2738,7 +2720,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2789,7 +2771,7 @@ test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ @@ -2842,7 +2824,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3178,7 +3160,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3222,7 +3204,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4092,7 +4074,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4132,7 +4114,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4185,7 +4167,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4226,7 +4208,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -4284,7 +4266,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4328,7 +4310,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4524,7 +4506,8 @@ /* end confdefs.h. */ #include #include -struct stat; +#include +#include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -4887,7 +4870,7 @@ for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_SED" || continue + { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in @@ -4963,7 +4946,7 @@ for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in @@ -5029,7 +5012,7 @@ for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in @@ -5096,7 +5079,7 @@ for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_FGREP" || continue + { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in @@ -5352,7 +5335,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5396,7 +5379,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5585,8 +5568,7 @@ ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len" && \ - test undefined != "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -5821,7 +5803,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5861,7 +5843,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5987,6 +5969,10 @@ fi ;; +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + haiku*) lt_cv_deplibs_check_method=pass_all ;; @@ -6025,7 +6011,7 @@ ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) +linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; @@ -6163,7 +6149,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6203,7 +6189,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6307,7 +6293,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6351,7 +6337,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6476,7 +6462,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6516,7 +6502,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6575,7 +6561,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6615,7 +6601,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7124,14 +7110,7 @@ LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - case `/usr/bin/file conftest.o` in - *x86-64*) - LD="${LD-ld} -m elf32_x86_64" - ;; - *) - LD="${LD-ld} -m elf_i386" - ;; - esac + LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" @@ -7272,7 +7251,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7312,7 +7291,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7392,7 +7371,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7432,7 +7411,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7484,7 +7463,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7524,7 +7503,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7576,7 +7555,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7616,7 +7595,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7668,7 +7647,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7708,7 +7687,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7760,7 +7739,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -7800,7 +7779,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -8966,7 +8945,7 @@ lt_prog_compiler_static='-non_shared' ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -11136,6 +11115,17 @@ esac ;; +gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no @@ -11252,7 +11242,7 @@ ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) +linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no @@ -13075,6 +13065,9 @@ ld_shlibs_CXX=yes ;; + gnu*) + ;; + haiku*) archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs_CXX=yes @@ -13236,7 +13229,7 @@ inherit_rpath_CXX=yes ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler @@ -14096,7 +14089,7 @@ ;; esac ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler @@ -14968,6 +14961,17 @@ esac ;; +gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no @@ -15084,7 +15088,7 @@ ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) +linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no @@ -15606,7 +15610,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_HAVE_PKG_CONFIG="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -15880,7 +15884,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -15923,7 +15927,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -17306,7 +17310,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_HAVE_GIT="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -17350,7 +17354,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_HAVE_DATE="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -17394,7 +17398,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_HAVE_WHOAMI="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -17438,7 +17442,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_HAVE_HOSTNAME="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -17480,7 +17484,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_HAVE_UNAME="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -17509,7 +17513,7 @@ LIBS_LIBCEC="$LIBS" LIBS="$libs_client" -CXXFLAGS="$CXXFLAGS -fPIC -Wall -Wextra -Wno-missing-field-initializers" +CXXFLAGS="$CXXFLAGS -fPIC -Wall -Wextra -Wno-missing-field-initializers -Wno-psabi" if test "x$use_debug" = "xyes"; then CXXFLAGS="$CXXFLAGS -g" @@ -18010,16 +18014,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. + # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' + as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -18079,16 +18083,28 @@ as_mkdir_p=false fi - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -18110,7 +18126,7 @@ # values after options handling. ac_log=" This file was extended by libcec $as_me 2:1:0, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -18176,10 +18192,10 @@ ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ libcec config.status 2:1:0 -configured by $0, generated by GNU Autoconf 2.69, +configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -18270,7 +18286,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' diff -Nru libcec-2.1.3/configure.ac libcec-2.1.4/configure.ac --- libcec-2.1.3/configure.ac 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/configure.ac 2013-12-14 00:02:42.000000000 +0000 @@ -342,7 +342,7 @@ LIBS_LIBCEC="$LIBS" LIBS="$libs_client" -CXXFLAGS="$CXXFLAGS -fPIC -Wall -Wextra -Wno-missing-field-initializers" +CXXFLAGS="$CXXFLAGS -fPIC -Wall -Wextra -Wno-missing-field-initializers -Wno-psabi" if test "x$use_debug" = "xyes"; then CXXFLAGS="$CXXFLAGS -g" diff -Nru libcec-2.1.3/debian/changelog libcec-2.1.4/debian/changelog --- libcec-2.1.3/debian/changelog 2013-06-27 11:10:41.000000000 +0000 +++ libcec-2.1.4/debian/changelog 2013-12-14 00:02:57.000000000 +0000 @@ -1,15 +1,65 @@ -libcec (2.1.3-2~saucy) saucy; urgency=low +libcec (2.1.4-4~saucy) saucy; urgency=low - * Non-maintainer upload. - * Build for Saucy + * Build for Ubuntu 'saucy' - -- wsnipex Thu, 27 Jun 2013 13:07:32 +0200 + -- Pulse-Eight Packaging Sat, 14 Dec 2013 01:02:57 +0100 -libcec (2.1.3-2~raring) raring; urgency=low +libcec (2.1.4-1) unstable; urgency=low - * Build for Ubuntu 'raring' + * changed / added: + * set the vendor id of devices handled by libCEC to our vendor id + * added protection against standby without a notification from XBMC and + clock changes. issue #186 + * update system audio mode when audio system devices are activated + * added vendor id and name 'Harman/Kardon' + * added vendor id and name 'Marantz' + * cec-tray: support for away mode + * cec-tray: support for screensaver events + * fixed: + * fixed potential crash when SendCommand returns NULL + * fixed crash when CCECProcessor::Transmit was called after + CCECProcessor::Close + * always call the SourceActivated() callback in + CCECBusDevice::MarkAsActiveSource(), even when we were already active, + and let clients handle dupes. this prevented the screensaver from + being cancelled in XBMC + * send our vendor id when the tv sends it's vendor id + * transmit our physical address when the TV sends it's physical address + * potential deadlock + * leak on exit in CWaitForResponse::Clear() + * also transmit an active source message as response to a set stream path + command when we were already marked as active. bugzid: 3116 + * only send an active source message when receiving a routing change to an + address handled by libCEC. issue #56 + * HandleVendorRemoteButtonUp -> HandleUserControlRelease for all vendors + * silence warning for xx:a0:00:09:b0:00:80:20. bugzid: 2559 + * fixed comboKeyTimeout=0. closes #168 + * Panasonic: doesn't request the active source status when powered up, but + it does send a vendor command. send an active source message when we're + marked as active source after receiving this command. issue #192 + * possible crash when the tv does not respond to polls and the client isn't + registered yet. don't poll the tv in monitoring mode. closes #163 + * Panasonic: standby command + * Panasonic: silence 'unmapped code' warning. bugzid: 2375 + * LG: clean up and attempt to fix issue #176 + * LG: newer firmwares don't send a second power status request after it's + been requested once and replied with 'standby -> on' like previous + versions. send an active source message in an attempt to fix this. issue: + #176 + * Sharp: check whether the 'auto power on' option is disabled and tell the + user how to enable it + * Samsung: respond to vendor command 0x23 sent by samsung. attempt to fix + bugzid: 2164 + * cec-client: try to reconnect when the connection was lost + * cec-tray: crash on load (MissingManifestResourceException) + * cec-tray: crash or deadlock on exit + * cec-tray: crash when the connection to the adapter was lost + * cec-tray: display TV not responding warning on top + * windows: build libCEC and cec-client against toolset v100 (VS2010) + * FreeBSD: proper the adapter detection. credits @fneufneu + * suppress mangling warning. credits @warped-rudi. closes #190 - -- Pulse-Eight Packaging Sun, 12 May 2013 13:12:36 +0000 + -- Pulse-Eight Packaging Sat, 13 Dec 2013 16:02:00 +0100 libcec (2.1.3-1) unstable; urgency=low diff -Nru libcec-2.1.3/depcomp libcec-2.1.4/depcomp --- libcec-2.1.3/depcomp 2013-05-12 13:12:41.000000000 +0000 +++ libcec-2.1.4/depcomp 2013-12-14 00:03:04.000000000 +0000 @@ -1,10 +1,10 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2012-03-27.16; # UTC +scriptversion=2011-12-04.11; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# 2011 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ case $1 in '') - echo "$0: No command. Try '$0 --help' for more information." 1>&2 + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) @@ -40,8 +40,8 @@ Environment variables: depmode Dependency tracking mode. - source Source file read by 'PROGRAMS ARGS'. - object Object file output by 'PROGRAMS ARGS'. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. @@ -57,12 +57,6 @@ ;; esac -# A tabulation character. -tab=' ' -# A newline character. -nl=' -' - if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 @@ -108,12 +102,6 @@ depmode=msvc7 fi -if test "$depmode" = xlc; then - # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations. - gccflag=-qmakedep=gcc,-MF - depmode=gcc -fi - case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what @@ -168,14 +156,15 @@ ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the "deleted header file" problem. +## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. - tr ' ' "$nl" < "$tmpdepfile" | -## Some versions of gcc put a space before the ':'. On the theory + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. @@ -214,15 +203,18 @@ # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like '#:fec' to the end of the + # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. - tr ' ' "$nl" < "$tmpdepfile" \ + tr ' ' ' +' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr "$nl" ' ' >> "$depfile" + tr ' +' ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. - tr ' ' "$nl" < "$tmpdepfile" \ + tr ' ' ' +' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else @@ -234,17 +226,10 @@ rm -f "$tmpdepfile" ;; -xlc) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts '$object:' at the + # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` @@ -274,11 +259,12 @@ test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then - # Each line is of the form 'foo.o: dependent.h'. + # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to - # '$object: dependent.h' and one to simply 'dependent.h:'. + # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile @@ -289,26 +275,23 @@ ;; icc) - # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'. - # However on - # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h - # which is wrong. We want + # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using '\': + # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... - # tcc 0.9.26 (FIXME still under development at the moment of writing) - # will emit a similar output, but also prepend the continuation lines - # with horizontal tabulation characters. + "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : @@ -317,21 +300,15 @@ exit $stat fi rm -f "$depfile" - # Each line is of the form 'foo.o: dependent.h', - # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'. + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to - # '$object: dependent.h' and one to simply 'dependent.h:'. - sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \ - < "$tmpdepfile" > "$depfile" - sed ' - s/[ '"$tab"'][ '"$tab"']*/ /g - s/^ *// - s/ *\\*$// - s/^[^:]*: *// - /^$/d - /:$/d - s/$/ :/ - ' < "$tmpdepfile" >> "$depfile" + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; @@ -367,7 +344,7 @@ done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" - # Add 'dependent.h:' lines. + # Add `dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// @@ -382,9 +359,9 @@ tru64) # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in 'foo.d' instead, so we check for that too. + # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= @@ -430,7 +407,8 @@ done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi @@ -465,11 +443,11 @@ p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g -s/\(.*\)/'"$tab"'\1 \\/p +s/\(.*\)/ \1 \\/p s/.\(.*\) \\/\1:/ H $ { - s/.*/'"$tab"'/ + s/.*/ / G p }' >> "$depfile" @@ -500,7 +478,7 @@ shift fi - # Remove '-o $object'. + # Remove `-o $object'. IFS=" " for arg do @@ -520,14 +498,15 @@ done test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for ':' + # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: - # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | - sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile" + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" - tr ' ' "$nl" < "$tmpdepfile" | \ + tr ' ' ' +' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" @@ -583,7 +562,8 @@ # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" - sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \ + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" @@ -603,7 +583,7 @@ shift fi - # Remove '-o $object'. + # Remove `-o $object'. IFS=" " for arg do @@ -672,8 +652,8 @@ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" - sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" - echo "$tab" >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; diff -Nru libcec-2.1.3/include/cectypes.h libcec-2.1.4/include/cectypes.h --- libcec-2.1.3/include/cectypes.h 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/include/cectypes.h 2013-12-14 00:02:42.000000000 +0000 @@ -825,28 +825,31 @@ typedef enum cec_vendor_id { - CEC_VENDOR_TOSHIBA = 0x000039, - CEC_VENDOR_SAMSUNG = 0x0000F0, - CEC_VENDOR_DENON = 0x0005CD, - CEC_VENDOR_LOEWE = 0x000982, - CEC_VENDOR_ONKYO = 0x0009B0, - CEC_VENDOR_MEDION = 0x000CB8, - CEC_VENDOR_TOSHIBA2 = 0x000CE7, - CEC_VENDOR_AKAI = 0x0020C7, - CEC_VENDOR_AOC = 0x002467, - CEC_VENDOR_PANASONIC = 0x008045, - CEC_VENDOR_PHILIPS = 0x00903E, - CEC_VENDOR_DAEWOO = 0x009053, - CEC_VENDOR_YAMAHA = 0x00A0DE, - CEC_VENDOR_GRUNDIG = 0x00D0D5, - CEC_VENDOR_PIONEER = 0x00E036, - CEC_VENDOR_LG = 0x00E091, - CEC_VENDOR_SHARP = 0x08001F, - CEC_VENDOR_SONY = 0x080046, - CEC_VENDOR_BROADCOM = 0x18C086, - CEC_VENDOR_VIZIO = 0x6B746D, - CEC_VENDOR_BENQ = 0x8065E9, - CEC_VENDOR_UNKNOWN = 0 + CEC_VENDOR_TOSHIBA = 0x000039, + CEC_VENDOR_SAMSUNG = 0x0000F0, + CEC_VENDOR_DENON = 0x0005CD, + CEC_VENDOR_MARANTZ = 0x000678, + CEC_VENDOR_LOEWE = 0x000982, + CEC_VENDOR_ONKYO = 0x0009B0, + CEC_VENDOR_MEDION = 0x000CB8, + CEC_VENDOR_TOSHIBA2 = 0x000CE7, + CEC_VENDOR_PULSE_EIGHT = 0x001582, + CEC_VENDOR_AKAI = 0x0020C7, + CEC_VENDOR_AOC = 0x002467, + CEC_VENDOR_PANASONIC = 0x008045, + CEC_VENDOR_PHILIPS = 0x00903E, + CEC_VENDOR_DAEWOO = 0x009053, + CEC_VENDOR_YAMAHA = 0x00A0DE, + CEC_VENDOR_GRUNDIG = 0x00D0D5, + CEC_VENDOR_PIONEER = 0x00E036, + CEC_VENDOR_LG = 0x00E091, + CEC_VENDOR_SHARP = 0x08001F, + CEC_VENDOR_SONY = 0x080046, + CEC_VENDOR_BROADCOM = 0x18C086, + CEC_VENDOR_VIZIO = 0x6B746D, + CEC_VENDOR_BENQ = 0x8065E9, + CEC_VENDOR_HARMAN_KARDON = 0x9C645E, + CEC_VENDOR_UNKNOWN = 0 } cec_vendor_id; typedef enum cec_adapter_type @@ -1420,7 +1423,8 @@ CEC_CLIENT_VERSION_2_1_1 = 0x2101, CEC_CLIENT_VERSION_2_1_2 = 0x2102, CEC_CLIENT_VERSION_2_1_3 = 0x2103, - CEC_CLIENT_VERSION_CURRENT = 0x2103 + CEC_CLIENT_VERSION_2_1_4 = 0x2104, + CEC_CLIENT_VERSION_CURRENT = 0x2104 } cec_client_version; typedef enum cec_server_version @@ -1452,7 +1456,8 @@ CEC_SERVER_VERSION_2_1_1 = 0x2101, CEC_SERVER_VERSION_2_1_2 = 0x2102, CEC_SERVER_VERSION_2_1_3 = 0x2103, - CEC_SERVER_VERSION_CURRENT = 0x2103 + CEC_SERVER_VERSION_2_1_4 = 0x2104, + CEC_SERVER_VERSION_CURRENT = 0x2104 } cec_server_version; struct libcec_configuration diff -Nru libcec-2.1.3/ltmain.sh libcec-2.1.4/ltmain.sh --- libcec-2.1.3/ltmain.sh 2013-05-12 13:12:39.000000000 +0000 +++ libcec-2.1.4/ltmain.sh 2013-12-14 00:03:01.000000000 +0000 @@ -70,7 +70,7 @@ # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.2ubuntu1 +# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1 # automake: $automake_version # autoconf: $autoconf_version # @@ -80,7 +80,7 @@ PROGRAM=libtool PACKAGE=libtool -VERSION="2.4.2 Debian-2.4.2-1.2ubuntu1" +VERSION="2.4.2 Debian-2.4.2-1ubuntu1" TIMESTAMP="" package_revision=1.3337 diff -Nru libcec-2.1.3/src/CecSharpTester/Properties/AssemblyInfo.cs libcec-2.1.4/src/CecSharpTester/Properties/AssemblyInfo.cs --- libcec-2.1.3/src/CecSharpTester/Properties/AssemblyInfo.cs 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/CecSharpTester/Properties/AssemblyInfo.cs 2013-12-14 00:02:42.000000000 +0000 @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.1.3.0")] -[assembly: AssemblyFileVersion("2.1.3.0")] +[assembly: AssemblyVersion("2.1.4.0")] +[assembly: AssemblyFileVersion("2.1.4.0")] diff -Nru libcec-2.1.3/src/LibCecSharp/AssemblyInfo.cpp libcec-2.1.4/src/LibCecSharp/AssemblyInfo.cpp --- libcec-2.1.3/src/LibCecSharp/AssemblyInfo.cpp 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/LibCecSharp/AssemblyInfo.cpp 2013-12-14 00:02:42.000000000 +0000 @@ -13,7 +13,7 @@ [assembly:AssemblyTrademarkAttribute("")]; [assembly:AssemblyCultureAttribute("")]; -[assembly:AssemblyVersionAttribute("2.1.3.0")]; +[assembly:AssemblyVersionAttribute("2.1.4.0")]; [assembly:ComVisible(false)]; [assembly:CLSCompliantAttribute(true)]; diff -Nru libcec-2.1.3/src/LibCecSharp/CecSharpTypes.h libcec-2.1.4/src/LibCecSharp/CecSharpTypes.h --- libcec-2.1.3/src/LibCecSharp/CecSharpTypes.h 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/LibCecSharp/CecSharpTypes.h 2013-12-14 00:02:42.000000000 +0000 @@ -784,27 +784,31 @@ /// public enum class CecVendorId { - Toshiba = 0x000039, - Samsung = 0x0000F0, - Denon = 0x0005CD, - Loewe = 0x000982, - Onkyo = 0x0009B0, - Medion = 0x000CB8, - Akai = 0x0020C7, - AOC = 0x002467, - Panasonic = 0x008045, - Philips = 0x00903E, - Daewoo = 0x009053, - Yamaha = 0x00A0DE, - Grundig = 0x00D0D5, - Pioneer = 0x00E036, - LG = 0x00E091, - Sharp = 0x08001F, - Sony = 0x080046, - Broadcom = 0x18C086, - Vizio = 0x6B746D, - Benq = 0x8065E9, - Unknown = 0 + Toshiba = 0x000039, + Samsung = 0x0000F0, + Denon = 0x0005CD, + Marantz = 0x000678, + Loewe = 0x000982, + Onkyo = 0x0009B0, + Medion = 0x000CB8, + Toshiba2 = 0x000CE7, + PulseEight = 0x001582, + Akai = 0x0020C7, + AOC = 0x002467, + Panasonic = 0x008045, + Philips = 0x00903E, + Daewoo = 0x009053, + Yamaha = 0x00A0DE, + Grundig = 0x00D0D5, + Pioneer = 0x00E036, + LG = 0x00E091, + Sharp = 0x08001F, + Sony = 0x080046, + Broadcom = 0x18C086, + Vizio = 0x6B746D, + Benq = 0x8065E9, + HarmanKardon = 0x9C645E, + Unknown = 0 }; /// @@ -1225,9 +1229,13 @@ /// Version2_1_3 = 0x2103, /// + /// v2.1.4 + /// + Version2_1_4 = 0x2104, + /// /// The current version /// - CurrentVersion = 0x2103 + CurrentVersion = 0x2104 }; /// @@ -1343,10 +1351,14 @@ /// v2.1.3 /// Version2_1_3 = 0x2103, + /// + /// v2.1.4 + /// + Version2_1_4 = 0x2104, /// /// The current version /// - CurrentVersion = 0x2103 + CurrentVersion = 0x2104 }; /// @@ -2401,7 +2413,7 @@ CecParameterType newType = (CecParameterType)data.paramType; if (newType == CecParameterType::ParameterTypeString) { - System::String ^ newData = gcnew System::String((const char *)data.paramData, 0, 128); + System::String ^ newData = gcnew System::String(data.paramData ? (const char *)data.paramData : "", 0, 128); CecParameter ^ newParam = gcnew CecParameter(newType, newData); iReturn = m_callbacks->ReceiveAlert((CecAlert)alert, newParam); } diff -Nru libcec-2.1.3/src/LibCecTray/LibCECTray.csproj libcec-2.1.4/src/LibCecTray/LibCECTray.csproj --- libcec-2.1.3/src/LibCecTray/LibCECTray.csproj 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/LibCecTray/LibCECTray.csproj 2013-12-14 00:02:42.000000000 +0000 @@ -78,6 +78,7 @@ + diff -Nru libcec-2.1.3/src/LibCecTray/Properties/AssemblyInfo.cs libcec-2.1.4/src/LibCecTray/Properties/AssemblyInfo.cs --- libcec-2.1.3/src/LibCecTray/Properties/AssemblyInfo.cs 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/LibCecTray/Properties/AssemblyInfo.cs 2013-12-14 00:02:42.000000000 +0000 @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.1.3.0")] -[assembly: AssemblyFileVersion("2.1.3.0")] +[assembly: AssemblyVersion("2.1.4.0")] +[assembly: AssemblyFileVersion("2.1.4.0")] diff -Nru libcec-2.1.3/src/LibCecTray/controller/Actions.cs libcec-2.1.4/src/LibCecTray/controller/Actions.cs --- libcec-2.1.3/src/LibCecTray/controller/Actions.cs 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/LibCecTray/controller/Actions.cs 2013-12-14 00:02:42.000000000 +0000 @@ -94,7 +94,7 @@ _controller.CheckActiveDevices(); break; case UpdateEventType.ProcessCompleted: - if (!(_activeProcess is GetCurrentPhysicalAddress)) + if (!(_activeProcess is GetCurrentPhysicalAddress) && !SuppressUpdates) { _activeProcess = new GetCurrentPhysicalAddress(_controller.Lib); _activeProcess.EventHandler += ProcessEventHandler; @@ -123,6 +123,7 @@ break; case UpdateEventType.ExitApplication: + SuppressUpdates = true; _activeProcess = null; Application.Exit(); break; @@ -207,7 +208,7 @@ /// Activate the source at the given logical address. /// /// The logical address of the device to activate - public void ActivateSource(CecLogicalAddress address) + public void SetStreamPath(CecLogicalAddress address) { if (SuppressUpdates || _activeProcess != null) return; @@ -217,6 +218,16 @@ (new Thread(_activeProcess.Run)).Start(); } + public void ActivateSource() + { + if (SuppressUpdates || _activeProcess != null) return; + + _controller.SetControlsEnabled(false); + _activeProcess = new ActivateSource(_controller.Lib); + _activeProcess.EventHandler += ProcessEventHandler; + (new Thread(_activeProcess.Run)).Start(); + } + /// /// Send a standby command to the device at the given logical address /// diff -Nru libcec-2.1.3/src/LibCecTray/controller/actions/ActivateSource.cs libcec-2.1.4/src/LibCecTray/controller/actions/ActivateSource.cs --- libcec-2.1.3/src/LibCecTray/controller/actions/ActivateSource.cs 1970-01-01 00:00:00.000000000 +0000 +++ libcec-2.1.4/src/LibCecTray/controller/actions/ActivateSource.cs 2013-12-14 00:02:42.000000000 +0000 @@ -0,0 +1,56 @@ +/* + * This file is part of the libCEC(R) library. + * + * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved. + * libCEC(R) is an original work, containing original code. + * + * libCEC(R) is a trademark of Pulse-Eight Limited. + * + * This program is dual-licensed; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * + * Alternatively, you can license this library under a commercial license, + * please contact Pulse-Eight Licensing for more information. + * + * For more information contact: + * Pulse-Eight Licensing + * http://www.pulse-eight.com/ + * http://www.pulse-eight.net/ + */ + +using CecSharp; +using LibCECTray.Properties; + +namespace LibCECTray.controller.actions +{ + class ActivateSource : UpdateProcess + { + public ActivateSource(LibCecSharp lib) + { + _lib = lib; + } + + public override void Process() + { + SendEvent(UpdateEventType.StatusText, Resources.action_activating_source); + SendEvent(UpdateEventType.ProgressBar, 50); + + var bResult = _lib.SetActiveSource(CecDeviceType.Reserved); + SendEvent(UpdateEventType.ProgressBar, 100); + } + + private readonly LibCecSharp _lib; + } +} diff -Nru libcec-2.1.3/src/LibCecTray/controller/actions/ConnectToDevice.cs libcec-2.1.4/src/LibCecTray/controller/actions/ConnectToDevice.cs --- libcec-2.1.3/src/LibCecTray/controller/actions/ConnectToDevice.cs 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/LibCecTray/controller/actions/ConnectToDevice.cs 2013-12-14 00:02:42.000000000 +0000 @@ -74,9 +74,12 @@ SendEvent(UpdateEventType.StatusText, Resources.action_sending_power_on); _lib.PowerOnDevices(CecLogicalAddress.Broadcast); - SendEvent(UpdateEventType.StatusText, Resources.action_detecting_tv_vendor); - SendEvent(UpdateEventType.ProgressBar, 30); - SendEvent(UpdateEventType.TVVendorId, (int)_lib.GetDeviceVendorId(CecLogicalAddress.Tv)); + if (_lib.IsActiveDevice(CecLogicalAddress.Tv)) + { + SendEvent(UpdateEventType.StatusText, Resources.action_detecting_tv_vendor); + SendEvent(UpdateEventType.ProgressBar, 30); + SendEvent(UpdateEventType.TVVendorId, (int)_lib.GetDeviceVendorId(CecLogicalAddress.Tv)); + } SendEvent(UpdateEventType.ProgressBar, 50); SendEvent(UpdateEventType.StatusText, Resources.action_detecting_avr); @@ -91,7 +94,7 @@ SendEvent(UpdateEventType.AVRVendorId, (int)_lib.GetDeviceVendorId(CecLogicalAddress.AudioSystem)); } - if (!_lib.GetDevicePowerStatus(CecLogicalAddress.Tv).Equals(CecPowerStatus.On)) + if (_lib.IsActiveDevice(CecLogicalAddress.Tv)&& !_lib.GetDevicePowerStatus(CecLogicalAddress.Tv).Equals(CecPowerStatus.On)) { SendEvent(UpdateEventType.ProgressBar, 70); SendEvent(UpdateEventType.StatusText, Resources.action_activating_source); @@ -110,7 +113,7 @@ if (!_lib.IsActiveDevice(CecLogicalAddress.Tv)) { - MessageBox.Show(Resources.alert_tv_poll_failed, Resources.cec_alert, MessageBoxButtons.OK, MessageBoxIcon.Warning); + MessageBox.Show(Resources.alert_tv_poll_failed, Resources.cec_alert, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); } SendEvent(UpdateEventType.ProgressBar, 100); diff -Nru libcec-2.1.3/src/LibCecTray/ui/CECTray.cs libcec-2.1.4/src/LibCecTray/ui/CECTray.cs --- libcec-2.1.3/src/LibCecTray/ui/CECTray.cs 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/LibCecTray/ui/CECTray.cs 2013-12-14 00:02:42.000000000 +0000 @@ -40,23 +40,12 @@ using LibCECTray.settings; using Microsoft.Win32; using System.Security.Permissions; +using System.Runtime.InteropServices; +using System.Threading; namespace LibCECTray.ui { /// - /// The tab pages in this application - /// - internal enum ConfigTab - { - Configuration, - KeyConfiguration, - Tester, - Log, - WMC, - XBMC - } - - /// /// Main LibCecTray GUI /// partial class CECTray : AsyncForm @@ -65,6 +54,13 @@ { Text = Resources.app_name; InitializeComponent(); + + _sstimer.Interval = 5000; + _sstimer.Tick += ScreensaverActiveCheck; + _sstimer.Enabled = false; + + _lastScreensaverActivated = DateTime.Now; + VisibleChanged += delegate { if (!Visible) @@ -72,28 +68,133 @@ else OnShow(); }; - SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(OnPowerModeChanged); + SystemEvents.SessionEnding += new SessionEndingEventHandler(OnSessionEnding); } public void OnSessionEnding(object sender, SessionEndingEventArgs e) { + Controller.CECActions.SuppressUpdates = true; Controller.Close(); } - public void OnPowerModeChanged(Object sender, PowerModeChangedEventArgs e) + #region Power state change window messages + private const int WM_POWERBROADCAST = 0x0218; + private const int WM_SYSCOMMAND = 0x0112; + + private const int PBT_APMSUSPEND = 0x0004; + private const int PBT_APMRESUMESUSPEND = 0x0007; + private const int PBT_APMRESUMECRITICAL = 0x0006; + private const int PBT_APMRESUMEAUTOMATIC = 0x0012; + private const int PBT_POWERSETTINGCHANGE = 0x8013; + + private static Guid GUID_SYSTEM_AWAYMODE = new Guid("98a7f580-01f7-48aa-9c0f-44352c29e5c0"); + + private const int SC_SCREENSAVE = 0xF140; + private const int SPI_GETSCREENSAVERRUNNING = 0x0072; + + [DllImport("user32.dll", SetLastError = true)] + static extern bool SystemParametersInfo(int action, int param, ref int retval, int updini); + + [StructLayout(LayoutKind.Sequential, Pack = 4)] + internal struct POWERBROADCAST_SETTING + { + public Guid PowerSetting; + public uint DataLength; + public byte Data; + } + #endregion + + /// + /// Check for power state changes, and pass up when it's something we don't care about + /// + /// The incoming window message + protected override void WndProc(ref Message msg) { - switch (e.Mode) + if (msg.Msg == WM_SYSCOMMAND && (msg.WParam.ToInt32() & 0xfff0) == SC_SCREENSAVE) { - case PowerModes.Resume: - Controller.Initialise(); - break; - case PowerModes.Suspend: - Controller.Close(); - break; - case PowerModes.StatusChange: - break; + // there's no event for screensaver exit + if (!_sstimer.Enabled) + { + // guard against screensaver failing, and resulting in power up and down spam to the tv + TimeSpan diff = DateTime.Now - _lastScreensaverActivated; + if (diff.TotalSeconds > 60) + { + _sstimer.Enabled = true; + _lastScreensaverActivated = DateTime.Now; + Controller.CECActions.SendStandby(CecLogicalAddress.Broadcast); + } + } } + else if (msg.Msg == WM_POWERBROADCAST) + { + switch (msg.WParam.ToInt32()) + { + case PBT_APMSUSPEND: + OnSleep(); + return; + + case PBT_APMRESUMESUSPEND: + case PBT_APMRESUMECRITICAL: + case PBT_APMRESUMEAUTOMATIC: + OnWake(); + return; + + case PBT_POWERSETTINGCHANGE: + { + POWERBROADCAST_SETTING pwr = (POWERBROADCAST_SETTING)Marshal.PtrToStructure(msg.LParam, typeof(POWERBROADCAST_SETTING)); + if (pwr.PowerSetting == GUID_SYSTEM_AWAYMODE && pwr.DataLength == Marshal.SizeOf(typeof(Int32))) + { + switch (pwr.Data) + { + case 0: + // do _not_ wake the pc when away mode is deactivated + //OnWake(); + //return; + case 1: + Controller.CECActions.SendStandby(CecLogicalAddress.Broadcast); + return; + default: + break; + } + } + } + break; + default: + break; + } + } + + // pass up when not handled + base.WndProc(ref msg); + } + + private void ScreensaverActiveCheck(object sender, EventArgs e) + { + if (!IsScreensaverActive()) + { + _sstimer.Enabled = false; + Controller.CECActions.ActivateSource(); + } + } + + private bool IsScreensaverActive() + { + int active = 1; + SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, ref active, 0); + return active == 1; + } + + private void OnWake() + { + Controller.Initialise(); + } + + private void OnSleep() + { + Controller.CECActions.SuppressUpdates = true; + AsyncDisconnect dc = new AsyncDisconnect(Controller); + (new Thread(dc.Process)).Start(); } public override sealed string Text @@ -112,7 +213,7 @@ Hide(); if (disposing) { - Controller.Close(); + OnSleep(); } if (disposing && (components != null)) { @@ -208,7 +309,7 @@ private void BActivateSourceClick(object sender, EventArgs e) { - Controller.CECActions.ActivateSource(GetTargetDevice()); + Controller.CECActions.SetStreamPath(GetTargetDevice()); } private void CbCommandDestinationSelectedIndexChanged(object sender, EventArgs e) @@ -521,6 +622,9 @@ { get { return GetSelectedTabName(tabPanel, tabPanel.TabPages); } } + + private System.Windows.Forms.Timer _sstimer = new System.Windows.Forms.Timer(); + private DateTime _lastScreensaverActivated; #endregion private void AddNewApplicationToolStripMenuItemClick(object sender, EventArgs e) @@ -529,4 +633,32 @@ Controller.DisplayDialog(appConfig, false); } } + + /// + /// The tab pages in this application + /// + internal enum ConfigTab + { + Configuration, + KeyConfiguration, + Tester, + Log, + WMC, + XBMC + } + + class AsyncDisconnect + { + public AsyncDisconnect(CECController controller) + { + _controller = controller; + } + + public void Process() + { + _controller.Close(); + } + + private CECController _controller; + } } diff -Nru libcec-2.1.3/src/LibCecTray/ui/DeviceInformation.cs libcec-2.1.4/src/LibCecTray/ui/DeviceInformation.cs --- libcec-2.1.3/src/LibCecTray/ui/DeviceInformation.cs 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/LibCecTray/ui/DeviceInformation.cs 2013-12-14 00:02:42.000000000 +0000 @@ -72,7 +72,7 @@ { SetControlVisible(lInactiveSource, false); SetControlVisible(lActiveSource, true); - _controller.CECActions.ActivateSource(Address); + _controller.CECActions.SetStreamPath(Address); } private void LStandbyLinkClicked(object sender, LinkLabelLinkClickedEventArgs e) diff -Nru libcec-2.1.3/src/lib/CECClient.cpp libcec-2.1.4/src/lib/CECClient.cpp --- libcec-2.1.3/src/lib/CECClient.cpp 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/lib/CECClient.cpp 2013-12-14 00:02:42.000000000 +0000 @@ -973,10 +973,10 @@ { key.duration = (unsigned int) (GetTimeMs() - m_buttontime); - cec_user_control_code comboKey(m_configuration.comboKey); - uint32_t iTimeoutMs(m_configuration.iComboKeyTimeoutMs); - - if (key.duration > iTimeoutMs || m_iCurrentButton != comboKey || bSendComboKey) + if (key.duration > m_configuration.iComboKeyTimeoutMs || + m_configuration.iComboKeyTimeoutMs == 0 || + m_iCurrentButton != m_configuration.comboKey || + bSendComboKey) { key.keycode = m_iCurrentButton; @@ -1009,7 +1009,7 @@ { CLockObject lock(m_mutex); - if (m_iCurrentButton == comboKey && key.duration == 0) + if (m_configuration.iComboKeyTimeoutMs > 0 && m_iCurrentButton == comboKey && key.duration == 0) { // stop + ok -> exit if (key.keycode == CEC_USER_CONTROL_CODE_SELECT) @@ -1070,7 +1070,7 @@ m_configuration.iComboKeyTimeoutMs : CEC_DEFAULT_COMBO_TIMEOUT_MS); if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN && - ((m_iCurrentButton == comboKey && iNow - m_buttontime > iTimeoutMs) || + ((m_iCurrentButton == comboKey && iTimeoutMs > 0 && iNow - m_buttontime > iTimeoutMs) || (m_iCurrentButton != comboKey && iNow - m_buttontime > CEC_BUTTON_TIMEOUT))) { key.duration = (unsigned int) (iNow - m_buttontime); diff -Nru libcec-2.1.3/src/lib/CECProcessor.cpp libcec-2.1.4/src/lib/CECProcessor.cpp --- libcec-2.1.3/src/lib/CECProcessor.cpp 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/lib/CECProcessor.cpp 2013-12-14 00:02:42.000000000 +0000 @@ -57,6 +57,34 @@ #define ToString(x) CCECTypeUtils::ToString(x) +CCECStandbyProtection::CCECStandbyProtection(CCECProcessor* processor) : + m_processor(processor) {} +CCECStandbyProtection::~CCECStandbyProtection(void) {} + +void* CCECStandbyProtection::Process(void) +{ + int64_t last = GetTimeMs(); + int64_t next; + while (!IsStopped()) + { + PLATFORM::CEvent::Sleep(1000); + + next = GetTimeMs(); + + // reset the connection if the clock changed + if (next < last || next - last > 10000) + { + libcec_parameter param; + param.paramData = NULL; param.paramType = CEC_PARAMETER_TYPE_UNKOWN; + m_processor->GetLib()->Alert(CEC_ALERT_CONNECTION_LOST, param); + break; + } + + last = next; + } + return NULL; +} + CCECProcessor::CCECProcessor(CLibCEC *libcec) : m_bInitialised(false), m_communication(NULL), @@ -66,7 +94,8 @@ m_iLastTransmission(0), m_bMonitor(true), m_addrAllocator(NULL), - m_bStallCommunication(false) + m_bStallCommunication(false), + m_connCheck(NULL) { m_busDevices = new CCECDeviceMap(this); } @@ -105,11 +134,13 @@ SetCECInitialised(false); // stop the processor + DELETE_AND_NULL(m_connCheck); StopThread(-1); m_inBuffer.Broadcast(); StopThread(); // close the connection + CLockObject lock(m_mutex); DELETE_AND_NULL(m_communication); } @@ -215,6 +246,10 @@ { m_libcec->AddLog(CEC_LOG_DEBUG, "processor thread started"); + if (!m_connCheck) + m_connCheck = new CCECStandbyProtection(this); + m_connCheck->CreateThread(); + cec_command command; command.Clear(); CTimeout activeSourceCheck(ACTIVE_SOURCE_CHECK_INTERVAL); CTimeout tvPresentCheck(TV_PRESENT_CHECK_INTERVAL); @@ -245,12 +280,17 @@ // check whether the TV is present and responding if (tvPresentCheck.TimeLeft() == 0) { - if (!m_busDevices->At(CECDEVICE_TV)->IsPresent()) + CCECClient *primary = GetPrimaryClient(); + // only check whether the tv responds to polls when a client is connected and not in monitoring mode + if (primary && primary->GetConfiguration()->bMonitorOnly != 1) { - libcec_parameter param; - param.paramType = CEC_PARAMETER_TYPE_STRING; - param.paramData = (void*)"TV does not respond to CEC polls"; - GetPrimaryClient()->Alert(CEC_ALERT_TV_POLL_FAILED, param); + if (!m_busDevices->At(CECDEVICE_TV)->IsPresent()) + { + libcec_parameter param; + param.paramType = CEC_PARAMETER_TYPE_STRING; + param.paramData = (void*)"TV does not respond to CEC polls"; + primary->Alert(CEC_ALERT_TV_POLL_FAILED, param); + } } tvPresentCheck.Init(TV_PRESENT_CHECK_INTERVAL); } @@ -400,6 +440,10 @@ // reset the state of this message to 'unknown' cec_adapter_message_state adapterState = ADAPTER_MESSAGE_STATE_UNKNOWN; + CLockObject lock(m_mutex); + if (!m_communication) + return false; + if (!m_communication->SupportsSourceLogicalAddress(transmitData.initiator)) { if (transmitData.initiator == CECDEVICE_UNREGISTERED && m_communication->SupportsSourceLogicalAddress(CECDEVICE_FREEUSE)) @@ -438,15 +482,14 @@ } // wait until we finished allocating a new LA if it got lost + lock.Unlock(); while (m_bStallCommunication) Sleep(5); + lock.Lock(); - { - CLockObject lock(m_mutex); - m_iLastTransmission = GetTimeMs(); - // set the number of tries - iMaxTries = initiator->GetHandler()->GetTransmitRetries() + 1; - initiator->MarkHandlerReady(); - } + m_iLastTransmission = GetTimeMs(); + // set the number of tries + iMaxTries = initiator->GetHandler()->GetTransmitRetries() + 1; + initiator->MarkHandlerReady(); // and try to send the command while (bRetry && ++iTries < iMaxTries) @@ -854,7 +897,7 @@ client->GetPrimaryDevice()->TransmitOSDName(CECDEVICE_TV, false); // request the power status of the TV - tv->RequestPowerStatus(sourceAddress, true); + tv->RequestPowerStatus(sourceAddress, true, true); return bReturn; } diff -Nru libcec-2.1.3/src/lib/CECProcessor.h libcec-2.1.4/src/lib/CECProcessor.h --- libcec-2.1.3/src/lib/CECProcessor.h 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/lib/CECProcessor.h 2013-12-14 00:02:42.000000000 +0000 @@ -52,6 +52,7 @@ class CCECTV; class CCECClient; class CCECProcessor; + class CCECStandbyProtection; class CCECAllocateLogicalAddress : public PLATFORM::CThread { @@ -177,5 +178,17 @@ bool m_bMonitor; CCECAllocateLogicalAddress* m_addrAllocator; bool m_bStallCommunication; + CCECStandbyProtection* m_connCheck; + }; + + class CCECStandbyProtection : public PLATFORM::CThread + { + public: + CCECStandbyProtection(CCECProcessor* processor); + virtual ~CCECStandbyProtection(void); + void* Process(void); + + private: + CCECProcessor* m_processor; }; }; diff -Nru libcec-2.1.3/src/lib/CECTypeUtils.h libcec-2.1.4/src/lib/CECTypeUtils.h --- libcec-2.1.3/src/lib/CECTypeUtils.h 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/lib/CECTypeUtils.h 2013-12-14 00:02:42.000000000 +0000 @@ -517,6 +517,12 @@ return "Loewe"; case CEC_VENDOR_DENON: return "Denon"; + case CEC_VENDOR_MARANTZ: + return "Marantz"; + case CEC_VENDOR_HARMAN_KARDON: + return "Harman/Kardon"; + case CEC_VENDOR_PULSE_EIGHT: + return "Pulse Eight"; default: return "Unknown"; } @@ -580,6 +586,8 @@ return "2.1.2"; case CEC_CLIENT_VERSION_2_1_3: return "2.1.3"; + case CEC_CLIENT_VERSION_2_1_4: + return "2.1.4"; default: return "Unknown"; } @@ -643,6 +651,8 @@ return "2.1.2"; case CEC_SERVER_VERSION_2_1_3: return "2.1.3"; + case CEC_SERVER_VERSION_2_1_4: + return "2.1.4"; default: return "Unknown"; } diff -Nru libcec-2.1.3/src/lib/Makefile.am libcec-2.1.4/src/lib/Makefile.am --- libcec-2.1.3/src/lib/Makefile.am 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/lib/Makefile.am 2013-12-14 00:02:42.000000000 +0000 @@ -26,7 +26,9 @@ implementations/SLCommandHandler.cpp \ implementations/VLCommandHandler.cpp \ implementations/RLCommandHandler.cpp \ - implementations/PHCommandHandler.cpp + implementations/PHCommandHandler.cpp \ + implementations/RHCommandHandler.cpp \ + implementations/AQCommandHandler.cpp ## server sockets, currently unused ##libcec_la_SOURCES += platform/posix/serversocket.cpp diff -Nru libcec-2.1.3/src/lib/Makefile.in libcec-2.1.4/src/lib/Makefile.in --- libcec-2.1.3/src/lib/Makefile.in 2013-05-12 13:12:41.000000000 +0000 +++ libcec-2.1.4/src/lib/Makefile.in 2013-12-14 00:03:04.000000000 +0000 @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -18,23 +18,6 @@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ - esac; \ - test $$am__dry = yes; \ - } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -123,6 +106,8 @@ implementations/VLCommandHandler.cpp \ implementations/RLCommandHandler.cpp \ implementations/PHCommandHandler.cpp \ + implementations/RHCommandHandler.cpp \ + implementations/AQCommandHandler.cpp \ adapter/Pulse-Eight/USBCECAdapterMessage.cpp \ adapter/Pulse-Eight/USBCECAdapterCommands.cpp \ adapter/Pulse-Eight/USBCECAdapterCommunication.cpp \ @@ -151,8 +136,9 @@ CECBusDevice.lo CECDeviceMap.lo CECPlaybackDevice.lo \ CECRecordingDevice.lo CECTuner.lo CECTV.lo ANCommandHandler.lo \ CECCommandHandler.lo SLCommandHandler.lo VLCommandHandler.lo \ - RLCommandHandler.lo PHCommandHandler.lo $(am__objects_1) \ - $(am__objects_2) $(am__objects_3) + RLCommandHandler.lo PHCommandHandler.lo RHCommandHandler.lo \ + AQCommandHandler.lo $(am__objects_1) $(am__objects_2) \ + $(am__objects_3) libcec_la_OBJECTS = $(am_libcec_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -188,11 +174,6 @@ am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libcec_la_SOURCES) DIST_SOURCES = $(am__libcec_la_SOURCES_DIST) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac DATA = $(pkgconfig_DATA) HEADERS = $(library_include_HEADERS) ETAGS = etags @@ -353,7 +334,9 @@ implementations/SLCommandHandler.cpp \ implementations/VLCommandHandler.cpp \ implementations/RLCommandHandler.cpp \ - implementations/PHCommandHandler.cpp $(am__append_1) \ + implementations/PHCommandHandler.cpp \ + implementations/RHCommandHandler.cpp \ + implementations/AQCommandHandler.cpp $(am__append_1) \ $(am__append_2) $(am__append_3) libcec_la_LDFLAGS = @LIBS_LIBCEC@ -version-info @VERSION@ all: all-am @@ -394,6 +377,7 @@ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ @@ -401,8 +385,6 @@ else :; fi; \ done; \ test -z "$$list2" || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } @@ -434,6 +416,7 @@ -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ANCommandHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AQCommandHandler.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AdapterFactory.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CECAudioSystem.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CECBusDevice.Plo@am__quote@ @@ -448,6 +431,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LibCEC.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LibCECC.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PHCommandHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RHCommandHandler.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RLCommandHandler.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RPiCECAdapterCommunication.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RPiCECAdapterDetection.Plo@am__quote@ @@ -585,6 +569,20 @@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o PHCommandHandler.lo `test -f 'implementations/PHCommandHandler.cpp' || echo '$(srcdir)/'`implementations/PHCommandHandler.cpp +RHCommandHandler.lo: implementations/RHCommandHandler.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT RHCommandHandler.lo -MD -MP -MF $(DEPDIR)/RHCommandHandler.Tpo -c -o RHCommandHandler.lo `test -f 'implementations/RHCommandHandler.cpp' || echo '$(srcdir)/'`implementations/RHCommandHandler.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/RHCommandHandler.Tpo $(DEPDIR)/RHCommandHandler.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='implementations/RHCommandHandler.cpp' object='RHCommandHandler.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o RHCommandHandler.lo `test -f 'implementations/RHCommandHandler.cpp' || echo '$(srcdir)/'`implementations/RHCommandHandler.cpp + +AQCommandHandler.lo: implementations/AQCommandHandler.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT AQCommandHandler.lo -MD -MP -MF $(DEPDIR)/AQCommandHandler.Tpo -c -o AQCommandHandler.lo `test -f 'implementations/AQCommandHandler.cpp' || echo '$(srcdir)/'`implementations/AQCommandHandler.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/AQCommandHandler.Tpo $(DEPDIR)/AQCommandHandler.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='implementations/AQCommandHandler.cpp' object='AQCommandHandler.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o AQCommandHandler.lo `test -f 'implementations/AQCommandHandler.cpp' || echo '$(srcdir)/'`implementations/AQCommandHandler.cpp + USBCECAdapterMessage.lo: adapter/Pulse-Eight/USBCECAdapterMessage.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT USBCECAdapterMessage.lo -MD -MP -MF $(DEPDIR)/USBCECAdapterMessage.Tpo -c -o USBCECAdapterMessage.lo `test -f 'adapter/Pulse-Eight/USBCECAdapterMessage.cpp' || echo '$(srcdir)/'`adapter/Pulse-Eight/USBCECAdapterMessage.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/USBCECAdapterMessage.Tpo $(DEPDIR)/USBCECAdapterMessage.Plo @@ -690,11 +688,8 @@ -rm -rf .libs _libs install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) + test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ - fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -711,11 +706,8 @@ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) install-library_includeHEADERS: $(library_include_HEADERS) @$(NORMAL_INSTALL) + test -z "$(library_includedir)" || $(MKDIR_P) "$(DESTDIR)$(library_includedir)" @list='$(library_include_HEADERS)'; test -n "$(library_includedir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(library_includedir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(library_includedir)" || exit 1; \ - fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ diff -Nru libcec-2.1.3/src/lib/adapter/Pulse-Eight/USBCECAdapterCommands.cpp libcec-2.1.4/src/lib/adapter/Pulse-Eight/USBCECAdapterCommands.cpp --- libcec-2.1.3/src/lib/adapter/Pulse-Eight/USBCECAdapterCommands.cpp 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/lib/adapter/Pulse-Eight/USBCECAdapterCommands.cpp 2013-12-14 00:02:42.000000000 +0000 @@ -38,6 +38,7 @@ #include "lib/LibCEC.h" #include "lib/CECProcessor.h" #include "lib/CECTypeUtils.h" +#include "lib/platform/util/util.h" #include using namespace CEC; @@ -67,14 +68,14 @@ CCECAdapterMessage params; CCECAdapterMessage *message = m_comm->SendCommand(msgCode, params); - if (message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED) + if (message && message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED) { retVal = message->response; retVal.Shift(2); // shift out start and msgcode retVal.size -= 1; // remove end } - delete message; + DELETE_AND_NULL(message); return retVal; } @@ -281,8 +282,8 @@ CCECAdapterMessage params; params.PushEscaped(enabled ? 1 : 0); CCECAdapterMessage *message = m_comm->SendCommand(MSGCODE_SET_AUTO_ENABLED, params); - bReturn = message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; - delete message; + bReturn = message && message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; + DELETE_AND_NULL(message); if (bReturn) { @@ -310,8 +311,8 @@ CCECAdapterMessage params; params.PushEscaped((uint8_t)type); CCECAdapterMessage *message = m_comm->SendCommand(MSGCODE_SET_DEVICE_TYPE, params); - bReturn = message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; - delete message; + bReturn = message && message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; + DELETE_AND_NULL(message); if (bReturn) { @@ -339,8 +340,8 @@ CCECAdapterMessage params; params.PushEscaped((uint8_t)address); CCECAdapterMessage *message = m_comm->SendCommand(MSGCODE_SET_DEFAULT_LOGICAL_ADDRESS, params); - bReturn = message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; - delete message; + bReturn = message && message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; + DELETE_AND_NULL(message); if (bReturn) { @@ -369,8 +370,8 @@ params.PushEscaped(iMask >> 8); params.PushEscaped((uint8_t)iMask); CCECAdapterMessage *message = m_comm->SendCommand(MSGCODE_SET_LOGICAL_ADDRESS_MASK, params); - bReturn = message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; - delete message; + bReturn = message && message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; + DELETE_AND_NULL(message); if (bReturn) { @@ -399,8 +400,8 @@ params.PushEscaped(iPhysicalAddress >> 8); params.PushEscaped((uint8_t)iPhysicalAddress); CCECAdapterMessage *message = m_comm->SendCommand(MSGCODE_SET_PHYSICAL_ADDRESS, params); - bReturn = message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; - delete message; + bReturn = message && message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; + DELETE_AND_NULL(message); if (bReturn) { @@ -428,8 +429,8 @@ CCECAdapterMessage params; params.PushEscaped((uint8_t)version); CCECAdapterMessage *message = m_comm->SendCommand(MSGCODE_SET_HDMI_VERSION, params); - bReturn = message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; - delete message; + bReturn = message && message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; + DELETE_AND_NULL(message); if (bReturn) { @@ -454,8 +455,8 @@ for (size_t iPtr = 0; iPtr < strlen(strOSDName); iPtr++) params.PushEscaped(strOSDName[iPtr]); CCECAdapterMessage *message = m_comm->SendCommand(MSGCODE_SET_OSD_NAME, params); - bReturn = message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; - delete message; + bReturn = message && message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; + DELETE_AND_NULL(message); if (bReturn) snprintf(m_persistedConfiguration.strDeviceName, 13, "%s", strOSDName); @@ -475,8 +476,8 @@ CCECAdapterMessage params; CCECAdapterMessage *message = m_comm->SendCommand(MSGCODE_WRITE_EEPROM, params); - bool bReturn = message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; - delete message; + bool bReturn = message && message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; + DELETE_AND_NULL(message); if (bReturn) { @@ -574,8 +575,8 @@ CCECAdapterMessage params; CCECAdapterMessage *message = m_comm->SendCommand(MSGCODE_PING, params); - bool bReturn = message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; - delete message; + bool bReturn = message && message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; + DELETE_AND_NULL(message); return bReturn; } @@ -587,8 +588,8 @@ params.PushEscaped(iMask >> 8); params.PushEscaped((uint8_t)iMask); CCECAdapterMessage *message = m_comm->SendCommand(MSGCODE_SET_ACK_MASK, params); - bool bReturn = message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; - delete message; + bool bReturn = message && message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; + DELETE_AND_NULL(message); return bReturn; } @@ -601,7 +602,7 @@ CCECAdapterMessage params; params.PushEscaped(bSetTo ? 1 : 0); CCECAdapterMessage *message = m_comm->SendCommand(MSGCODE_SET_ACTIVE_SOURCE, params); - delete message; + DELETE_AND_NULL(message); } } @@ -611,8 +612,8 @@ CCECAdapterMessage params; CCECAdapterMessage *message = m_comm->SendCommand(MSGCODE_START_BOOTLOADER, params); - bool bReturn = message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; - delete message; + bool bReturn = message && message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; + DELETE_AND_NULL(message); return bReturn; } @@ -622,8 +623,8 @@ CCECAdapterMessage params; params.PushEscaped(iTimeout); CCECAdapterMessage *message = m_comm->SendCommand(MSGCODE_TRANSMIT_IDLETIME, params); - bool bReturn = message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; - delete message; + bool bReturn = message && message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; + DELETE_AND_NULL(message); return bReturn; } @@ -640,8 +641,8 @@ CCECAdapterMessage params; params.PushEscaped(controlled ? 1 : 0); CCECAdapterMessage *message = m_comm->SendCommand(MSGCODE_SET_CONTROLLED, params); - bool bReturn = message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; - delete message; + bool bReturn = message && message->state == ADAPTER_MESSAGE_STATE_SENT_ACKED; + DELETE_AND_NULL(message); if (bReturn) { diff -Nru libcec-2.1.3/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.cpp libcec-2.1.4/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.cpp --- libcec-2.1.3/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.cpp 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.cpp 2013-12-14 00:02:42.000000000 +0000 @@ -304,6 +304,7 @@ m_lastPollDestination = msg.Destination(); if (msg.Destination() < CECDEVICE_BROADCAST) { + CLockObject waitingLock(m_waitingMutex); if (!m_bWaitingForAck[msg.Destination()] && !msg.IsEOM()) { if (m_callback) @@ -328,7 +329,7 @@ /* mark as waiting for an ack from the destination */ if (dest < CECDEVICE_BROADCAST) { - CLockObject lock(m_mutex); + CLockObject waitingLock(m_waitingMutex); m_bWaitingForAck[dest] = true; } } @@ -382,8 +383,7 @@ { LIB_CEC->AddLog(CEC_LOG_DEBUG, "error writing command '%s' to serial port '%s': %s", CCECAdapterMessage::ToString(message->Message()), m_port->GetName().c_str(), m_port->GetError().c_str()); message->state = ADAPTER_MESSAGE_STATE_ERROR; - // this will trigger an alert in the reader thread - m_port->Close(); + // let the higher level close the port return false; } @@ -416,7 +416,7 @@ if (m_port->GetErrorNumber()) { LIB_CEC->AddLog(CEC_LOG_ERROR, "error reading from serial port: %s", m_port->GetError().c_str()); - m_port->Close(); + // let the higher level close the port return false; } } @@ -729,6 +729,11 @@ /* failed to ping the adapter 3 times in a row. something must be wrong with the connection */ m_com->LIB_CEC->AddLog(CEC_LOG_ERROR, "failed to ping the adapter 3 times in a row. closing the connection."); m_com->StopThread(false); + + libcec_parameter param; + param.paramData = NULL; param.paramType = CEC_PARAMETER_TYPE_UNKOWN; + m_com->LIB_CEC->Alert(CEC_ALERT_CONNECTION_LOST, param); + break; } } diff -Nru libcec-2.1.3/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.h libcec-2.1.4/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.h --- libcec-2.1.3/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.h 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/lib/adapter/Pulse-Eight/USBCECAdapterCommunication.h 2013-12-14 00:02:42.000000000 +0000 @@ -182,6 +182,7 @@ CUSBCECAdapterCommands * m_commands; /**< commands that can be sent to the adapter */ CCECAdapterMessageQueue * m_adapterMessageQueue; /**< the incoming and outgoing message queue */ cec_logical_addresses m_logicalAddresses; /**< the logical address list that this instance is using */ + PLATFORM::CMutex m_waitingMutex; }; class CAdapterEepromWriteThread : public PLATFORM::CThread diff -Nru libcec-2.1.3/src/lib/adapter/Pulse-Eight/USBCECAdapterDetection.cpp libcec-2.1.4/src/lib/adapter/Pulse-Eight/USBCECAdapterDetection.cpp --- libcec-2.1.3/src/lib/adapter/Pulse-Eight/USBCECAdapterDetection.cpp 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/lib/adapter/Pulse-Eight/USBCECAdapterDetection.cpp 2013-12-14 00:02:42.000000000 +0000 @@ -61,6 +61,8 @@ #include } #elif defined(__FreeBSD__) +#include +#include #include #include #endif @@ -434,22 +436,77 @@ } #elif defined(__FreeBSD__) char devicePath[PATH_MAX + 1]; + char infos[512]; + char sysctlname[32]; + char ttyname[8]; + char *pos; + size_t infos_size = sizeof(infos); int i; - for (i = 0; i < 8; ++i) + for (i = 0; ; ++i) { - (void)snprintf(devicePath, sizeof(devicePath), "/dev/ttyU%d", i); - if (strDevicePath && strcmp(devicePath, strDevicePath) != 0) + unsigned int iVendor, iProduct; + memset(infos, 0, sizeof(infos)); + (void)snprintf(sysctlname, sizeof(sysctlname), + "dev.umodem.%d.%%pnpinfo", i); + if (sysctlbyname(sysctlname, infos, &infos_size, + NULL, 0) != 0) + break; + pos = strstr(infos, "vendor="); + if (pos == NULL) continue; - if (!access(devicePath, 0)) - { - snprintf(deviceList[iFound].strComPath, sizeof(deviceList[iFound].strComPath), "%s", devicePath); - snprintf(deviceList[iFound].strComName, sizeof(deviceList[iFound].strComName), "%s", devicePath); - deviceList[iFound].iVendorId = CEC_VID; - deviceList[iFound].iProductId = CEC_VID; - deviceList[iFound].adapterType = ADAPTERTYPE_P8_EXTERNAL; // will be overridden when not doing a "quick scan" by the actual type - iFound++; + sscanf(pos, "vendor=%x ", &iVendor); + + pos = strstr(infos, "product="); + if (pos == NULL) + continue; + sscanf(pos, "product=%x ", &iProduct); + + if (iVendor != CEC_VID || (iProduct != CEC_PID && iProduct != CEC_PID2)) + continue; + + pos = strstr(infos, "ttyname="); + if (pos == NULL) + continue; + sscanf(pos, "ttyname=%s ", ttyname); + + (void)snprintf(devicePath, sizeof(devicePath), + "/dev/tty%s", ttyname); + + if (strDevicePath) { + char currStrDevicePath[512]; + int port = 0; + int devaddr = 0; + memset(currStrDevicePath, 0, sizeof(currStrDevicePath)); + memset(infos, 0, sizeof(infos)); + (void)snprintf(sysctlname, sizeof(sysctlname), + "dev.umodem.%d.%%location", i); + if (sysctlbyname(sysctlname, infos, &infos_size, + NULL, 0) != 0) + break; + + pos = strstr(infos, "port="); + if (pos == NULL) + continue; + sscanf(pos, "port=%d ", &port); + + pos = strstr(infos, "devaddr="); + if (pos == NULL) + continue; + sscanf(pos, "devaddr=%d ", &devaddr); + + (void)snprintf(currStrDevicePath, sizeof(currStrDevicePath), + "/dev/ugen%d.%d", port, devaddr); + + if (strcmp(currStrDevicePath, strDevicePath) != 0) + continue; } + snprintf(deviceList[iFound].strComPath, sizeof(deviceList[iFound].strComPath), "%s", devicePath); + snprintf(deviceList[iFound].strComName, sizeof(deviceList[iFound].strComName), "%s", devicePath); + deviceList[iFound].iVendorId = iVendor; + deviceList[iFound].iProductId = iProduct; + deviceList[iFound].adapterType = ADAPTERTYPE_P8_EXTERNAL; // will be overridden when not doing a "quick scan" by the actual type + iFound++; } #else //silence "unused" warnings diff -Nru libcec-2.1.3/src/lib/devices/CECBusDevice.cpp libcec-2.1.4/src/lib/devices/CECBusDevice.cpp --- libcec-2.1.3/src/lib/devices/CECBusDevice.cpp 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/lib/devices/CECBusDevice.cpp 2013-12-14 00:02:42.000000000 +0000 @@ -41,6 +41,8 @@ #include "lib/implementations/VLCommandHandler.h" #include "lib/implementations/PHCommandHandler.h" #include "lib/implementations/RLCommandHandler.h" +#include "lib/implementations/RHCommandHandler.h" +#include "lib/implementations/AQCommandHandler.h" #include "lib/LibCEC.h" #include "lib/CECTypeUtils.h" #include "lib/platform/util/timeutils.h" @@ -59,6 +61,78 @@ #define LIB_CEC m_processor->GetLib() #define ToString(p) CCECTypeUtils::ToString(p) +CResponse::CResponse(cec_opcode opcode) : + m_opcode(opcode) +{ +} + +CResponse::~CResponse(void) +{ + Broadcast(); +} + +bool CResponse::Wait(uint32_t iTimeout) +{ + return m_event.Wait(iTimeout); +} + +void CResponse::Broadcast(void) +{ + m_event.Broadcast(); +} + +CWaitForResponse::CWaitForResponse(void) +{ +} + +CWaitForResponse::~CWaitForResponse(void) +{ + Clear(); +} + +void CWaitForResponse::Clear() +{ + PLATFORM::CLockObject lock(m_mutex); + for (std::map::iterator it = m_waitingFor.begin(); it != m_waitingFor.end(); it++) + { + it->second->Broadcast(); + delete it->second; + } + m_waitingFor.clear(); +} + +bool CWaitForResponse::Wait(cec_opcode opcode, uint32_t iTimeout) +{ + CResponse *response = GetEvent(opcode); + return response ? response->Wait(iTimeout) : false; +} + +void CWaitForResponse::Received(cec_opcode opcode) +{ + CResponse *response = GetEvent(opcode); + if (response) + response->Broadcast(); +} + +CResponse* CWaitForResponse::GetEvent(cec_opcode opcode) +{ + CResponse *retVal(NULL); + { + PLATFORM::CLockObject lock(m_mutex); + std::map::iterator it = m_waitingFor.find(opcode); + if (it != m_waitingFor.end()) + { + retVal = it->second; + } + else + { + retVal = new CResponse(opcode); + m_waitingFor[opcode] = retVal; + } + return retVal; + } +} + CCECBusDevice::CCECBusDevice(CCECProcessor *processor, cec_logical_address iLogicalAddress, uint16_t iPhysicalAddress /* = CEC_INVALID_PHYSICAL_ADDRESS */) : m_type (CEC_DEVICE_TYPE_RESERVED), m_iPhysicalAddress (iPhysicalAddress), @@ -141,6 +215,12 @@ case CEC_VENDOR_TOSHIBA2: m_handler = new CRLCommandHandler(this, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending); break; + case CEC_VENDOR_ONKYO: + m_handler = new CRHCommandHandler(this, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending); + break; + case CEC_VENDOR_SHARP: + m_handler = new CAQCommandHandler(this, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending); + break; default: m_handler = new CCECCommandHandler(this, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending); break; @@ -605,7 +685,7 @@ if (bRequestUpdate) { CheckVendorIdRequested(initiator); - RequestPowerStatus(initiator); + RequestPowerStatus(initiator, bUpdate); } CLockObject lock(m_mutex); @@ -642,7 +722,7 @@ return m_bImageViewOnSent; } -bool CCECBusDevice::RequestPowerStatus(const cec_logical_address initiator, bool bWaitForResponse /* = true */) +bool CCECBusDevice::RequestPowerStatus(const cec_logical_address initiator, bool bUpdate, bool bWaitForResponse /* = true */) { bool bReturn(false); @@ -650,7 +730,7 @@ !IsUnsupportedFeature(CEC_OPCODE_GIVE_DEVICE_POWER_STATUS)) { MarkBusy(); - bReturn = m_handler->TransmitRequestPowerStatus(initiator, m_iLogicalAddress, bWaitForResponse); + bReturn = m_handler->TransmitRequestPowerStatus(initiator, m_iLogicalAddress, bUpdate, bWaitForResponse); if (!bReturn) SetPowerStatus(CEC_POWER_STATUS_UNKNOWN); MarkReady(); @@ -809,7 +889,7 @@ if (m_deviceStatus != newStatus) LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s (%X): device status changed into 'handled by libCEC'", GetLogicalAddressName(), m_iLogicalAddress); SetPowerStatus (CEC_POWER_STATUS_ON); - SetVendorId (CEC_VENDOR_UNKNOWN); + SetVendorId (CEC_VENDOR_PULSE_EIGHT); SetMenuState (CEC_MENU_STATE_ACTIVATED); SetCecVersion (libCECSpecVersion); SetStreamPath (CEC_INVALID_PHYSICAL_ADDRESS); @@ -1002,14 +1082,12 @@ if ((*it)->GetLogicalAddress() != m_iLogicalAddress) (*it)->MarkAsInactiveSource(); - if (bWasActivated) - { - if (IsHandledByLibCEC()) - m_processor->SetActiveSource(true, false); - CCECClient *client = GetClient(); - if (client) - client->SourceActivated(m_iLogicalAddress); - } + if (bWasActivated && IsHandledByLibCEC()) + m_processor->SetActiveSource(true, false); + + CCECClient *client = GetClient(); + if (client) + client->SourceActivated(m_iLogicalAddress); } void CCECBusDevice::MarkAsInactiveSource(bool bClientUnregistered /* = false */) @@ -1139,14 +1217,10 @@ return; CCECBusDevice* newRoute = m_processor->GetDeviceByPhysicalAddress(iRoute, true); - if (newRoute) + if (newRoute && newRoute->IsHandledByLibCEC()) { // we were made the active source, send notification - if (newRoute->IsHandledByLibCEC()) - newRoute->ActivateSource(); - // another device was made active - else - newRoute->MarkAsActiveSource(); + newRoute->ActivateSource(); } } diff -Nru libcec-2.1.3/src/lib/devices/CECBusDevice.h libcec-2.1.4/src/lib/devices/CECBusDevice.h --- libcec-2.1.3/src/lib/devices/CECBusDevice.h 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/lib/devices/CECBusDevice.h 2013-12-14 00:02:42.000000000 +0000 @@ -50,22 +50,11 @@ class CResponse { public: - CResponse(cec_opcode opcode) : - m_opcode(opcode){} - ~CResponse(void) - { - Broadcast(); - } - - bool Wait(uint32_t iTimeout) - { - return m_event.Wait(iTimeout); - } - - void Broadcast(void) - { - m_event.Broadcast(); - } + CResponse(cec_opcode opcode); + ~CResponse(void); + + bool Wait(uint32_t iTimeout); + void Broadcast(void); private: cec_opcode m_opcode; @@ -75,52 +64,15 @@ class CWaitForResponse { public: - CWaitForResponse(void) {} - ~CWaitForResponse(void) - { - Clear(); - } - - void Clear() - { - PLATFORM::CLockObject lock(m_mutex); - for (std::map::iterator it = m_waitingFor.begin(); it != m_waitingFor.end(); it++) - it->second->Broadcast(); - m_waitingFor.clear(); - } - - bool Wait(cec_opcode opcode, uint32_t iTimeout = CEC_DEFAULT_TRANSMIT_WAIT) - { - CResponse *response = GetEvent(opcode); - return response ? response->Wait(iTimeout) : false; - } - - void Received(cec_opcode opcode) - { - CResponse *response = GetEvent(opcode); - if (response) - response->Broadcast(); - } + CWaitForResponse(void); + ~CWaitForResponse(void); + + void Clear(); + bool Wait(cec_opcode opcode, uint32_t iTimeout = CEC_DEFAULT_TRANSMIT_WAIT); + void Received(cec_opcode opcode); private: - CResponse *GetEvent(cec_opcode opcode) - { - CResponse *retVal(NULL); - { - PLATFORM::CLockObject lock(m_mutex); - std::map::iterator it = m_waitingFor.find(opcode); - if (it != m_waitingFor.end()) - { - retVal = it->second; - } - else - { - retVal = new CResponse(opcode); - m_waitingFor[opcode] = retVal; - } - return retVal; - } - } + CResponse *GetEvent(cec_opcode opcode); PLATFORM::CMutex m_mutex; std::map m_waitingFor; @@ -194,7 +146,7 @@ virtual void SetPowerStatus(const cec_power_status powerStatus); virtual void OnImageViewOnSent(bool bSentByLibCEC); virtual bool ImageViewOnSent(void); - virtual bool RequestPowerStatus(const cec_logical_address initiator, bool bWaitForResponse = true); + virtual bool RequestPowerStatus(const cec_logical_address initiator, bool bUpdate, bool bWaitForResponse = true); virtual bool TransmitPowerState(const cec_logical_address destination, bool bIsReply); virtual cec_vendor_id GetCurrentVendorId(void); diff -Nru libcec-2.1.3/src/lib/implementations/ANCommandHandler.cpp libcec-2.1.4/src/lib/implementations/ANCommandHandler.cpp --- libcec-2.1.3/src/lib/implementations/ANCommandHandler.cpp 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/lib/implementations/ANCommandHandler.cpp 2013-12-14 00:02:42.000000000 +0000 @@ -76,11 +76,6 @@ return COMMAND_HANDLED; } -int CANCommandHandler::HandleVendorRemoteButtonUp(const cec_command &command) -{ - return HandleUserControlRelease(command); -} - bool CANCommandHandler::PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination) { if (iDestination == CECDEVICE_AUDIOSYSTEM) @@ -92,3 +87,32 @@ return CCECCommandHandler::PowerOn(iInitiator, iDestination); } + +int CANCommandHandler::HandleDeviceVendorCommandWithId(const cec_command &command) +{ + if (!m_processor->IsHandledByLibCEC(command.destination)) + return CEC_ABORT_REASON_INVALID_OPERAND; + + // samsung's vendor id + if (command.parameters[0] == 0x00 && command.parameters[1] == 0x00 && command.parameters[2] == 0xf0) + { + // unknown vendor command sent to devices + if (command.parameters[3] == 0x23) + { + cec_command response; + cec_command::Format(response, command.destination, command.initiator, CEC_OPCODE_VENDOR_COMMAND_WITH_ID); + + // samsung vendor id + response.parameters.PushBack(0x00); response.parameters.PushBack(0x00); response.parameters.PushBack(0xf0); + + // XXX see bugzid 2164. reply sent back by audio systems, we might have to send something different + response.parameters.PushBack(0x24); + response.parameters.PushBack(0x00); + response.parameters.PushBack(0x80); + + Transmit(response, false, true); + return COMMAND_HANDLED; + } + } + return CEC_ABORT_REASON_INVALID_OPERAND; +} diff -Nru libcec-2.1.3/src/lib/implementations/ANCommandHandler.h libcec-2.1.4/src/lib/implementations/ANCommandHandler.h --- libcec-2.1.3/src/lib/implementations/ANCommandHandler.h 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/lib/implementations/ANCommandHandler.h 2013-12-14 00:02:42.000000000 +0000 @@ -46,7 +46,7 @@ virtual ~CANCommandHandler(void) {}; int HandleVendorRemoteButtonDown(const cec_command &command); - int HandleVendorRemoteButtonUp(const cec_command &command); + int HandleDeviceVendorCommandWithId(const cec_command &command); protected: bool PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination); diff -Nru libcec-2.1.3/src/lib/implementations/AQCommandHandler.cpp libcec-2.1.4/src/lib/implementations/AQCommandHandler.cpp --- libcec-2.1.3/src/lib/implementations/AQCommandHandler.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libcec-2.1.4/src/lib/implementations/AQCommandHandler.cpp 2013-12-14 00:02:42.000000000 +0000 @@ -0,0 +1,89 @@ +/* + * This file is part of the libCEC(R) library. + * + * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved. + * libCEC(R) is an original work, containing original code. + * + * libCEC(R) is a trademark of Pulse-Eight Limited. + * + * This program is dual-licensed; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * + * Alternatively, you can license this library under a commercial license, + * please contact Pulse-Eight Licensing for more information. + * + * For more information contact: + * Pulse-Eight Licensing + * http://www.pulse-eight.com/ + * http://www.pulse-eight.net/ + */ + +#include "env.h" +#include "AQCommandHandler.h" + +#include "lib/devices/CECBusDevice.h" +#include "lib/CECProcessor.h" +#include "lib/LibCEC.h" +#include "lib/CECClient.h" + +using namespace CEC; +using namespace PLATFORM; + +#define LIB_CEC m_busDevice->GetProcessor()->GetLib() +#define ToString(p) LIB_CEC->ToString(p) + +CAQCommandHandler::CAQCommandHandler(CCECBusDevice *busDevice, + int32_t iTransmitTimeout /* = CEC_DEFAULT_TRANSMIT_TIMEOUT */, + int32_t iTransmitWait /* = CEC_DEFAULT_TRANSMIT_WAIT */, + int8_t iTransmitRetries /* = CEC_DEFAULT_TRANSMIT_RETRIES */, + int64_t iActiveSourcePending /* = 0 */) : + CCECCommandHandler(busDevice, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending), + m_powerOnCheck(NULL) +{ + m_vendorId = CEC_VENDOR_SHARP; +} + +CAQCommandHandler::~CAQCommandHandler(void) +{ + delete m_powerOnCheck; +} + +bool CAQCommandHandler::PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination) +{ + bool bCheck(false); + bool bRetval(false); + if (m_busDevice->GetCurrentPowerStatus() != CEC_POWER_STATUS_ON && (!m_powerOnCheck || !m_powerOnCheck->IsRunning())) + bCheck = true; + bRetval = CCECCommandHandler::PowerOn(iInitiator, iDestination); + + if (bRetval && bCheck) + { + if (!m_powerOnCheck) + m_powerOnCheck = new CAQPowerStatusCheck(this, iInitiator, iDestination); + if (m_powerOnCheck) + m_powerOnCheck->CreateThread(); + } + + return bRetval; +} + +void* CAQPowerStatusCheck::Process(void) +{ + // sleep for 2 seconds and query the power status + Sleep(2000); + if (m_handler->m_busDevice->GetProcessor()->GetDevice(m_iDestination)->GetPowerStatus(m_iInitiator, true) == CEC_POWER_STATUS_STANDBY) + m_handler->m_busDevice->GetProcessor()->GetLib()->AddLog(CEC_LOG_WARNING, "AQUOS LINK 'auto power on' is disabled, which prevents the TV from being powered on. To correct this, press the menu button on your remote, go to 'link operation' -> 'AQUOS LINK setup' -> 'Auto power on' and set it to 'On'"); + return NULL; +} diff -Nru libcec-2.1.3/src/lib/implementations/AQCommandHandler.h libcec-2.1.4/src/lib/implementations/AQCommandHandler.h --- libcec-2.1.3/src/lib/implementations/AQCommandHandler.h 1970-01-01 00:00:00.000000000 +0000 +++ libcec-2.1.4/src/lib/implementations/AQCommandHandler.h 2013-12-14 00:02:42.000000000 +0000 @@ -0,0 +1,74 @@ +#pragma once +/* + * This file is part of the libCEC(R) library. + * + * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved. + * libCEC(R) is an original work, containing original code. + * + * libCEC(R) is a trademark of Pulse-Eight Limited. + * + * This program is dual-licensed; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * + * Alternatively, you can license this library under a commercial license, + * please contact Pulse-Eight Licensing for more information. + * + * For more information contact: + * Pulse-Eight Licensing + * http://www.pulse-eight.com/ + * http://www.pulse-eight.net/ + */ + +#include "CECCommandHandler.h" +#include "lib/platform/threads/threads.h" + +namespace CEC +{ + class CAQPowerStatusCheck; + + class CAQCommandHandler : public CCECCommandHandler + { + friend class CAQPowerStatusCheck; + public: + CAQCommandHandler(CCECBusDevice *busDevice, + int32_t iTransmitTimeout = CEC_DEFAULT_TRANSMIT_TIMEOUT, + int32_t iTransmitWait = CEC_DEFAULT_TRANSMIT_WAIT, + int8_t iTransmitRetries = CEC_DEFAULT_TRANSMIT_RETRIES, + int64_t iActiveSourcePending = 0); + virtual ~CAQCommandHandler(void); + + protected: + virtual bool PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination); + + private: + CAQPowerStatusCheck* m_powerOnCheck; + }; + + class CAQPowerStatusCheck : public PLATFORM::CThread + { + public: + CAQPowerStatusCheck(CAQCommandHandler* handler, cec_logical_address iInitiator, cec_logical_address iDestination) : + m_handler(handler), + m_iInitiator(iInitiator), + m_iDestination(iDestination) {} + virtual ~CAQPowerStatusCheck(void) {} + + private: + void* Process(void); + CAQCommandHandler* m_handler; + cec_logical_address m_iInitiator; + cec_logical_address m_iDestination; + }; +}; diff -Nru libcec-2.1.3/src/lib/implementations/CECCommandHandler.cpp libcec-2.1.4/src/lib/implementations/CECCommandHandler.cpp --- libcec-2.1.3/src/lib/implementations/CECCommandHandler.cpp 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/lib/implementations/CECCommandHandler.cpp 2013-12-14 00:02:42.000000000 +0000 @@ -257,6 +257,14 @@ int CCECCommandHandler::HandleDeviceVendorId(const cec_command &command) { SetVendorId(command); + + if (command.initiator == CECDEVICE_TV) + { + CCECBusDevice* primary = m_processor->GetPrimaryDevice(); + if (primary) + primary->TransmitVendorID(CECDEVICE_BROADCAST, false, false); + } + return COMMAND_HANDLED; } @@ -455,6 +463,13 @@ { uint16_t iNewAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]); SetPhysicalAddress(command.initiator, iNewAddress); + + if (command.initiator == CECDEVICE_TV) + { + CCECBusDevice* primary = m_processor->GetPrimaryDevice(); + if (primary) + primary->TransmitPhysicalAddress(false); + } return COMMAND_HANDLED; } return CEC_ABORT_REASON_INVALID_OPERAND; @@ -580,7 +595,10 @@ if (device->IsHandledByLibCEC() && !device->IsActiveSource()) device->ActivateSource(); else + { device->MarkAsActiveSource(); + device->TransmitActiveSource(true); + } return COMMAND_HANDLED; } } @@ -910,12 +928,12 @@ return Transmit(command, !bWaitForResponse, false); } -bool CCECCommandHandler::TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */) +bool CCECCommandHandler::TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bUpdate, bool bWaitForResponse /* = true */) { if (iDestination == CECDEVICE_TV) { int64_t now(GetTimeMs()); - if (now - m_iPowerStatusRequested < REQUEST_POWER_STATUS_TIMEOUT) + if (!bUpdate && now - m_iPowerStatusRequested < REQUEST_POWER_STATUS_TIMEOUT) return true; m_iPowerStatusRequested = now; } @@ -1207,7 +1225,7 @@ bool bTvPresent = (tv && tv->GetStatus() == CEC_DEVICE_STATUS_PRESENT); bool bActiveSourceFailed(false); if (bTvPresent) - bActiveSourceFailed = !m_busDevice->TransmitImageViewOn(); + bActiveSourceFailed = !tv->PowerOn(m_busDevice->GetLogicalAddress()); else LIB_CEC->AddLog(CEC_LOG_DEBUG, "TV not present, not sending 'image view on'"); @@ -1230,6 +1248,14 @@ if (playbackDevice && SendDeckStatusUpdateOnActiveSource()) bActiveSourceFailed = !playbackDevice->TransmitDeckStatus(CECDEVICE_TV, false); } + + // update system audio mode for audiosystem devices + if (bTvPresent && !bActiveSourceFailed) + { + CCECAudioSystem* audioDevice = m_busDevice->AsAudioSystem(); + if (audioDevice) + bActiveSourceFailed = !audioDevice->TransmitSetSystemAudioMode(CECDEVICE_TV, false); + } } // retry later diff -Nru libcec-2.1.3/src/lib/implementations/CECCommandHandler.h libcec-2.1.4/src/lib/implementations/CECCommandHandler.h --- libcec-2.1.3/src/lib/implementations/CECCommandHandler.h 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/lib/implementations/CECCommandHandler.h 2013-12-14 00:02:42.000000000 +0000 @@ -58,7 +58,7 @@ virtual bool HandleCommand(const cec_command &command); virtual cec_vendor_id GetVendorId(void) { return m_vendorId; }; virtual void SetVendorId(cec_vendor_id vendorId) { m_vendorId = vendorId; } - static bool HasSpecificHandler(cec_vendor_id vendorId) { return vendorId == CEC_VENDOR_LG || vendorId == CEC_VENDOR_SAMSUNG || vendorId == CEC_VENDOR_PANASONIC || vendorId == CEC_VENDOR_PHILIPS;} + static bool HasSpecificHandler(cec_vendor_id vendorId) { return vendorId == CEC_VENDOR_LG || vendorId == CEC_VENDOR_SAMSUNG || vendorId == CEC_VENDOR_PANASONIC || vendorId == CEC_VENDOR_PHILIPS || vendorId == CEC_VENDOR_SHARP;} virtual bool InitHandler(void) { return true; } virtual bool ActivateSource(bool bTransmitDelayedCommandsOnly = false); @@ -73,7 +73,7 @@ virtual bool TransmitRequestOSDName(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true); virtual bool TransmitRequestAudioStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true); virtual bool TransmitRequestPhysicalAddress(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true); - virtual bool TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true); + virtual bool TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bUpdate, bool bWaitForResponse = true); virtual bool TransmitRequestVendorId(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true); virtual bool TransmitActiveSource(const cec_logical_address iInitiator, uint16_t iPhysicalAddress, bool bIsReply); virtual bool TransmitCECVersion(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_version cecVersion, bool bIsReply); @@ -138,7 +138,7 @@ virtual int HandleUserControlRelease(const cec_command &command); virtual int HandleVendorCommand(const cec_command &command); virtual int HandleVendorRemoteButtonDown(const cec_command& command); - virtual int HandleVendorRemoteButtonUp(const cec_command & UNUSED(command)) { return COMMAND_HANDLED; } + virtual int HandleVendorRemoteButtonUp(const cec_command& command) { return HandleUserControlRelease(command); } virtual void UnhandledCommand(const cec_command &command, const cec_abort_reason reason); virtual void RequestEmailFromCustomer(const cec_command& command); diff -Nru libcec-2.1.3/src/lib/implementations/PHCommandHandler.cpp libcec-2.1.4/src/lib/implementations/PHCommandHandler.cpp --- libcec-2.1.3/src/lib/implementations/PHCommandHandler.cpp 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/lib/implementations/PHCommandHandler.cpp 2013-12-14 00:02:42.000000000 +0000 @@ -152,9 +152,8 @@ return CCECCommandHandler::HandleDeviceVendorId(command); } -bool CPHCommandHandler::TransmitVendorID(const cec_logical_address iInitiator, const cec_logical_address iDestination, uint64_t UNUSED(iVendorId), bool UNUSED(bIsReply)) +bool CPHCommandHandler::TransmitVendorID(const cec_logical_address iInitiator, const cec_logical_address iDestination, uint64_t UNUSED(iVendorId), bool bIsReply) { - LIB_CEC->AddLog(CEC_LOG_DEBUG, "<< %s (%X) -> %s (%X): vendor id feature abort", ToString(iInitiator), iInitiator, ToString(iDestination), iDestination); - m_processor->TransmitAbort(iInitiator, iDestination, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID); - return true; + // XXX hack around the hack in CPHCommandHandler::InitHandler + return CCECCommandHandler::TransmitVendorID(iInitiator, iDestination, CEC_VENDOR_PULSE_EIGHT, bIsReply); } diff -Nru libcec-2.1.3/src/lib/implementations/PHCommandHandler.h libcec-2.1.4/src/lib/implementations/PHCommandHandler.h --- libcec-2.1.3/src/lib/implementations/PHCommandHandler.h 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/lib/implementations/PHCommandHandler.h 2013-12-14 00:02:42.000000000 +0000 @@ -71,7 +71,6 @@ virtual int HandleUserControlRelease(const cec_command& command); virtual bool TransmitVendorID(const cec_logical_address iInitiator, const cec_logical_address iDestination, uint64_t iVendorId, bool bIsReply); virtual int HandleDeviceVendorId(const cec_command& command); - virtual int HandleVendorRemoteButtonUp(const cec_command & command) { return HandleUserControlRelease(command); } uint8_t m_iLastKeyCode; CImageViewOnCheck* m_imageViewOnCheck; }; diff -Nru libcec-2.1.3/src/lib/implementations/RHCommandHandler.cpp libcec-2.1.4/src/lib/implementations/RHCommandHandler.cpp --- libcec-2.1.3/src/lib/implementations/RHCommandHandler.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libcec-2.1.4/src/lib/implementations/RHCommandHandler.cpp 2013-12-14 00:02:42.000000000 +0000 @@ -0,0 +1,65 @@ +/* + * This file is part of the libCEC(R) library. + * + * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved. + * libCEC(R) is an original work, containing original code. + * + * libCEC(R) is a trademark of Pulse-Eight Limited. + * + * This program is dual-licensed; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * + * Alternatively, you can license this library under a commercial license, + * please contact Pulse-Eight Licensing for more information. + * + * For more information contact: + * Pulse-Eight Licensing + * http://www.pulse-eight.com/ + * http://www.pulse-eight.net/ + */ + +#include "env.h" +#include "RHCommandHandler.h" + +#include "lib/devices/CECBusDevice.h" +#include "lib/CECProcessor.h" +#include "lib/LibCEC.h" +#include "lib/CECClient.h" + +using namespace CEC; + +#define LIB_CEC m_busDevice->GetProcessor()->GetLib() +#define ToString(p) LIB_CEC->ToString(p) + +CRHCommandHandler::CRHCommandHandler(CCECBusDevice *busDevice, + int32_t iTransmitTimeout /* = CEC_DEFAULT_TRANSMIT_TIMEOUT */, + int32_t iTransmitWait /* = CEC_DEFAULT_TRANSMIT_WAIT */, + int8_t iTransmitRetries /* = CEC_DEFAULT_TRANSMIT_RETRIES */, + int64_t iActiveSourcePending /* = 0 */) : + CCECCommandHandler(busDevice, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending) +{ + m_vendorId = CEC_VENDOR_ONKYO; +} + +int CRHCommandHandler::HandleDeviceVendorCommandWithId(const cec_command &command) +{ + // onkyo's vendor id + if (command.parameters[0] == 0x00 && command.parameters[1] == 0x09 && command.parameters[2] == 0xb0) + { + // ignore unknown vendor commands sent by onkyo devices, bugzid: 2559 + } + return CEC_ABORT_REASON_INVALID_OPERAND; + +} diff -Nru libcec-2.1.3/src/lib/implementations/RHCommandHandler.h libcec-2.1.4/src/lib/implementations/RHCommandHandler.h --- libcec-2.1.3/src/lib/implementations/RHCommandHandler.h 1970-01-01 00:00:00.000000000 +0000 +++ libcec-2.1.4/src/lib/implementations/RHCommandHandler.h 2013-12-14 00:02:42.000000000 +0000 @@ -0,0 +1,51 @@ +#pragma once +/* + * This file is part of the libCEC(R) library. + * + * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved. + * libCEC(R) is an original work, containing original code. + * + * libCEC(R) is a trademark of Pulse-Eight Limited. + * + * This program is dual-licensed; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * + * Alternatively, you can license this library under a commercial license, + * please contact Pulse-Eight Licensing for more information. + * + * For more information contact: + * Pulse-Eight Licensing + * http://www.pulse-eight.com/ + * http://www.pulse-eight.net/ + */ + +#include "CECCommandHandler.h" + +namespace CEC +{ + class CRHCommandHandler : public CCECCommandHandler + { + public: + CRHCommandHandler(CCECBusDevice *busDevice, + int32_t iTransmitTimeout = CEC_DEFAULT_TRANSMIT_TIMEOUT, + int32_t iTransmitWait = CEC_DEFAULT_TRANSMIT_WAIT, + int8_t iTransmitRetries = CEC_DEFAULT_TRANSMIT_RETRIES, + int64_t iActiveSourcePending = 0); + virtual ~CRHCommandHandler(void) {}; + + protected: + int HandleDeviceVendorCommandWithId(const cec_command &command); + }; +}; diff -Nru libcec-2.1.3/src/lib/implementations/SLCommandHandler.cpp libcec-2.1.4/src/lib/implementations/SLCommandHandler.cpp --- libcec-2.1.3/src/lib/implementations/SLCommandHandler.cpp 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/lib/implementations/SLCommandHandler.cpp 2013-12-14 00:02:42.000000000 +0000 @@ -42,19 +42,18 @@ using namespace CEC; using namespace PLATFORM; -#define SL_COMMAND_UNKNOWN_01 0x01 -#define SL_COMMAND_UNKNOWN_02 0x02 - #define SL_COMMAND_TYPE_HDDRECORDER_DISC 0x01 #define SL_COMMAND_TYPE_VCR 0x02 #define SL_COMMAND_TYPE_DVDPLAYER 0x03 #define SL_COMMAND_TYPE_HDDRECORDER_DISC2 0x04 #define SL_COMMAND_TYPE_HDDRECORDER 0x05 -#define SL_COMMAND_REQUEST_POWER_STATUS 0xa0 +#define SL_COMMAND_INIT 0x01 +#define SL_COMMAND_ACK_INIT 0x02 #define SL_COMMAND_POWER_ON 0x03 #define SL_COMMAND_CONNECT_REQUEST 0x04 #define SL_COMMAND_SET_DEVICE_MODE 0x05 +#define SL_COMMAND_REQUEST_POWER_STATUS 0xa0 #define LIB_CEC m_busDevice->GetProcessor()->GetLib() #define ToString(p) LIB_CEC->ToString(p) @@ -65,8 +64,7 @@ int8_t iTransmitRetries /* = CEC_DEFAULT_TRANSMIT_RETRIES */, int64_t iActiveSourcePending /* = 0 */) : CCECCommandHandler(busDevice, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending), - m_bSLEnabled(false), - m_bActiveSourceSent(false) + m_bSLEnabled(false) { m_vendorId = CEC_VENDOR_LG; @@ -98,74 +96,20 @@ primary->SetVendorId(CEC_VENDOR_LG); primary->ReplaceHandler(false); } - - if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV) - { - /* start as 'in transition standby->on' */ - primary->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON); - primary->TransmitPowerState(CECDEVICE_TV, false); - - /* send the vendor id */ - primary->TransmitVendorID(CECDEVICE_BROADCAST, false, false); - } } return true; } -int CSLCommandHandler::HandleActiveSource(const cec_command &command) -{ - if (command.parameters.size == 2) - { - uint16_t iAddress = ((uint16_t)command.parameters[0] << 8) | ((uint16_t)command.parameters[1]); - CCECBusDevice *device = m_processor->GetDeviceByPhysicalAddress(iAddress); - if (device) - device->MarkAsActiveSource(); - - { - CLockObject lock(m_SLMutex); - m_bActiveSourceSent = false; - } - - return COMMAND_HANDLED; - } - - return CEC_ABORT_REASON_INVALID_OPERAND; - -} - -int CSLCommandHandler::HandleDeviceVendorId(const cec_command &command) -{ - SetVendorId(command); - - if (!SLInitialised() && command.initiator == CECDEVICE_TV) - { - CCECBusDevice *destination = m_processor->GetDevice(command.destination); - if (destination && (destination->GetLogicalAddress() == CECDEVICE_BROADCAST || destination->IsHandledByLibCEC())) - { - cec_logical_address initiator = destination->GetLogicalAddress(); - if (initiator == CECDEVICE_BROADCAST) - initiator = m_processor->GetPrimaryDevice()->GetLogicalAddress(); - - cec_command response; - cec_command::Format(response, initiator, command.initiator, CEC_OPCODE_FEATURE_ABORT); - Transmit(response, false, true); - return COMMAND_HANDLED; - } - } - - return CCECCommandHandler::HandleDeviceVendorId(command); -} - int CSLCommandHandler::HandleVendorCommand(const cec_command &command) { if (!m_processor->IsHandledByLibCEC(command.destination)) return true; if (command.parameters.size == 1 && - command.parameters[0] == SL_COMMAND_UNKNOWN_01) + command.parameters[0] == SL_COMMAND_INIT) { - HandleVendorCommand01(command); + HandleVendorCommandSLInit(command); return COMMAND_HANDLED; } else if (command.parameters.size == 2 && @@ -190,21 +134,26 @@ return CCECCommandHandler::HandleVendorCommand(command); } -void CSLCommandHandler::HandleVendorCommand01(const cec_command &command) +void CSLCommandHandler::HandleVendorCommandSLInit(const cec_command &command) { - m_processor->GetPrimaryDevice()->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON); - TransmitVendorCommand0205(command.destination, command.initiator); - CCECBusDevice* dev = m_processor->GetDevice(command.destination); - if (dev && dev->IsHandledByLibCEC() && dev->IsActiveSource()) - dev->TransmitActiveSource(false); + if (dev && dev->IsHandledByLibCEC()) + { + if (!dev->IsActiveSource()) + { + dev->SetPowerStatus(CEC_POWER_STATUS_STANDBY); + dev->TransmitPowerState(command.initiator, true); + } + + TransmitVendorCommandSLAckInit(command.destination, command.initiator); + } } -void CSLCommandHandler::TransmitVendorCommand0205(const cec_logical_address iSource, const cec_logical_address iDestination) +void CSLCommandHandler::TransmitVendorCommandSLAckInit(const cec_logical_address iSource, const cec_logical_address iDestination) { cec_command response; cec_command::Format(response, iSource, iDestination, CEC_OPCODE_VENDOR_COMMAND); - response.PushBack(SL_COMMAND_UNKNOWN_02); + response.PushBack(SL_COMMAND_ACK_INIT); response.PushBack(SL_COMMAND_TYPE_HDDRECORDER); Transmit(response, false, true); @@ -228,10 +177,9 @@ device->SetPowerStatus(CEC_POWER_STATUS_ON); device->TransmitPowerState(command.initiator, false); device->TransmitPhysicalAddress(false); - { - CLockObject lock(m_SLMutex); - m_bActiveSourceSent = false; - } + + if (device->IsActiveSource()) + ActivateSource(); } } void CSLCommandHandler::HandleVendorCommandPowerOnStatus(const cec_command &command) @@ -253,7 +201,15 @@ SetSLInitialised(); TransmitVendorCommandSetDeviceMode(command.destination, command.initiator, CEC_DEVICE_TYPE_RECORDING_DEVICE); - ActivateSource(); + + if (m_processor->IsActiveSource(command.destination) && m_processor->IsHandledByLibCEC(command.destination)) + { + CCECBusDevice* dev = m_processor->GetDevice(command.destination); + CCECPlaybackDevice* pb = dev->AsPlaybackDevice(); + if (pb) + pb->TransmitDeckStatus(command.initiator, true); + dev->TransmitPowerState(command.initiator, true); + } } void CSLCommandHandler::TransmitVendorCommandSetDeviceMode(const cec_logical_address iSource, const cec_logical_address iDestination, const cec_device_type type) @@ -279,8 +235,7 @@ if (command.parameters[0] == CEC_STATUS_REQUEST_ON) { device->TransmitDeckStatus(command.initiator, true); - if (!ActiveSourceSent()) - ActivateSource(); + ActivateSource(); return COMMAND_HANDLED; } else if (command.parameters[0] == CEC_STATUS_REQUEST_ONCE) @@ -304,20 +259,10 @@ } else { - if (!ActiveSourceSent()) - { - device->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON); - device->TransmitPowerState(command.initiator, true); - ActivateSource(); - } - else if (m_resetPowerState.IsSet() && m_resetPowerState.TimeLeft() > 0) + if (m_resetPowerState.IsSet() && m_resetPowerState.TimeLeft() > 0) { /* TODO assume that we've bugged out. the return button no longer works after this */ LIB_CEC->AddLog(CEC_LOG_WARNING, "FIXME: LG seems to have bugged out. resetting to 'in transition standby to on'. the return button will not work"); - { - CLockObject lock(m_SLMutex); - m_bActiveSourceSent = false; - } device->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON); device->TransmitPowerState(command.initiator, true); device->SetPowerStatus(CEC_POWER_STATUS_ON); @@ -340,22 +285,25 @@ { if (m_processor->CECInitialised()) { - if (ActiveSourceSent()) - LIB_CEC->AddLog(CEC_LOG_DEBUG, ">> %i requests active source, ignored", (uint8_t) command.initiator); - else - ActivateSource(); - return COMMAND_HANDLED; + if (!SLInitialised()) + TransmitVendorCommandSLAckInit(m_processor->GetPrimaryDevice()->GetLogicalAddress(), command.initiator); + CCECCommandHandler::HandleRequestActiveSource(command); } return CEC_ABORT_REASON_NOT_IN_CORRECT_MODE_TO_RESPOND; } int CSLCommandHandler::HandleFeatureAbort(const cec_command &command) { - if (command.parameters.size == 0 && m_processor->GetPrimaryDevice()->GetCurrentPowerStatus() == CEC_POWER_STATUS_ON && !SLInitialised() && + CCECBusDevice* primary = m_processor->GetPrimaryDevice(); + if (command.parameters.size == 0 && primary->GetLogicalAddress() != CECDEVICE_UNKNOWN && + primary->GetCurrentPowerStatus() == CEC_POWER_STATUS_ON && !SLInitialised() && command.initiator == CECDEVICE_TV) { - m_processor->GetPrimaryDevice()->TransmitPowerState(command.initiator, false); - m_processor->GetPrimaryDevice()->TransmitVendorID(CECDEVICE_BROADCAST, false, false); + if (!SLInitialised() && m_processor->IsActiveSource(command.destination)) + { + TransmitVendorCommandSLAckInit(command.destination, command.initiator); + return COMMAND_HANDLED; + } } return CCECCommandHandler::HandleFeatureAbort(command); @@ -363,11 +311,7 @@ int CSLCommandHandler::HandleStandby(const cec_command &command) { - if (command.initiator == CECDEVICE_TV) - { - CLockObject lock(m_SLMutex); - m_bActiveSourceSent = false; - } + ResetSLState(); return CCECCommandHandler::HandleStandby(command); } @@ -377,7 +321,6 @@ LIB_CEC->AddLog(CEC_LOG_NOTICE, "resetting SL initialised state"); CLockObject lock(m_SLMutex); m_bSLEnabled = false; - m_bActiveSourceSent = false; m_processor->GetPrimaryDevice()->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON); } @@ -394,12 +337,6 @@ return m_bSLEnabled; } -bool CSLCommandHandler::ActiveSourceSent(void) -{ - CLockObject lock(m_SLMutex); - return m_bActiveSourceSent; -} - bool CSLCommandHandler::PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination) { if (iDestination != CECDEVICE_TV) @@ -419,9 +356,73 @@ return CCECCommandHandler::PowerOn(iInitiator, iDestination); } -void CSLCommandHandler::VendorPreActivateSourceHook(void) +bool CSLCommandHandler::ActivateSource(bool bTransmitDelayedCommandsOnly /* = false */) { - CCECPlaybackDevice *device = m_busDevice->AsPlaybackDevice(); - if (device) - device->SetDeckStatus(!device->IsActiveSource() ? CEC_DECK_INFO_OTHER_STATUS : CEC_DECK_INFO_OTHER_STATUS_LG); + if (m_busDevice->IsActiveSource() && + m_busDevice->IsHandledByLibCEC()) + { + { + CLockObject lock(m_mutex); + // check if we need to send a delayed source switch + if (bTransmitDelayedCommandsOnly) + { + if (m_iActiveSourcePending == 0 || GetTimeMs() < m_iActiveSourcePending) + return false; + +#ifdef CEC_DEBUGGING + LIB_CEC->AddLog(CEC_LOG_DEBUG, "transmitting delayed activate source command"); +#endif + } + } + + CCECPlaybackDevice *device = m_busDevice->AsPlaybackDevice(); + if (device) + device->SetDeckStatus(!device->IsActiveSource() ? CEC_DECK_INFO_OTHER_STATUS : CEC_DECK_INFO_OTHER_STATUS_LG); + + // power on the TV + CCECBusDevice* tv = m_processor->GetDevice(CECDEVICE_TV); + bool bTvPresent = (tv && tv->GetStatus() == CEC_DEVICE_STATUS_PRESENT); + bool bActiveSourceFailed(false); + if (bTvPresent) + { + bActiveSourceFailed = !device->TransmitImageViewOn(); + } + else + { + LIB_CEC->AddLog(CEC_LOG_DEBUG, "TV not present, not sending 'image view on'"); + } + + // check if we're allowed to switch sources + bool bSourceSwitchAllowed = SourceSwitchAllowed(); + if (!bSourceSwitchAllowed) + LIB_CEC->AddLog(CEC_LOG_DEBUG, "source switch is currently not allowed by command handler"); + + // switch sources (if allowed) + if (!bActiveSourceFailed && bSourceSwitchAllowed) + { + bActiveSourceFailed = !m_busDevice->TransmitActiveSource(false); + } + + // retry later + if (bActiveSourceFailed || !bSourceSwitchAllowed) + { + LIB_CEC->AddLog(CEC_LOG_DEBUG, "failed to make '%s' the active source. will retry later", m_busDevice->GetLogicalAddressName()); + int64_t now(GetTimeMs()); + CLockObject lock(m_mutex); + if (m_iActiveSourcePending == 0 || m_iActiveSourcePending < now) + m_iActiveSourcePending = now + (int64_t)CEC_ACTIVE_SOURCE_SWITCH_RETRY_TIME_MS; + return false; + } + else + { + CLockObject lock(m_mutex); + // clear previous pending active source command + m_iActiveSourcePending = 0; + } + + // mark the handler as initialised + CLockObject lock(m_mutex); + m_bHandlerInited = true; + } + return true; } diff -Nru libcec-2.1.3/src/lib/implementations/SLCommandHandler.h libcec-2.1.4/src/lib/implementations/SLCommandHandler.h --- libcec-2.1.3/src/lib/implementations/SLCommandHandler.h 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/lib/implementations/SLCommandHandler.h 2013-12-14 00:02:42.000000000 +0000 @@ -46,14 +46,13 @@ virtual ~CSLCommandHandler(void) {}; bool InitHandler(void); + bool ActivateSource(bool bTransmitDelayedCommandsOnly = false); protected: - int HandleActiveSource(const cec_command &command); - int HandleDeviceVendorId(const cec_command &command); int HandleVendorCommand(const cec_command &command); - void HandleVendorCommand01(const cec_command &command); - void TransmitVendorCommand0205(const cec_logical_address iSource, const cec_logical_address iDestination); + void HandleVendorCommandSLInit(const cec_command &command); + void TransmitVendorCommandSLAckInit(const cec_logical_address iSource, const cec_logical_address iDestination); void HandleVendorCommandPowerOn(const cec_command &command); void HandleVendorCommandPowerOnStatus(const cec_command &command); @@ -68,17 +67,12 @@ int HandleStandby(const cec_command &command); bool TransmitMenuState(const cec_logical_address UNUSED(iInitiator), const cec_logical_address UNUSED(iDestination), cec_menu_state UNUSED(menuState), bool UNUSED(bIsReply)) { return true; } bool PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination); - int HandleVendorRemoteButtonUp(const cec_command& command) { return HandleUserControlRelease(command); } void ResetSLState(void); bool SLInitialised(void); void SetSLInitialised(void); - bool ActiveSourceSent(void); - - void VendorPreActivateSourceHook(void); bool m_bSLEnabled; - bool m_bActiveSourceSent; PLATFORM::CTimeout m_resetPowerState; PLATFORM::CMutex m_SLMutex; }; diff -Nru libcec-2.1.3/src/lib/implementations/VLCommandHandler.cpp libcec-2.1.4/src/lib/implementations/VLCommandHandler.cpp --- libcec-2.1.3/src/lib/implementations/VLCommandHandler.cpp 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/lib/implementations/VLCommandHandler.cpp 2013-12-14 00:02:42.000000000 +0000 @@ -106,23 +106,28 @@ command.parameters[2] != 0x45) return CEC_ABORT_REASON_INVALID_OPERAND; - // XXX this is also sent when the TV is powered off -#if 0 if (command.initiator == CECDEVICE_TV && command.parameters.At(3) == VL_UNKNOWN1) { - // set the power up event time + if (command.parameters.size >= 5 && command.parameters.At(4) == 0x05) { - CLockObject lock(m_mutex); - if (m_iPowerUpEventReceived == 0) - m_iPowerUpEventReceived = GetTimeMs(); + // set the power up event time + { + CLockObject lock(m_mutex); + if (m_iPowerUpEventReceived == 0) + m_iPowerUpEventReceived = GetTimeMs(); + } + // mark the TV as powered on + m_processor->GetTV()->SetPowerStatus(CEC_POWER_STATUS_ON); + + CCECBusDevice* dev = m_processor->GetPrimaryDevice(); + if (dev && dev->IsActiveSource()) + dev->TransmitActiveSource(false); + + return COMMAND_HANDLED; } - // mark the TV as powered on - m_processor->GetTV()->SetPowerStatus(CEC_POWER_STATUS_ON); } - else -#endif - if (command.initiator == CECDEVICE_TV && + else if (command.initiator == CECDEVICE_TV && command.destination == CECDEVICE_BROADCAST && command.parameters.At(3) == VL_POWER_CHANGE) { @@ -248,10 +253,15 @@ if (command.parameters.size == 3 && command.parameters[0] == 0x10 && command.parameters[1] == 0x01 && - command.parameters[2] == 0x05 && m_processor->IsHandledByLibCEC(command.destination)) { + // XXX i've seen 0x05 and 0x03 as third param. these probably indicate different types of TVs/capabilities + // when we feature abort this, then the TV will try the same thing with a vendor command with id SendVendorCommandCapabilities(m_processor->GetLogicalAddress(), command.initiator); + + CCECBusDevice* dev = m_processor->GetDevice(command.destination); + if (dev && dev->IsActiveSource()) + dev->ActivateSource(500); return COMMAND_HANDLED; } @@ -261,7 +271,7 @@ bool CVLCommandHandler::SourceSwitchAllowed(void) { if (!PowerUpEventReceived()) - TransmitRequestPowerStatus(m_processor->GetPrimaryDevice()->GetLogicalAddress(), CECDEVICE_TV, false); + TransmitRequestPowerStatus(m_processor->GetPrimaryDevice()->GetLogicalAddress(), CECDEVICE_TV, false, false); return PowerUpEventReceived(); } diff -Nru libcec-2.1.3/src/testclient/Makefile.in libcec-2.1.4/src/testclient/Makefile.in --- libcec-2.1.3/src/testclient/Makefile.in 2013-05-12 13:12:41.000000000 +0000 +++ libcec-2.1.4/src/testclient/Makefile.in 2013-12-14 00:03:04.000000000 +0000 @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -16,23 +16,6 @@ @SET_MAKE@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ - esac; \ - test $$am__dry = yes; \ - } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -101,11 +84,6 @@ am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(cec_client_SOURCES) DIST_SOURCES = $(cec_client_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -284,11 +262,8 @@ $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ - fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ diff -Nru libcec-2.1.3/src/testclient/main.cpp libcec-2.1.4/src/testclient/main.cpp --- libcec-2.1.3/src/testclient/main.cpp 2013-05-12 13:12:36.000000000 +0000 +++ libcec-2.1.4/src/testclient/main.cpp 2013-12-14 00:02:42.000000000 +0000 @@ -43,6 +43,7 @@ #include "../lib/platform/os.h" #include "../lib/implementations/CECCommandHandler.h" #include "../lib/platform/util/StdString.h" +#include "../lib/platform/threads/threads.h" using namespace CEC; using namespace std; @@ -52,6 +53,8 @@ #include "../../include/cecloader.h" +static void PrintToStdOut(const char *strFormat, ...); + ICECCallbacks g_callbacks; libcec_configuration g_config; int g_cecLogLevel(-1); @@ -63,8 +66,38 @@ bool g_bExit(false); bool g_bHardExit(false); CMutex g_outputMutex; +ICECAdapter* g_parser; + +class CReconnect : public PLATFORM::CThread +{ +public: + static CReconnect& Get(void) + { + static CReconnect _instance; + return _instance; + } + + virtual ~CReconnect(void) {} + + void* Process(void) + { + if (g_parser) + { + g_parser->Close(); + if (!g_parser->Open(g_strPort.c_str())) + { + PrintToStdOut("Failed to reconnect\n"); + g_bExit = true; + } + } + return NULL; + } + +private: + CReconnect(void) {} +}; -inline void PrintToStdOut(const char *strFormat, ...) +static void PrintToStdOut(const char *strFormat, ...) { CStdString strLog; @@ -186,8 +219,11 @@ switch (type) { case CEC_ALERT_CONNECTION_LOST: - PrintToStdOut("Connection lost - exiting\n"); - g_bExit = true; + if (!CReconnect::Get().IsRunning()) + { + PrintToStdOut("Connection lost - trying to reconnect\n"); + CReconnect::Get().CreateThread(false); + } break; default: break; @@ -1190,8 +1226,8 @@ g_config.deviceTypes.Add(CEC_DEVICE_TYPE_RECORDING_DEVICE); } - ICECAdapter *parser = LibCecInitialise(&g_config); - if (!parser) + g_parser = LibCecInitialise(&g_config); + if (!g_parser) { #ifdef __WINDOWS__ cout << "Cannot load libcec.dll" << endl; @@ -1199,19 +1235,19 @@ cout << "Cannot load libcec.so" << endl; #endif - if (parser) - UnloadLibCec(parser); + if (g_parser) + UnloadLibCec(g_parser); return 1; } // init video on targets that need this - parser->InitVideoStandalone(); + g_parser->InitVideoStandalone(); if (!g_bSingleCommand) { CStdString strLog; - strLog.Format("CEC Parser created - libCEC version %s", parser->ToString((cec_server_version)g_config.serverVersion)); + strLog.Format("CEC Parser created - libCEC version %s", g_parser->ToString((cec_server_version)g_config.serverVersion)); cout << strLog.c_str() << endl; //make stdin non-blocking @@ -1227,13 +1263,13 @@ if (!g_bSingleCommand) cout << "no serial port given. trying autodetect: "; cec_adapter devices[10]; - uint8_t iDevicesFound = parser->FindAdapters(devices, 10, NULL); + uint8_t iDevicesFound = g_parser->FindAdapters(devices, 10, NULL); if (iDevicesFound <= 0) { if (g_bSingleCommand) cout << "autodetect "; cout << "FAILED" << endl; - UnloadLibCec(parser); + UnloadLibCec(g_parser); return 1; } else @@ -1249,10 +1285,10 @@ PrintToStdOut("opening a connection to the CEC adapter..."); - if (!parser->Open(g_strPort.c_str())) + if (!g_parser->Open(g_strPort.c_str())) { PrintToStdOut("unable to open the device on port %s", g_strPort.c_str()); - UnloadLibCec(parser); + UnloadLibCec(g_parser); return 1; } @@ -1265,7 +1301,7 @@ getline(cin, input); cin.clear(); - if (ProcessConsoleCommand(parser, input) && !g_bSingleCommand && !g_bExit && !g_bHardExit) + if (ProcessConsoleCommand(g_parser, input) && !g_bSingleCommand && !g_bExit && !g_bHardExit) { if (!input.empty()) PrintToStdOut("waiting for input"); @@ -1277,8 +1313,8 @@ CEvent::Sleep(50); } - parser->Close(); - UnloadLibCec(parser); + g_parser->Close(); + UnloadLibCec(g_parser); if (g_logOutput.is_open()) g_logOutput.close();