Rework mapviewer and mapviewer-demo 43/19043/3
authorScott Murray <scott.murray@konsulko.com>
Fri, 7 Dec 2018 16:53:32 +0000 (11:53 -0500)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Thu, 20 Dec 2018 21:10:18 +0000 (21:10 +0000)
Rework the mapviewer and mapviewer-demo recipes to get mapviewer
working out of the box for the cluster demo:
- Remove the old on/off scripts, as the intent is that the cluster
  demo work out of the box on an image built with the
  agl-cluster-demo-support feature.
- The separate weston systemd unit has been replaced with a drop-in
  over-ride file.
- A new systemd unit is installed to configure the network connection
  to the cluster board. This is required now because the weston unit
  no longer runs as root.
- A systemd drop-in is added to have afm-api-windowmanager@.service
  depend on weston-ready. This is a bit of a workaround ATM, as the
  windowmanager service was consistently failing due to Weston
  taking longer to start with the gst-record feature enabled. It is
  likely that making this more generic should be investigated.
- The mapviewer systemd unit has been updated.  Its Install target
  is now afm-user-session@.target; in my testing this seemed the
  least invasive solution, as there are some dependency loop issues
  that currently prevent adding it to multi-user.target. As well,
  its dependencies have been updated from weston and HomeScreen to
  afm-api-windowmanager@, which is not entirely ideal, but is about
  the best that can be done ATM given that mapviewer interacts with
  the other windowmanager users via Weston, but is not an app
  framework application.

Change-Id: I8826e670ae156edd461cc657acefc86e7836a916
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
recipes-demo-hmi/navigation/mapviewer-demo.bb
recipes-demo-hmi/navigation/mapviewer-demo/mapviewer-demo-network-conf.service [new file with mode: 0644]
recipes-demo-hmi/navigation/mapviewer-demo/switch_off_mapviewer-demo.sh [deleted file]
recipes-demo-hmi/navigation/mapviewer-demo/switch_on_mapviewer-demo.sh [deleted file]
recipes-demo-hmi/navigation/mapviewer-demo/weston-mapviewer-demo.conf [new file with mode: 0644]
recipes-demo-hmi/navigation/mapviewer-demo/weston-mapviewer-demo.service [deleted file]
recipes-demo-hmi/navigation/mapviewer-demo/weston-ready.conf [new file with mode: 0644]
recipes-demo-hmi/navigation/mapviewer/mapviewer.service [changed mode: 0755->0644]
recipes-demo-hmi/navigation/mapviewer_%.bbappend

index fe89770..95910da 100644 (file)
@@ -1,5 +1,5 @@
-SUMMARY     = "Setting files of mapviewer for the AGL Demonstrator @ CES2017"
-DESCRIPTION = "Setting files of mapviewer for the AGL Demonstrator @ CES2017"
+SUMMARY     = "Setting files of mapviewer for the AGL Demonstrator"
+DESCRIPTION = "Setting files of mapviewer for the AGL Demonstrator"
 LICENSE     = "MIT"
 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
 
@@ -8,35 +8,36 @@ SECTION     = "apps"
 inherit systemd
 
 SRC_URI = " \
-        file://switch_off_mapviewer-demo.sh \
-        file://switch_on_mapviewer-demo.sh \
         file://weston-mapviewer-demo.ini \
-        file://weston-mapviewer-demo.service \
-        "
+        file://weston-mapviewer-demo.conf \
+        file://weston-ready.conf \
+        file://mapviewer-demo-network-conf.service \
+"
 
 do_install() {
-    # Map viewer demo
-    install -d ${D}/usr/AGL/${PN}
-    install -m 0755 ${WORKDIR}/switch_off_${PN}.sh ${D}/usr/AGL/${PN}
-    install -m 0755 ${WORKDIR}/switch_on_${PN}.sh ${D}/usr/AGL/${PN}
-
+    # Install tweaked weston configuration
     install -d ${D}${sysconfdir}/xdg/weston
     install -m 0644 ${WORKDIR}/weston-${PN}.ini ${D}${sysconfdir}/xdg/weston/weston-${PN}.ini
 
-    install -d ${D}${systemd_system_unitdir}
-    install -m 0644 ${WORKDIR}/weston-mapviewer-demo.service ${D}${systemd_system_unitdir}
-    sed -i "s:/home/root:${ROOT_HOME}:" ${D}${systemd_system_unitdir}/weston-mapviewer-demo.service
+    # Install weston service unit configuration over-ride drop-in
+    install -d ${D}${systemd_system_unitdir}/weston.service.d
+    install -m 0644 ${WORKDIR}/weston-mapviewer-demo.conf ${D}${systemd_system_unitdir}/weston.service.d
+
+    # Install cluster demo network configuration service unit
+    install -m 0644 ${WORKDIR}/mapviewer-demo-network-conf.service ${D}${systemd_system_unitdir}
+    # Add symlink to network.target.wants
+    install -d ${D}${sysconfdir}/systemd/system/network.target.wants
+    ln -s ${systemd_system_unitdir}/mapviewer-demo-network-conf.service ${D}${sysconfdir}/systemd/system/network.target.wants/
+
+    # Workaround for now to ensure that the windowmanager and its dependencies
+    # start after weston, which takes longer with gst-record enabled.
+    # This should be investigated a bit further and likely reworked into
+    # something more generically applicable.
+    install -d ${D}${sysconfdir}/systemd/system/afm-api-windowmanager@.service.d
+    install -m 0644 ${WORKDIR}/weston-ready.conf ${D}${sysconfdir}/systemd/system/afm-api-windowmanager@.service.d
 }
 
