Skip to content

Commit

Permalink
Make bluetooth_agent use python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahshader authored and linknum23 committed Mar 20, 2023
1 parent 5effbe9 commit bee84bf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion config/bluetooth/bluetooth_agent.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Wants=bluetooth.service

[Service]
ExecStartPre=/bin/sh -c "echo discoverable on | bluetoothctl"
ExecStart=/usr/bin/python -u /usr/local/bin/bluetooth_agent
ExecStart=/usr/bin/python3 -u /usr/local/bin/bluetooth_agent
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=bluetooth_agent
Expand Down
7 changes: 2 additions & 5 deletions streams/bluetooth_agent
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#!/usr/bin/python
#!/usr/bin/python3
# https://gist.github.com/Pindar/e259bec5c3ab862f4ff5f1fbcb11bfc1

""" Handles pairing and authorization of Bluetooth devices. The following agent
allows the Raspberry Pi to automatically pair and accept A2DP, HFP, HSP and
AVRCP connections from Bluetooth devices. """

from __future__ import absolute_import, print_function, unicode_literals

import dbus
import dbus.mainloop.glib
import dbus.service
Expand Down Expand Up @@ -34,8 +32,7 @@ class Agent(dbus.service.Object):
if self.exit_on_release:
mainloop.quit()

@dbus.service.method(AGENT_INTERFACE,
in_signature="os", out_signature="")
@dbus.service.method(AGENT_INTERFACE, in_signature="os", out_signature="")
def AuthorizeService(self, device, uuid):
print(f"AuthorizeService ({device}, {uuid})")
if uuid.lower() == "0000110d-0000-1000-8000-00805f9b34fb":
Expand Down

0 comments on commit bee84bf

Please sign in to comment.