Skip to content

Commit cf1812d

Browse files
author
Lars Falk-Petersen
committed
Improve stability of BT connection, by reconnecting.
1 parent 9d7ef5a commit cf1812d

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

bluedo/bluedoapp.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
class BlueDo(Gtk.Application):
2323
project_name = 'bluedo'
24-
project_version = 2.3
24+
project_version = 2.4
2525
config_path = appdirs.user_config_dir(project_name) + '/' + project_name + '.ini'
2626
config_section = 'CONFIG'
2727
run_path = os.path.dirname(os.path.realpath(__file__)) + '/'
@@ -615,6 +615,8 @@ def bluetooth_ping(self, here_callback, away_callback):
615615
syslog.syslog("No connection")
616616
if lost_pings > 0:
617617
syslog.syslog("Lost %s" % lost_pings)
618+
if lost_pings%5 == 0:
619+
attempt_bluetooth_connection(self.bt_address)
618620

619621
if self.enabled:
620622
lost_pings += 1
@@ -674,6 +676,11 @@ def away_callback(self):
674676
# Static functions
675677
#
676678

679+
def attempt_bluetooth_connection(device):
680+
""" Sometimes ubuntu seems to not reconnect automatically. """
681+
syslog.syslog("Attempting to start a bluetooth connection.")
682+
subprocess.run(f"/usr/bin/bluetoothctl connect {device} > /dev/null", shell=True, check=False)
683+
677684
def run_user_command(cmd=''):
678685
''' Run user supplied command '''
679686
syslog.syslog("Running user command <%s>." % cmd)

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
bluedo (2.4) unstable; urgency=medium
2+
3+
* Reach out to bluetooth device if not connected.
4+
5+
-- Lars Falk-Petersen <dev@falkp.no> Sun, 09 Jul 2023 00:00:00 +0200
6+
17
bluedo (2.1) unstable; urgency=medium
28

39
* Clear viewport before replacing demo animation with static picture. Minimum gtk 3.22. Move settings link to look OK when using large font. Other small changes.

debian/copyright

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
22
Source: https://github.com/ways/BlueDo/blob/master/LICENSE
33

44
Files: *
5-
Copyright: 2020-2022 Lars Falk-Petersen <dev@falkp.no>
5+
Copyright: 2020-2023 Lars Falk-Petersen <dev@falkp.no>
66
License: GPL-3+

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
# Specify the Python versions you support here.
4747
'Programming Language :: Python :: 3',
4848
'Programming Language :: Python :: 3.10',
49+
'Programming Language :: Python :: 3.11',
4950
"Topic :: Desktop Environment",
5051
"Topic :: Desktop Environment :: Gnome",
5152
"Topic :: Security",

0 commit comments

Comments
 (0)