Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix waydroid/weston crash #236

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions extras/extras/waydroid_monitor.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

pid=0

weston_pid=0
# Stop waydroid on exit if running
trap "exit" INT TERM
trap "kill 0" EXIT
Expand All @@ -10,12 +10,34 @@ while :
do
if [ -S ${XDG_RUNTIME_DIR}/snap.pyefis/pyefis-waydroid-1 ]; then
if (( pid == 0 )); then
echo "starting waydroid"
cmd=$(ps x|grep weston|grep -v grep|head -n 1)
regex='([0-9]+) .* --width=([0-9]+) --height=([0-9]+) '
if [[ "$cmd" =~ $regex ]]; then
weston_pid=${BASH_REMATCH[1]}
width=${BASH_REMATCH[2]}
height=${BASH_REMATCH[3]}
# Set waydroid resolution to match weston to prevent crash
waydroid prop set persist.waydroid.width ${width}
waydroid prop set persist.waydroid.width ${height}
echo "Set ${width}x${height}"
fi
# Wait a couple seconds to ensure weston is ready
sleep 2
export WAYLAND_DISPLAY=snap.pyefis/pyefis-waydroid-1
waydroid show-full-ui &
pid=$!
else
cmd=$(ps x|grep weston|grep -v grep|head -n 1)
regex='([0-9]+) .*'
if [[ "$cmd" =~ $regex ]]; then
new_weston_pid=${BASH_REMATCH[1]}
if [ $new_weston_pid -ne $weston_pid ]; then
echo "Killing waydroid pid for weston restart: ${pid}"
kill ${pid}
pid=0
weston_pid=$new_weston_pid
fi
fi
fi
else
if (( pid > 0 )); then
Expand Down
2 changes: 1 addition & 1 deletion src/pyefis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "2.0.21"
__version__ = "2.0.22"

4 changes: 2 additions & 2 deletions src/pyefis/screens/screenbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,8 @@ def setup_instruments(self,count,i,ganged=False,replace=None,state=False):
and 'row' in i \
and 'column' in i:
grid_x, grid_y, grid_width, grid_height = self.get_grid_coordinates( i['column'], i['row'])
weston_width = int(grid_width * i['span']['columns'])
weston_height = int(grid_height * i['span']['rows'])
weston_width = qRound(grid_width * i['span']['columns'])
weston_height = qRound(grid_height * i['span']['rows'])
# span rows/columns are required for weston to work properly and they need to be at least 200px x 200px
self.instruments[count] = weston.Weston(self,socket=i['options']['socket'],ini=os.path.join(self.parent.config_path,i['options']['ini']),command=i['options']['command'],args=i['options']['args'],wide=weston_width,high=weston_height)
else:
Expand Down
Loading