-## DO NOT ENABLE 'weston-mapviewer-demo.service' BY DEFAULT
-##
-## The 'weston-mapviewer-demo.service' is exclusive of default 'weston.ini',
-## it should be enabled/disabled by 'switch_on_mapviewer-demo.sh'/'switch_off_mapviewer-demo.sh'.
-##
-#SYSTEMD_SERVICE_${PN} = "weston-mapviewer-demo.service"
-
 FILES_${PN} += " \
-    ${systemd_system_unitdir} \
-    /usr/AGL/${PN}/ \
-    ${sysconfdir}/xdg/weston/${PN} \
-    "
+       ${sysconfdir}/xdg/weston/ \
+       ${systemd_system_unitdir} \
+"
diff --git a/recipes-demo-hmi/navigation/mapviewer-demo/mapviewer-demo-network-conf.service b/recipes-demo-hmi/navigation/mapviewer-demo/mapviewer-demo-network-conf.service
new file mode 100644 (file)
index 0000000..1a6e2d8
--- /dev/null
@@ -0,0 +1,15 @@
+[Unit]
+Description=Configure dedicated link for cluster demo network
+After=sys-subsystem-net-devices-eth1.device
+Requires=sys-subsystem-net-devices-eth1.device
+Before=network.target
+
+[Service]
+# Note that this is done as opposed to using connman as configuring an
+# interface on a second network separate from the rest of the interfaces
+# is non-trivial in connman and needs further investigation.
+ExecStart=/sbin/ifconfig eth1 192.168.20.93
+Type=oneshot
+
+[Install]
+WantedBy=network.target
diff --git a/recipes-demo-hmi/navigation/mapviewer-demo/switch_off_mapviewer-demo.sh b/recipes-demo-hmi/navigation/mapviewer-demo/switch_off_mapviewer-demo.sh
deleted file mode 100755 (executable)
index 22fa16c..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-/bin/systemctl disable weston-mapviewer-demo.service
-/bin/systemctl enable weston.service
-/bin/systemctl disable mapviewer.service
diff --git a/recipes-demo-hmi/navigation/mapviewer-demo/switch_on_mapviewer-demo.sh b/recipes-demo-hmi/navigation/mapviewer-demo/switch_on_mapviewer-demo.sh
deleted file mode 100755 (executable)
index f61cdc7..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-/bin/systemctl disable weston.service
-/bin/systemctl enable weston-mapviewer-demo.service
-/bin/systemctl enable mapviewer.service
-
diff --git a/recipes-demo-hmi/navigation/mapviewer-demo/weston-mapviewer-demo.conf b/recipes-demo-hmi/navigation/mapviewer-demo/weston-mapviewer-demo.conf
new file mode 100644 (file)
index 0000000..8bccffd
--- /dev/null
@@ -0,0 +1,11 @@
+[Unit]
+# Add dependency on network, since the recorder feature requires it
+After=network.target
+Requires=network.target
+
+[Service]
+# GSM?
+ExecStartPre=/bin/sleep 2
+# Replace default ExecStart line with one that uses the cluster demo specific ini
+ExecStart=
+ExecStart=/usr/bin/weston --idle-time=0 --tty=1 --gst-record --config=weston-mapviewer-demo.ini --log=/run/platform/display/weston.log
diff --git a/recipes-demo-hmi/navigation/mapviewer-demo/weston-mapviewer-demo.service b/recipes-demo-hmi/navigation/mapviewer-demo/weston-mapviewer-demo.service
deleted file mode 100644 (file)
index 65275cc..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-[Unit]
-Description=Weston reference Wayland compositor
-Conflicts=getty@tty1.service
-After=dbus.service rc.pvr.service
-
-[Service]
-ExecStartPre=/sbin/ifconfig eth0 192.168.20.93
-ExecStartPre=/bin/rm -rf /home/root/.cache/gstreamer-1.0
-#ExecStartPre=/bin/sleep 10
-ExecStart=/usr/bin/weston-launch -u root -- --idle-time=4294967 --gst-record --config=weston-mapviewer-demo.ini
-ExecStop=/usr/bin/killall -s KILL weston
-Type=simple
-
-[Install]
-WantedBy=multi-user.target
-Alias=weston.service
diff --git a/recipes-demo-hmi/navigation/mapviewer-demo/weston-ready.conf b/recipes-demo-hmi/navigation/mapviewer-demo/weston-ready.conf
new file mode 100644 (file)
index 0000000..e90eed5
--- /dev/null
@@ -0,0 +1,4 @@
+[Unit]
+Requires=weston-ready.service
+After=weston-ready.service
+
old mode 100755 (executable)
new mode 100644 (file)
index c7baae7..971327c
@@ -1,22 +1,22 @@
 [Unit]
