phony
phony copied to clipboard
Phone disconnects after a couple of seconds of pairing.
Using the example.py, i'm able to get quite far, however i run into the following issue where my phone disconnects only after a few seconds of trying to connect.
2022-05-09 11:24:58.883 phony.headset.HandsFreeHeadset INFO <- HandsFreeHeadset.enable_pairability()
2022-05-09 11:25:14.145 phony.bluetooth.adapters.bluez5.Bluez5 DEBUG ** Bluez5.properties_changed(org.bluez.Device1, dbus.Dictionary({dbus...)
2022-05-09 11:25:14.145 phony.bluetooth.adapters.bluez5.Bluez5 INFO Device: /org/bluez/hci0/dev_44_*** Connected
2022-05-09 11:25:14.147 phony.headset.HandsFreeHeadset INFO ** HandsFreeHeadset._device_connected(44:*** Joe’s iPhone)
2022-05-09 11:25:14.150 phony.bluetooth.profiles.handsfree.ofono.Ofono DEBUG -> Ofono.attach_audio_gateway(8C:88:2B:40:60:E5 raz-board, 44:***...)
2022-05-09 11:25:14.150 phony.bluetooth.profiles.handsfree.ofono.Ofono DEBUG <- Ofono.attach_audio_gateway(8C:88:2B:40:60:E5 raz-board, 44:***...)
2022-05-09 11:25:15.156 phony.bluetooth.profiles.handsfree.ofono.Ofono DEBUG -> Ofono._poll_for_child_hfp_modem(8C:88:2B:40:60:E5 raz-board, 44:***...)
2022-05-09 11:25:21.062 phony.bluetooth.adapters.bluez5.Bluez5 DEBUG ** Bluez5.properties_changed(org.bluez.Device1, dbus.Dictionary({dbus...)
2022-05-09 11:25:21.062 phony.bluetooth.adapters.bluez5.Bluez5 INFO Device: /org/bluez/hci0/dev_44*** Disconnected
I've tried several different capabilities, none of which give me the pincode option. I do get a passcode though, but after hitting the pair button, it fails and disconnects.
I managed to connect the phone via bluetoothctl, it required i authorize some of the services via the ctl, maybe thats why the example didnt work? Test seems to have a loopback of the audio, debugging that now
So when i authorize services via bluetoothctl, it works, however the source of speaker and microphone switches to phone, which doesnt seem to be working. when i go into settings and switch it back to speaker and microphone, it works. I'm wondering if there is a misconfiguration with the phone source that is assigned during a call.
@joessu I think when you authorize via bluetoothctl, it does so using a new agent that is independent of anything that would be started by this library. That probably doesn't automatically set up the hands free profile you're looking for, which could explain the reason you have to manually modify some settings--is that on your phone, or on the computer?
From your description, it's hard to say why the phone shortly disconnects from the agent started by the example (and what bluetoothctl is doing differently) but the places to dig up more information would be in the bluez and ofono logs. It's been a while, but I think if you're using systemd it's something like journalctl -u bluetoothctl.service
and for ofono IIRC, you pass -d
when starting ofonod.
Thanks for the info, I set bluetooth-agent instead of simple-agent as the default agent, that works much better and doesnt require the above steps to have the phone connect and stay connected. I think timing in the example is still a bit odd as ofono doesnt find a child modem unless my phone is already connected.