Keep weston service always on to support headless mode

Keep weston service always on regardless of the HDMI connection so
the GPU function is always supported.

The only exception is in system suspend/resume. Weston service is
stopped before suspend and restart after resume.

Change-Id: Ib39fc4d08a8ba0181b77a976ed575e2447f3c912
diff --git a/debian/etc/udev/scripts/hdmi_hotplug.sh b/debian/etc/udev/scripts/hdmi_hotplug.sh
deleted file mode 100755
index 5604d84..0000000
--- a/debian/etc/udev/scripts/hdmi_hotplug.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-HDMIStatus=$(cat /sys/class/drm/card0-HDMI-A-1/status)
-
-if [ $HDMIStatus == 'connected' ]; then
-	systemctl restart weston
-else
-	systemctl stop weston
-fi
diff --git a/debian/lib/systemd/system/weston-restart.service b/debian/lib/systemd/system/weston-restart.service
index a98b7f3..ce64245 100644
--- a/debian/lib/systemd/system/weston-restart.service
+++ b/debian/lib/systemd/system/weston-restart.service
@@ -4,7 +4,7 @@
 
 [Service]
 Type=simple
-ExecStart=/etc/udev/scripts/hdmi_hotplug.sh
+ExecStart=/bin/systemctl restart weston.service
 
 [Install]
 WantedBy=suspend.target
diff --git a/debian/lib/systemd/system/weston-stop.service b/debian/lib/systemd/system/weston-stop.service
new file mode 100644
index 0000000..b2d1283
--- /dev/null
+++ b/debian/lib/systemd/system/weston-stop.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Stop Weston before suspend
+Before=suspend.target
+
+[Service]
+Type=simple
+ExecStart=/bin/systemctl stop weston.service
+
+[Install]
+WantedBy=suspend.target
\ No newline at end of file
diff --git a/debian/rules b/debian/rules
index 323c248..da2effd 100755
--- a/debian/rules
+++ b/debian/rules
@@ -9,6 +9,3 @@
 
 override_dh_auto_test:
 	true
-
-override_dh_installudev:
-	dh_installudev --name=hdmi_hotplug --priority 99
diff --git a/debian/weston-mtk.hdmi_hotplug.udev b/debian/weston-mtk.hdmi_hotplug.udev
deleted file mode 100644
index d1e7e6e..0000000
--- a/debian/weston-mtk.hdmi_hotplug.udev
+++ /dev/null
@@ -1 +0,0 @@
-ACTION=="change", KERNEL=="card0", SUBSYSTEM=="drm", RUN+="/etc/udev/scripts/hdmi_hotplug.sh"
\ No newline at end of file