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

Phone disconnects after a couple of seconds of pairing. #17

Open
joessu opened this issue May 9, 2022 · 4 comments
Open

Phone disconnects after a couple of seconds of pairing. #17

joessu opened this issue May 9, 2022 · 4 comments

Comments

@joessu
Copy link

joessu commented May 9, 2022

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.

@joessu
Copy link
Author

joessu commented May 9, 2022

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

@joessu
Copy link
Author

joessu commented May 9, 2022

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.

@mutac
Copy link
Member

mutac commented May 10, 2022

@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.

@joessu
Copy link
Author

joessu commented May 10, 2022

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.

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

No branches or pull requests

2 participants