Skip to content

Commit

Permalink
Fix poweroff/reboot to make it work when zynthian service is active b…
Browse files Browse the repository at this point in the history
…ut not processing CUIA (broken).
  • Loading branch information
jofemodo committed Feb 22, 2024
1 parent 37d9e55 commit a5442c1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/zynthian_config_handler.py
Expand Up @@ -28,6 +28,7 @@
import liblo
import logging
import tornado.web
from time import sleep
from subprocess import check_output

import zynconf
Expand Down Expand Up @@ -137,21 +138,21 @@ def power_off(self):
try:
if self.is_service_active("zynthian"):
liblo.send(zynthian_ui_osc_addr, "/CUIA/POWER_OFF")
else:
system("killall -SIGQUIT zynthian_gui.py; sleep 4; poweroff")
sleep(5)
system("killall -SIGQUIT zynthian_gui.py; sleep 5; poweroff")
except Exception as e:
logging.error("Power Off: {}".format(e))


def reboot(self):
try:
if self.is_service_active("zynthian"):
liblo.send(zynthian_ui_osc_addr, "/CUIA/REBOOT")
else:
system("killall -SIGINT zynthian_gui.py; sleep 4; reboot")
self.reboot_ui_flag = False
if os.path.isfile(self.reboot_ui_flag_fpath):
os.remove(self.reboot_ui_flag_fpath)
if self.is_service_active("zynthian"):
liblo.send(zynthian_ui_osc_addr, "/CUIA/REBOOT")
sleep(5)
system("killall -SIGINT zynthian_gui.py; sleep 5; reboot")
except Exception as e:
logging.error("Reboot: {}".format(e))

Expand Down

0 comments on commit a5442c1

Please sign in to comment.