weston init cleanup (#117)

* weston: remove display re-init

* test

* init both

* increase

* another try

* move that

* test service

* little more

* bump kernel

* fix that
This commit is contained in:
Adeeb Shihadeh
2023-02-25 22:24:49 -08:00
committed by GitHub
parent b167fe3748
commit 2ffb16f7b8
10 changed files with 101 additions and 32 deletions
+11
View File
@@ -0,0 +1,11 @@
[Unit]
After=weston-ready.service
[Service]
Type=simple
User=comma
Restart=no
ExecStart=/bin/bash -c "source /etc/profile && /data/test_weston.py"
[Install]
WantedBy=multi-user.target
+1 -2
View File
@@ -1,6 +1,5 @@
[Unit]
Description=Comma tmux
After=weston.service gpio.service
After=weston-ready.service gpio.service
[Service]
Type=simple
+1
View File
@@ -1,5 +1,6 @@
[Unit]
Description=PulseAudio system server
After=weston-ready.service
[Service]
Type=simple
+22
View File
@@ -0,0 +1,22 @@
[Unit]
PartOf=weston.service
[Service]
Type=oneshot
Restart=no
Environment="XDG_RUNTIME_DIR=/var/tmp/weston"
ExecStart=/bin/echo "waiting for wayland socket"
ExecStart=/bin/bash -c "while [ ! -e \"$XDG_RUNTIME_DIR/wayland-0\" ]; do sleep 0.1; done"
# still starting after socket comes up
ExecStart=/bin/sleep 0.5
ExecStart=/bin/echo "fixing permissions"
ExecStart=/bin/bash -c "chmod -R 770 $XDG_RUNTIME_DIR"
ExecStart=/bin/echo "turning on display"
ExecStart=/bin/bash -c "echo 500 > /sys/class/backlight/panel0-backlight/brightness"
[Install]
WantedBy=multi-user.target
+20 -19
View File
@@ -1,28 +1,29 @@
[Unit]
Description=Weston
Conflicts=getty@tty1.service
After=systemd-user-sessions.service getty@tty1.service
# If we start weston immediately it just exits without an error
# TODO: Figure out what we need to wait for (drm?)
[Service]
Type=simple
Restart=always
Environment="XDG_RUNTIME_DIR=/var/tmp/weston"
# TODO: detect if display was brought up by bootloader
# Setting backlight to 0 while the screen is not initialized will turn off the regulators, 1023 turns it back on
ExecStart=/bin/bash -c "sleep 4 && \
echo 0 > /sys/class/backlight/panel0-backlight/brightness && \
sleep 0.1 && \
echo 1023 > /sys/class/backlight/panel0-backlight/brightness && \
/usr/comma/modetest -M msm_drm -s 26@111:1080x2160-60 && \
/usr/comma/modetest -M msm_drm -s 26@111:1080x2160-60 && \
sleep 1 && \
mkdir -p $XDG_RUNTIME_DIR && \
chown -R comma: $XDG_RUNTIME_DIR && \
mkdir -p /data/misc/display || true && \
echo 0 > /data/misc/display/sdm_dbg_cfg.txt || true && \
echo 0 > /data/misc/display/gbm_dbg_cfg.txt || true && \
/usr/bin/weston --idle-time=0 --tty=1 --config=/usr/comma/weston.ini"
Restart=no
KillSignal=SIGKILL
Environment="XDG_RUNTIME_DIR=/var/tmp/weston"
UtmpIdentifier=tty1
TTYPath=/dev/tty1
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
ExecStartPre=/bin/bash -c "mkdir -p $XDG_RUNTIME_DIR"
ExecStartPre=/bin/bash -c "chown -R comma: $XDG_RUNTIME_DIR"
ExecStartPre=/bin/bash -c "mkdir -p /data/misc/display || true"
ExecStartPre=/bin/bash -c "echo 0 > /data/misc/display/sdm_dbg_cfg.txt || true"
ExecStartPre=/bin/bash -c "echo 0 > /data/misc/display/gbm_dbg_cfg.txt || true"
ExecStartPre=/bin/chvt 1
ExecStart=/usr/bin/weston --idle-time=0 --tty=1 --config=/usr/comma/weston.ini
[Install]
WantedBy=multi-user.target
+5
View File
@@ -15,6 +15,7 @@ systemctl enable lte.service
systemctl enable sound.service
systemctl enable pulse.service
systemctl enable weston.service
systemctl enable weston-ready.service
systemctl enable wifi.service
systemctl enable init-qcom.service
systemctl enable power_drop_monitor.service
@@ -24,6 +25,10 @@ systemctl enable ssh-param-watcher.service
systemctl enable home.mount
systemctl enable logrotate-hourly.timer
# Disable some of our services
systemctl disable serial-hostname.service
systemctl disable agnos-tests.service
# Disable third party services
systemctl disable darkstat.service
systemctl disable vnstat.service
-9
View File
@@ -8,18 +8,9 @@ CONTINUE="/data/continue.sh"
INSTALLER="/tmp/installer"
RESET_TRIGGER="/data/__system_reset__"
echo "Waiting for wayland"
while [ ! -e "$XDG_RUNTIME_DIR/wayland-0" ]; do sleep 0.1; done
sleep 0.5 # weston's still starting after the socket's created
echo "wayland ready"
sudo chmod -R 770 $XDG_RUNTIME_DIR
sudo chown comma: /data
sudo chown comma: /data/media
sudo su -c "echo 500 > /sys/devices/platform/soc/ae00000.qcom,mdss_mdp/backlight/panel0-backlight/brightness"
handle_setup_keys () {
# install default SSH key while still in setup
if [[ ! -e /data/params/d/GithubSshKeys && ! -e /data/continue.sh ]]; then
-1
View File
@@ -1,7 +1,6 @@
#!/usr/bin/env python3
import json
import time
import pytest
import subprocess
def run(cmd):
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env python3
import os
import time
import hashlib
import subprocess
if __name__ == "__main__":
socket_exists = os.path.exists("/var/tmp/weston/wayland-0")
is_active = subprocess.check_output("systemctl is-active weston", shell=True, encoding='utf8').strip()
d = b""
for fn in ('/lib/systemd/system/weston.service', '/lib/systemd/system/weston-ready.service'):
with open(fn, 'rb') as f:
d += f.read()
h = hashlib.sha1(d).hexdigest()
# weston should be ready to go at this point
proc = subprocess.Popen('/usr/comma/setup', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
for i in range(10):
r = proc.poll()
if r is not None:
break
time.sleep(1)
rc = proc.returncode
proc.kill()
out, err = proc.stdout.read(), proc.stderr.read()
with open('/data/weston_log', 'a') as f:
f.write(f"{is_active=}, {socket_exists=}, app={rc} / {h}\n")
if rc is not None:
f.write(f" stdout: {out}\n")
f.write(f" stderr: {err}\n")
os.sync()
os.system("sudo su -c 'tail /data/weston_log > /dev/console'")
os.system("sudo su -c 'wc -l /data/weston_log > /dev/console'")
time.sleep(2)
os.system("sudo reboot")