uilfut
Posts: 72
Joined: Sat Mar 03, 2018 1:20 am
Location: Toronto

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Wed Nov 06, 2019 11:01 pm

Yes, empty list of devices from hcitool dev

uilfut
Posts: 72
Joined: Sat Mar 03, 2018 1:20 am
Location: Toronto

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Wed Nov 06, 2019 11:42 pm

I just went through my command line history - the only things I did (when the kb stopped working) were to remove and reinstall bluez and blueman...

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2869
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Thu Nov 07, 2019 10:00 am

What does "systemctl status hciuart" report?

uilfut
Posts: 72
Joined: Sat Mar 03, 2018 1:20 am
Location: Toronto

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Thu Nov 07, 2019 11:27 am

● hciuart.service
Loaded: masked (Reason: Unit hciuart.service is masked.)
Active: inactive (dead)

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2869
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Thu Nov 07, 2019 11:31 am

OK - try "sudo systemctl enable --now hciuart", then run "systemctl status hciuart" and "hcitool dev".

uilfut
Posts: 72
Joined: Sat Mar 03, 2018 1:20 am
Location: Toronto

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Thu Nov 07, 2019 11:47 am

Code: Select all

pi@Pi4b:~ $ sudo systemctl enable --now hciuart
Failed to enable unit: Unit file /etc/systemd/system/hciuart.service is masked.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2869
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Thu Nov 07, 2019 11:59 am

OK - try:

Code: Select all

$ sudo systemctl unmask hciuart
$ sudo systemctl enable --now hciuart

User avatar
Douglas6
Posts: 4853
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Thu Nov 07, 2019 12:01 pm

I just confirmed: uninstalling BlueZ also masks and deletes hciuart.service. You're going to need to (re)install pi-bluetooth.

Code: Select all

sudo apt install pi-bluetooth 

uilfut
Posts: 72
Joined: Sat Mar 03, 2018 1:20 am
Location: Toronto

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Thu Nov 07, 2019 12:05 pm

Douglas6 wrote:
Thu Nov 07, 2019 12:01 pm
I just confirmed: uninstalling BlueZ also masks and deletes hciuart.service. You're going to need to (re)install pi-bluetooth.

Code: Select all

sudo apt install pi-bluetooth 
This did it... thank you both!

AdamPhillips
Posts: 1
Joined: Fri Nov 29, 2019 8:31 pm

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Tue Dec 03, 2019 5:38 pm

I am still getting the behaviour described in this post.

WiFi off, everything works just fine.

WiFi on my Bluetooth keyboard will drop out every 10 or so seconds.

Pi 4 with all packages upgraded.

roadfun
Posts: 3
Joined: Mon Jan 20, 2020 8:47 pm

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Mon Jan 20, 2020 8:53 pm

I've been searching the forum for updated info but didn't see anything.

As the previous poster said I am still having the issue initially described. I am using a new fully updated Pi 4 with 2GB of RAM.

One Bluetooth keyboard can't stay connected to the Pi 4 when WiFI is enabled. The other Bluetooth keyboard has no trouble staying connected by keypresses are sometimes delayed and often repeat a number of times. It seems like a timing issue in the chip or it's driver.

Has there been an update on this, other than "don't use WiFI and Bluetooth keyboards"?

williamc
Posts: 5
Joined: Wed Jan 22, 2020 12:35 pm

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Thu Jan 23, 2020 3:31 am

roadfun wrote:
Mon Jan 20, 2020 8:53 pm
I've been searching the forum for updated info but didn't see anything.

As the previous poster said I am still having the issue initially described. I am using a new fully updated Pi 4 with 2GB of RAM.

One Bluetooth keyboard can't stay connected to the Pi 4 when WiFI is enabled. The other Bluetooth keyboard has no trouble staying connected by keypresses are sometimes delayed and often repeat a number of times. It seems like a timing issue in the chip or it's driver.

Has there been an update on this, other than "don't use WiFI and Bluetooth keyboards"?
Did you guys try updating the EEPROM? This is a complete shot in the dark but I ran update and I saw it went from 3.3 to 4.0. My stupid Bluetooth remote (that mimics a keyboard and mouse) has connected pretty solidly to the RPI4.

roadfun
Posts: 3
Joined: Mon Jan 20, 2020 8:47 pm

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Thu Jan 23, 2020 3:15 pm

I checked and mine was already up-to-date.

