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

bluetooth: reinitialize dbus #2221

Merged
merged 1 commit into from
Dec 12, 2023
Merged

Conversation

lasers
Copy link
Contributor

@lasers lasers commented Nov 30, 2023

I wonder if it is a race condition. Untested. Trying to catch this exception.

Closes #2218.

@lasers
Copy link
Contributor Author

lasers commented Dec 1, 2023

@lasers lasers force-pushed the bluetooth-reinit branch 2 times, most recently from d1fe718 to 82b7cc8 Compare December 1, 2023 23:21
@syyyr
Copy link
Contributor

syyyr commented Dec 2, 2023

Okay, your patch almost works, but it needed this patch:

diff --git a/py3status/modules/bluetooth.py b/py3status/modules/bluetooth.py
index cb9a8638..a7b36371 100644
--- a/py3status/modules/bluetooth.py
+++ b/py3status/modules/bluetooth.py
@@ -130,7 +130,7 @@ class Py3status:
                 self.py3.log(" --- SUCCESS ---")
             except GLib.Error as err:
                 self.py3.log(" --- FAILED ---")
-                if err.matches(Gio.io_error_quark(), Gio.DBusError.SERVICE_UNKNOWN):
+                if err.matches(Gio.dbus_error_quark(), Gio.DBusError.SERVICE_UNKNOWN):
                     self._dbus_init()
                     self.py3.log(" --- MATCHED ---")
                 else:

If we want to match the dbus error, we must get the dbus error quark instead of io error quark

@lasers lasers force-pushed the bluetooth-reinit branch 2 times, most recently from 4a489f4 to 92b76c6 Compare December 4, 2023 06:48
@syyyr
Copy link
Contributor

syyyr commented Dec 4, 2023

Just FYI, as of now (92b76c6), the PR works for me.

@lasers
Copy link
Contributor Author

lasers commented Dec 4, 2023

OK. The next one should be same. I think retrying loop might be unnecessary since trying it once should be enough... and if it failed for some reason, giving it some time for the next one (10s) should be more than enough. I'm guessing the post_config_hook method isn't covered in py3status module error retries.

EDIT: You can use this for a while... Once you confirm it's working fine, I'll squash the commit and we call it a day.

@syyyr
Copy link
Contributor

syyyr commented Dec 4, 2023

I have tested again, and it works. I'll use this for a bit and then get back to you after a week or so to confirm that the issue didn't reappear.

Thank you!

@syyyr
Copy link
Contributor

syyyr commented Dec 11, 2023

Hi, I haven't had any problems for the past week, so I think the patch is correct.

@lasers lasers marked this pull request as ready for review December 11, 2023 13:07
@ultrabug ultrabug merged commit 2f81ae9 into ultrabug:master Dec 12, 2023
5 checks passed
@ultrabug
Copy link
Owner

Thanks!

@lasers lasers deleted the bluetooth-reinit branch December 12, 2023 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bluetooth module fails on wake up from suspend
3 participants