-Conflicts=getty@tty1.service
-After=weston.service HomeScreen.service
+Requires=afm-api-windowmanager@0.service
+After=afm-api-windowmanager@0.service
 
-# map viewr is a child application which can work with navigation.
+# mapviewer is a child application which can work with navigation.
 # This app requires mapdata. It has to be stored at /var/mapdata/navi_data_UK .
-# currently the position to be shown is 384x368 surface on screen 1 for CES2017 cluster demo.
+# currently the position to be shown is 384x368 surface on screen 1 for cluster demo.
 
 [Service]
+Environment="XDG_RUNTIME_DIR=/run/platform/display"
 ExecStartPre=/bin/sleep 5
 ExecStart=/usr/bin/mapview
 ExecStartPost=/usr/bin/LayerManagerControl create layer 11001 1920 1080
 ExecStartPost=/usr/bin/LayerManagerControl set layer 11001 visibility 1
 ExecStartPost=/usr/bin/LayerManagerControl set screen 1 render order 11001
 ExecStartPost=/usr/AGL/mapviewer/mapviewer-settings.sh
-
 ExecStop=/usr/bin/killall -s KILL mapview
 Type=simple
 Restart=always
 
 [Install]
-WantedBy=default.target
+WantedBy=afm-user-session@.target
index 4e89af0..a559708 100644 (file)
@@ -3,30 +3,23 @@ FILESEXTRAPATHS_append := ":${THISDIR}/${PN}"
 SRC_URI_append = "\
     file://mapviewer-settings.sh \
     file://mapviewer.service \
-    "
+"
 
 inherit systemd
 
 SYSTEMD_PACKAGES = "${PN}"
 
 do_install_append() {
-    install -d ${D}/usr/AGL/${PN}
-    install -m 0755 ${WORKDIR}/mapviewer-settings.sh ${D}/usr/AGL/${PN}/
+    install -d ${D}${prefix}/AGL/${PN}
+    install -m 0755 ${WORKDIR}/mapviewer-settings.sh ${D}${prefix}/AGL/${PN}/
 
-    # Install systemd unit files
+    # Install systemd unit file
     if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
-        install -d ${D}${systemd_user_unitdir}
-        install -m 644 -p -D ${WORKDIR}/mapviewer.service ${D}${systemd_user_unitdir}/mapviewer.service
+        install -d ${D}${systemd_system_unitdir}
+        install -m 644 ${WORKDIR}/mapviewer.service ${D}${systemd_system_unitdir}/mapviewer.service
     fi
 }
 
-## DO NOT ENABLE 'weston-mapviewer-demo.service' BY DEFAULT
-##
-## This should be enabled/disabled by 'switch_on_mapviewer-demo.sh'/'switch_off_mapviewer-demo.sh'.
-##
-#SYSTEMD_SERVICE_${PN} = "mapviewer.service"
+SYSTEMD_SERVICE_${PN} = "mapviewer.service"
 
-FILES_${PN} += " \
-    ${systemd_user_unitdir}/mapviewer.service \
-    /usr/AGL/mapviewer/ \
-    "
+FILES_${PN} += "${prefix}/AGL/${PN}/"