Lulaso574
Posts: 37
Joined: Sat Nov 16, 2019 6:51 am

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Sat Mar 07, 2020 12:19 pm

I am having similar issues with my Pi.

I am running the latest version of Raspian and I already did apt update and upgrade but I lose connection to my phone within 2 seconds.

The bluetoothctl logs show that my phone (or any other phone, tried multiple) connect and exactly two seconds later I get disconnected.

Code: Select all

[CHG] Device E0:A3:AC:4D:0E:76 Connected: yes
[CHG] Device E0:A3:AC:4D:0E:76 Connected: no
Anyone got any idea why this is happening?

I am on Version 5.50.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2869
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Sat Mar 07, 2020 12:40 pm

What is your phone, and how are you connecting?

Lulaso574
Posts: 37
Joined: Sat Nov 16, 2019 6:51 am

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Sat Mar 07, 2020 1:43 pm

PhilE wrote:
Sat Mar 07, 2020 12:40 pm
What is your phone, and how are you connecting?
I tried with the Nexus 6P, Moto E5 and Moto G4 Plus. All exhibited the same issue.

First I made the Pi discoverable and then I connected directly by going into settings (on the Android phone) -> Bluetooth and then connecting to the Raspberry Pi.

I did get the do you want to pair notification on the Raspberry Pi but failed with no error on the Android side while on the Pi side I got some bluez.error (I cannot remember exactly, I am not near the Pi at the moment, I will post the exact error when I am close to it)

