Skip to contentSkip to conversation

XBMC enhancements (branch yem/misc-features)

PATCH New Yann E. MORIN 4 participants 6 messages Sep 1, 2014 – Sep 6, 2014

lore
Share & tools
lore
#0 lore raw

cover XBMC enhancements (branch yem/misc-features)

Hello All!

Two small enhancements to XBMC:
- wait for an X-server when needed
- enable/disable the RSXS screen saver

Regards,
Yann E. MORIN.

The following changes since commit fcd720dfcf702d796fbc625b9abc4c06cb848d84:

Update for 2014.08 (2014-09-01 13:20:56 +0200)

are available in the git repository at:

git://gitorious.org/buildroot/buildroot.git yem/misc-features

for you to fetch changes up to 698b2e4019db6d62c78b18c03e455fc08c65659c:

package/xbmc: add option to enable RSXS screensaver (2014-09-01 14:28:17 +0200)

----------------------------------------------------------------
Yann E. MORIN (2):
package/xbmc: enhance startup script package/xbmc: add option to enable RSXS screensaver

 package/xbmc/Config.in |  9 +++++++++
 package/xbmc/S50xbmc   |  3 +--
 package/xbmc/br-xbmc   | 15 +++++++++++++--
 package/xbmc/xbmc.mk   | 14 ++++++++++++++
 4 files changed, 37 insertions(+), 4 deletions(-)
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#1 lore raw

PATCH 1/2 package/xbmc: enhance startup script

Now that we can run XBMC with full openGL, it needs an X server to be running, so it has to wait for it before running.

So, we create a config file (in /etc/default/xbmc) in which we store whther to wait for an X server or not. All options to XBMC are now hard-coded in our br-xbmc wrapper, not unlike we're doing for the systemd unit.

Then, if it has to wait for X, our own br-xbmc wrapper will do the waiting. We do it as thus, because we can not do it in the startup script.

---
Note: as I don't know how to do dependencies in systemd, I did not change our systemd unit. It can be done by any systemd-savy interested party! ;-)

---
 package/xbmc/S50xbmc |  3 +--
 package/xbmc/br-xbmc | 15 +++++++++++++--
 package/xbmc/xbmc.mk | 10 ++++++++++
 3 files changed, 24 insertions(+), 4 deletions(-)
package/xbmc/S50xbmc +1 -2
index 312452b..6190b2f 100755
@@ -5,12 +5,11 @@
 
 BIN=/usr/bin/br-xbmc
 XBMC=/usr/lib/xbmc/xbmc.bin
