Skip to content

Commit

Permalink
Makes dbus signal handlers even more specific to avoid false positives
Browse files Browse the repository at this point in the history
  • Loading branch information
adriangranados committed Oct 6, 2024
1 parent 2dadb45 commit 92dd389
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
wlanpi-fpms (1.4.4-1) UNRELEASED; urgency=medium

* Improves reboot/shutdown detection by making signal handlers even more specific

-- Adrian Granados <adrian@intuitibits.com> Sun, 06 Oct 2024 09:15:51 -0500

wlanpi-fpms (1.4.4) unstable; urgency=medium

* Fixes "Reboot in progress" message shown when not rebooting
Expand Down
12 changes: 6 additions & 6 deletions fpms/fpms.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ def handle_prepare_for_shutdown(arg):
handle_reboot_or_shutdown()


# Handler for UnitNew signal
def handle_unitnew(*args):
log_to_syslog("UnitNew signal received")
# Handler for JobNew signal
def handle_jobnew(*args):
log_to_syslog("JobNew signal received")
for arg in args:
if isinstance(arg, str):
if ("reboot.target" in arg):
Expand Down Expand Up @@ -169,12 +169,12 @@ def run_dbus_loop():
path="/org/freedesktop/login1"
)

# Add a signal receiver for UnitNew signal from systemd1.Manager
# Add a signal receiver for JobNew signal from systemd1.Manager
# Handles (legacy) reboot
bus.add_signal_receiver(
handle_unitnew,
handle_jobnew,
dbus_interface="org.freedesktop.systemd1.Manager",
signal_name="UnitNew"
signal_name="JobNew"
)

log_to_syslog(f"event handlers added")
Expand Down

0 comments on commit 92dd389

Please sign in to comment.