Then I tried an app called "Serial Bluetooth Terminal" (https://play.google.com/store/apps/deta ... h_terminal) and every time I tried to connect via that app I got an error saying:

Code: Select all

Connection failed: read failed, socket might closed or timeout, read ret: -1
While on the Raspberry Pi bluetoothclt logs I got (disconnect occurred two seconds later):

Code: Select all

[CHG] Device E0:A3:AC:4D:0E:76 Connected: yes
[CHG] Device E0:A3:AC:4D:0E:76 Connected: no

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2869
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Sat Mar 07, 2020 1:49 pm

Thanks. And what services do you want once the phone is connected, i.e. what are you trying to do?

Lulaso574
Posts: 37
Joined: Sat Nov 16, 2019 6:51 am

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Sat Mar 07, 2020 3:04 pm

PhilE wrote:
Sat Mar 07, 2020 1:49 pm
Thanks. And what services do you want once the phone is connected, i.e. what are you trying to do?
I actually wanted to create an Android and iPhone app that will connect to the Raspberry Pi using Bluetooth. I will pass three integers to the Pi, my Python script will capture those three integers on the Pi, run some code and return back another three integers to the app.

I just wanted to check if my phone is connecting to the Pi over Bluetooth before starting with the app, but it seems I am stuck on the first step.

If I try to connect to the Pi using my phone, I get the Bluez error. If I try to connect to my phone using the Bluetooth menu on the Pi, I get:

Code: Select all

Connection failed - No usable services on this device
So I am not able to connect from either side, but bluetoothctl shows does show that the devices (my phones) were connected to before disconnecting again in two seconds.

User avatar
Douglas6
Posts: 4853
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Sat Mar 07, 2020 4:14 pm

With an Android phone, you could use Bluetooth's Serial Port Profile to exchange serial data, however, you'll need to add it manually to your Pi (instructions exist on this forum.)

IOS doesn't support SPP, so you're out of luck on iPhones. It's a good situation to use BLE, but might be a steeper learning curve.

Lulaso574
Posts: 37
Joined: Sat Nov 16, 2019 6:51 am

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Sun Mar 08, 2020 5:06 am

Douglas6 wrote:
Sat Mar 07, 2020 4:14 pm
With an Android phone, you could use Bluetooth's Serial Port Profile to exchange serial data, however, you'll need to add it manually to your Pi (instructions exist on this forum.)

IOS doesn't support SPP, so you're out of luck on iPhones. It's a good situation to use BLE, but might be a steeper learning curve.

Yeah, I though the same about iPhones. I am fine with any kind of Bluetooth connection as long as I get my data, but have no idea why my phones keep disconnecting. Yesterday night I even tried reinstalling the whole Raspian, same issues showed up.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2869
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Sun Mar 08, 2020 8:54 am

My guess would be that the phone doesn't see any service it knows how to connect to, so it drops the connection, but we can remove some of the guess work by recording the traffic between the Pi and it's BT modem:

Code: Select all

$ sudo btmon -w capture.bts
This command will log all traffic to the file I've called capture.bts, simultaneously displaying a text version to the terminal. Hint: don't run this over a slow serial terminal, otherwise btmon won't be able to keep up - instead, send the text output to /dev/null:

Code: Select all

$ sudo btmon -w capture.bts >/dev/null
Once you've started the logging, attempt to connect your phone - you may want to try twice, to make sure the final packets of the first attempt are flushed out to the capture file. Then stop the capture - either Ctrl-C or "sudo killall btmon", depending on how you started it.

You can now read the log by converting it to a text file ("btmon -r capture.bts > capture.txt"), or upload it somewhere (Google Drive, DropBox etc.) so others can get it and interpret the traffic for you. The original .bts file is more useful than the textual version because there is some flexibility in how one displays the results, but just the text is probably enough to understand what's going on.

If you have an Android phone and can enable the developer features, you also have the option of enabling HCI logging (what btmon captures) on the device itself. Search for "android developer options" and "hci snoop log" for more details.

User avatar
Douglas6
Posts: 4853
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Sun Mar 08, 2020 5:42 pm

See if this post helps you to enable SPP on the Pi: viewtopic.php?f=63&t=143442&hilit=etc%2 ... ce#p947185. After adding SPP, you should be able to connect from a Bluetooth serial app on the phone. You can use Minicom as a serial terminal on the Pi, for now.

dave_p
Posts: 28
Joined: Sun Mar 04, 2012 2:11 pm

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Sat Mar 14, 2020 9:29 pm

It seems this issue has re-surfaced with the latest firmware update (firmware-brcm80211 1:20190114-1+rpt5). My Apple keyboard pairs OK but the Pi won't respond. btmon shows the keyboard continually connecting and timing out - sorry this board won't let me attach the log file.

Reverting to the +rpt4 version of the firmware fixes the issue.

This is on a Pi4 running fully apt-get updated Raspbian. I've tried both 32- and 64-bit kernels with the same result.

Lulaso574
Posts: 37
Joined: Sat Nov 16, 2019 6:51 am

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Sun Mar 15, 2020 1:04 pm

PhilE wrote:
Sun Mar 08, 2020 8:54 am
My guess would be that the phone doesn't see any service it knows how to connect to, so it drops the connection, but we can remove some of the guess work by recording the traffic between the Pi and it's BT modem:

Code: Select all

$ sudo btmon -w capture.bts
This command will log all traffic to the file I've called capture.bts, simultaneously displaying a text version to the terminal. Hint: don't run this over a slow serial terminal, otherwise btmon won't be able to keep up - instead, send the text output to /dev/null:

Code: Select all

$ sudo btmon -w capture.bts >/dev/null
Once you've started the logging, attempt to connect your phone - you may want to try twice, to make sure the final packets of the first attempt are flushed out to the capture file. Then stop the capture - either Ctrl-C or "sudo killall btmon", depending on how you started it.

You can now read the log by converting it to a text file ("btmon -r capture.bts > capture.txt"), or upload it somewhere (Google Drive, DropBox etc.) so others can get it and interpret the traffic for you. The original .bts file is more useful than the textual version because there is some flexibility in how one displays the results, but just the text is probably enough to understand what's going on.

If you have an Android phone and can enable the developer features, you also have the option of enabling HCI logging (what btmon captures) on the device itself. Search for "android developer options" and "hci snoop log" for more details.

Sorry about the late reply, I was stuck with other work in the office. Today is Sunday so I got some free time.

Here:
https://www.PasteBin.com/NGdP9ssJ

I am not an expert on reading Bluetooth logs so I have no idea what's going on. But here's what I did:

1. I tried connecting from my Nexus 6P to the Raspberry Pi.
2. I tried connecting from my Raspberry Pi to the Nexus 6P.
3. I tried connecting from my Raspberry Pi to the Nexus 6P once again.
4.I tried connecting from my Nexus 6P to the Raspberry Pi once again.

uilfut
Posts: 72
Joined: Sat Mar 03, 2018 1:20 am
Location: Toronto

Re: Raspbian buster bluetooth failure after 2019.09.16 update

Mon Mar 23, 2020 2:01 am

Yes broken for me again now :(

Logitech K380 keyboard will connect, then disconnect (exact same behaviour as before the fix 3 months ago)

Hoping someone can fix this again :)

Thanks in advance

Return to “Raspberry Pi OS”