-XBMC_ARGS="--standalone -fs -n"
 PIDFILE=/var/run/xbmc.pid
 
 start() {
 	echo -n "Starting XBMC: "
-	start-stop-daemon -S -q -b -m -p $PIDFILE --exec $BIN -- $XBMC $XBMC_ARGS
+	start-stop-daemon -S -q -b -m -p $PIDFILE --exec $BIN -- $XBMC
 	[ $? == 0 ] && echo "OK" || echo "FAIL"
 }
 stop() {
package/xbmc/br-xbmc +13 -2
index fee5d51..27fa32a 100755
@@ -3,7 +3,18 @@
 # We're called with the real XBMC executable as
 # first argument, followed by any XBMC extra args
 XBMC="${1}"
-shift
+
+# Parse XBMC options
+[ -f /etc/default/xbmc ] && . /etc/default/xbmc
+
+if [ -n "${WAIT_FOR_X}" ]; then
+    export DISPLAY=:0.0
+    while ! xset q >/dev/null 2>&1; do
+        sleep 1
+    done
+    # Wait yet a bit more in case it terminates with the last client
+    sleep 1
+fi
 
 # In case someone asked we terminate, just kill
 # the XBMC process
@@ -21,7 +32,7 @@ while [ ${LOOP} -eq 1 ]; do
     # for it. But BusyBox' ash's wait builtin does not return the
     # exit code even if there was only one job (which is correct
     # for POSIX). So we explicitly wait for the XBMC job
-    "${XBMC}" "${@}" &
+    "${XBMC}" --standalone -fs -n &
     wait %1
     ret=$?
     case "${ret}" in
package/xbmc/xbmc.mk +10 -0
index bdd634e..87b81c4 100644
@@ -219,6 +219,15 @@ define XBMC_INSTALL_BR_WRAPPER
 endef
 XBMC_POST_INSTALL_TARGET_HOOKS += XBMC_INSTALL_BR_WRAPPER
 
+# When using full openGL (as opposed to EGL/GLES),
+# there must be a running X server
+ifeq ($(BR2_PACKAGE_XBMC_GL),y)
+define XBMC_WAIT_FOR_X
+	$(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/default
+	printf "WAIT_FOR_X=1\n" >$(TARGET_DIR)/etc/default/xbmc
+endef
+endif
+
 # When run from a startup script, XBMC has no $HOME where to store its
 # configuration, so ends up storing it in /.xbmc  (yes, at the root of
 # the rootfs). This is a problem for read-only filesystems. But we can't
@@ -233,6 +242,7 @@ XBMC_POST_INSTALL_TARGET_HOOKS += XBMC_INSTALL_CONFIG_DIR
 define XBMC_INSTALL_INIT_SYSV
 	$(INSTALL) -D -m 755 package/xbmc/S50xbmc \
 		$(TARGET_DIR)/etc/init.d/S50xbmc
+	$(XBMC_WAIT_FOR_X)
 endef
 
 define XBMC_INSTALL_INIT_SYSTEMD
Signature · 1 line
1.9.1
#2 lore raw

PATCH 1/2 package/xbmc: enhance startup script

Dear Yann E. MORIN,

Quoted 11 lines · Yann E. MORIN

Now that we can run XBMC with full openGL, it needs an X server to be running, so it has to wait for it before running.

So, we create a config file (in /etc/default/xbmc) in which we store whther to wait for an X server or not. All options to XBMC are now hard-coded in our br-xbmc wrapper, not unlike we're doing for the systemd unit.

Then, if it has to wait for X, our own br-xbmc wrapper will do the waiting. We do it as thus, because we can not do it in the startup script.

Waiting for X to start seems a bit clunky. Why not instead use the X mechanisms (.Xsession, or other initialization files) to let X start XBMC when X is ready?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH 2/2 package/xbmc: add option to enable RSXS screensaver

In reply to Yann E. MORIN
---
 package/xbmc/Config.in | 9 +++++++++
 package/xbmc/xbmc.mk   | 4 ++++
 2 files changed, 13 insertions(+)
package/xbmc/Config.in +9 -0
index ebe0882..ed0d4ed 100644
@@ -138,6 +138,15 @@ config BR2_PACKAGE_XBMC_GOOM
 comment "goom needs an OpenGL backend"
 	depends on !BR2_PACKAGE_XBMC_GL
 
+config BR2_PACKAGE_XBMC_RSXS
+	bool "rsxs screensaver"
+	depends on BR2_PACKAGE_XBMC_GL
+	help
+	  Enable goom screensaver
+
+comment "rsxs needs an OpenGL backend"
+	depends on !BR2_PACKAGE_XBMC_GL
+
 config BR2_PACKAGE_XBMC_LIBCEC
 	bool "hdmi cec"
 	depends on !BR2_PREFER_STATIC_LIB # libcec
package/xbmc/xbmc.mk +4 -0
index 87b81c4..8bcad00 100644
@@ -88,6 +88,7 @@ ifeq ($(BR2_PACKAGE_XBMC_GL),y)
 XBMC_DEPENDENCIES += libglew libglu libgl sdl_image xlib_libX11 xlib_libXext \
 	xlib_libXmu xlib_libXrandr xlib_libXt
 XBMC_CONF_OPT += --enable-gl --enable-sdl --enable-x11 --enable-xrandr --disable-gles
+ifeq ($(BR2_PACKAGE_XBMC_RSXS),y)
 # fix rsxs compile
 # make sure target libpng-config is used, options taken from rsxs-0.9/acinclude.m4
 XBMC_CONF_ENV += \
@@ -99,6 +100,9 @@ XBMC_CONF_ENV += \
 	mac_cv_pkg_libs="`$(STAGING_DIR)/usr/bin/libpng-config --libs`"
 XBMC_CONF_OPT += --enable-rsxs
 else
+XBMC_CONF_OPT += --disable-rsxs
+endif
+else
 XBMC_CONF_OPT += --disable-gl --disable-rsxs --disable-sdl --disable-x11 --disable-xrandr
 ifeq ($(BR2_PACKAGE_XBMC_EGL_GLES),y)
 XBMC_DEPENDENCIES += libegl libgles
Signature · 1 line
1.9.1
#4 lore raw

PATCH 2/2 package/xbmc: add option to enable RSXS screensaver

"Yann E. MORIN" <[email protected]> wrote in news:698b2e4019db6d62c78b18c03e455fc08c65659c.1409588958.git.yann.morin.199 8 at free.fr:

Quoted 1 line
Signed-off-by "Yann E. MORIN" <yann.morin.1998-

[email protected]>

Quoted 31 lines
Cc Bernd Kuhls <[email protected]>
---
 package/xbmc/Config.in | 9 +++++++++
 package/xbmc/xbmc.mk   | 4 ++++
 2 files changed, 13 insertions(+)
package/xbmc/Config.in +9 -0
index ebe0882..ed0d4ed 100644
@@ -138,6 +138,15 @@ config BR2_PACKAGE_XBMC_GOOM
 comment "goom needs an OpenGL backend"
      depends on !BR2_PACKAGE_XBMC_GL
 
+config BR2_PACKAGE_XBMC_RSXS
+     bool "rsxs screensaver"
+     depends on BR2_PACKAGE_XBMC_GL
+     help
+       Enable goom screensaver
+
+comment "rsxs needs an OpenGL backend"
+     depends on !BR2_PACKAGE_XBMC_GL
+
 config BR2_PACKAGE_XBMC_LIBCEC
      bool "hdmi cec"
      depends on !BR2_PREFER_STATIC_LIB # libcec
package/xbmc/xbmc.mk +0 -0
index 87b81c4..8bcad00 100644

package/xbmc/xbmc.mk ifeq ($(BR2_PACKAGE_XBMC_GL),y) · line 88

Quoted 1 line
package/xbmc/xbmc.mk +0 -0
@@ -88,6 +88,7 @@ ifeq ($(BR2_PACKAGE_XBMC_GL),y)
 XBMC_DEPENDENCIES += libglew libglu libgl sdl_image xlib_libX11 

xlib_libXext \

package/xbmc/xbmc.mk ifeq ($(BR2_PACKAGE_XBMC_GL),y) · line 90

Quoted 2 lines
package/xbmc/xbmc.mk +0 -0
      xlib_libXmu xlib_libXrandr xlib_libXt
 XBMC_CONF_OPT += --enable-gl --enable-sdl --enable-x11 --enable-xrandr 

--disable-gles

package/xbmc/xbmc.mk ifeq ($(BR2_PACKAGE_XBMC_GL),y)

Quoted 3 lines
package/xbmc/xbmc.mk +1 -0
+ifeq ($(BR2_PACKAGE_XBMC_RSXS),y)
 # fix rsxs compile
 # make sure target libpng-config is used, options taken from rsxs-

0.9/acinclude.m4

package/xbmc/xbmc.mk XBMC_CONF_ENV += \ · line 106

Quoted 9 lines
package/xbmc/xbmc.mk +3 -0
 XBMC_CONF_ENV += \
@@ -99,6 +100,9 @@ XBMC_CONF_ENV += \
      mac_cv_pkg_libs="`$(STAGING_DIR)/usr/bin/libpng-config --libs`"
 XBMC_CONF_OPT += --enable-rsxs
 else
+XBMC_CONF_OPT += --disable-rsxs
+endif
+else
 XBMC_CONF_OPT += --disable-gl --disable-rsxs --disable-sdl --disable-x11 

--disable-xrandr

package/xbmc/xbmc.mk XBMC_CONF_ENV += \ · line 108

Quoted 2 lines
package/xbmc/xbmc.mk +0 -0
 ifeq ($(BR2_PACKAGE_XBMC_EGL_GLES),y)
 XBMC_DEPENDENCIES += libegl libgles