BT Keyboard Fails to connect H96 Pro + CE 9.0.1 [WORKAROUND FOUND]

Logs http://ix.io/1GpI from Amazon Basics Bluetooth Keyboard
I have been trying to connect a Harmony Hub remote (which behaves like a BT keyboard) to my device for much of the day.
In the process I have confirmed that BT headphones connect without error and that a real BT keyboard also fails with the same UI error report and log entries.
I have stepped through the various parts of the pairing and connection process which involve using
bluetoothctl to discover, pair, trust and connect to the device. The last part fails and scrutiny of the logs show this from either the command line or the Kodi GUI:
Apr 16 16:42:09 Winchy bluetoothd[2983]: Refusing input device connect: No such file or directory (2)
Apr 16 16:42:09 Winchy bluetoothd[2983]: Refusing connection from 90:7F:61:94:39:30: unknown device
Apr 16 16:42:31 Winchy bluetoothd[2983]: Can’t get HIDP connection info
Apr 16 16:42:31 Winchy kernel: Bluetooth: HIDP (Human Interface Emulation) ver 1.2
Apr 16 16:42:31 Winchy kernel: Bluetooth: HIDP socket layer initialized
Apr 16 16:42:31 Winchy bluetoothd[2983]: Rejected connection from unknown device 90:7F:61:94:39:30
GUI:
2019-04-16 16:42:31.265 T:3623867184 ERROR: ## CoreELEC Addon ## bluetooth::dbus_error_handler ## ERROR: (Operation not permitted)

It may not be apparent from the logs but I have installed the u-boot update from https://github.com/CoreELEC/u-boot.git

Suggestions for resolving this issue would, of course, be welcome.

Thank you.

WORKAROUND:
When ethernet connection is used at startup, the onboard bluetooth is not initialized. In such a case, use a cheap USB Bluetooth adapter supported by CE such as one based on the CSR8510 (use CSR8510 as a search term on Amazon to find them for $6-$12).

I have the same issue with the N2 and harmony Hub, I had it working for a hole day then after suspend it would not connect again.
When I got the Harmony for the N2 I also had a hard time connecting I used several hours.
I have no problem with ATV4 bluetooth connection I believe it is CE that has issues.

Thanks. I could have hoped for a quick fix, but with the N2 a ‘current area of interest’ perhaps this issue can get some developer attention.

Hi,
i got the same issue since about a month. my setup is a harmony elite (hub) with a mecool m8s pro L.
Used to work perfectly and suddenly stopped working. upon trying to connect to harmony keyboard (from kodi -> coreelec -> bluetooth) it says “operation not permitted”. tried everything but no luck so far.

Was there an update near that time? Can you pin down the date? It should be possible to identify the first version where this issue appeared, if so. I see that 9.0.1 was released Feb26, I don’t know when you might have updated, but could that be when it began to fail?

I was going to ask if there is anyone running current software where the harmony hub (BT connection) still works? (What platform, what version, please.)

Is the issue restricted to S912 based platforms, just a few such devices or all BT connections on all CoreElec targets?

It appears that the release notes reference the branch of the release and the previous release which does not yield a useful list of commits in the official release since modifications continue on the ‘released’ branch. Instead, you have to find the tags (not hard) and construct your own comparison in git/github.
The URL below shows the commits between the release tags for 9.0.0 and 9.0.1

That said, the easier check is to run 9.0.0 on a different sd card and see if it works (which I will do).

@Bergdoktor, I tried a clean run with a 9.0.0 card and it worked after a few false starts:

  1. Did not disconnect ethernet cable, so it downloaded the update to 9.0.1 before I could make the update manual, then continued to with update despite setting it to manual. Reflashed the card to 9.0.0 and disconnected ethernet.
  2. I enabled bluetooth and restarted. The bluetooth device began working, seeing other nearby devices. This is a difference from 9.0.1.
  3. I paired and connected an Amazon Basics BT keyboard by typing the key that appeared on the Kodi screen.
  4. I failed to connect the Harmony Hub because the hub thought it was already paired. There was much flashing of devices on the Bluetooth screen. I had to delete the Microsoft-Kodi device from the Harmony Hub software and recreate it to kill the stale half-pairing and then reconnect it to the activity to try again.
  5. After 4, pairing worked immediately.

Concerned that I might have done something that prevented it from working under 9.0.1, I reflashed the test SD card to 9.0.1 release and found that it failed.

I should note that I earlier failed to mention the first sign of problems with Bluetooth 9.0.1 and H96 Pro+, the after enabling bluetooth in the CoreElec settings and restarting, bluetooth is still reported as disabled.

Previously, I found that I could enable the Bluetooth service in an ssh session, but it ultimately did not work for keyboards, though it was sufficient for headphones.

For completeness, I tried the 9.0-20190421 Nightly build on the off chance that the issue introduced in the 9.0.1 release was corrected. No joy. It failed to enable Bluetooth in the same way.

As this is a simple to reproduce issue, at least on my box, I will pursue that as the ‘bug’ for my report. I suspect that it will probably resolve or point to the fix for the issues that occur when I manually enabled bluetooth from the ssh session.

I have an update to this and have it working solid for almost 3 days now with lots of suspends and reboots just to test it.
I extended the bluetooth dongle with a gooseneck 10 cm from the box pointing towards the hub which is behind the sofa 4m away, so my issue might have been bad wireless connection or something interfering the signal, but I do really need more time to say it for sure but so far it looks really good.
So try moving things around to see if you guys have the same experience.

Further testing has refined my understanding of this issue AND A WORKAROUND for it.

First, the 9.0.0 CE exhibits the same issue when the test conditions are correct. Previously, I erroneously indicated that it worked.

The controlling issue between ‘working’ and ‘non-working’ on the H95 Pro + is whether or not there is an active ethernet connection at startup.

That is, if ethernet is connected at startup to the 1Gb port, the onboard Bluetooth is not initialized and appears disabled under Settings->CoreElec->Bluetooth regardless of the setting of Settings->CoreElec->Services->BlueTooth->Enable.

If ethernet is unconnected at startup, Bluetooth works and can be used for BT Keyboards/Harmony Hub.

This is almost certainly a software error of fairly long standing. My reason to believe that is that using ethernet does not disable existing bluetooth connections. That is, once the device is paired and connected, one can connect and use the ethernet connection without issue and continue to use the bluetooth connection until the system is rebooted. Then it reverts to being ‘disabled’ regardless of the UI setting.

WORKAROUND: When using an ethernet connection on this device, use a USB Bluetooth adapter supported by CE such as one based on the CSR8510 (use CSR8510 as a search term on Amazon to find them for $6-$12).

Having found a workaround and wanting to play with my new N2, I am done with this specific issue.

Thanks a lot for narrowing down the issue! Didn’t have the time yet to do the steps you described on my end. I did try pairing via ssh a while ago
but this seems to confirm it is actually a bug with newer versions.
I will report back after I tried with ethernet disconnected and/or a suitable bt-dongle

@Bergdoktor, the other thing that might not be obvious is that if Harmony Hub thinks it is connected but the device (Kodi Box) does not agree, the Bluetooth device display will be very chaotic, like it is broken.

The only way I found to clear that issue in Harmony Hub was to delete and recreate the device (as Microsoft/KODI) and re-add it to any activities. It seems only when it is new do you get the pairing screen on the mobile Harmony app and only then can you make a new connection.

Just a quick update: booting without ethernet didn’t work for me. Using a 3rd party bt dongle however did.

My second BT Dongle just arrived (I had not anticipated using my first on the H96) and I am seeing similar problems with N2 (which has no native BT), at least so far as it admits the device exists, but then pretends it is still disabled.

I begin to suspect that Bluetooth support is not a strong point of CoreElec.:grinning:
Update: I pulled the dongle out an plugged it in again, now it is all better. Apologies to CoreElec for the shade.

I am glad you are having success with yours. Did you ever say which board you are using?

I’m using an mecool m8s pro l (912) box. I’d love to get to the bottom of this, but am struggling to find the time to do more research or isolating different symptoms.
I’m not experiencing 100% the same symptoms as you are, but the steps seems very similar and the solution worked as well. Just an example:

-I did experience the “Bluetooth appears disabled”, but it has been working fine for months.
-Pairing different Bluetooth devices works fine all the time
-harmony app always prompted me to go through the pairing ever since the bt stopped working.
-rebooting without ethernet plugged in gave me no difference
Etc…

Might find some time over the weekend to do more experimenting (disabling Bluetooth devices via ssh and stuff)

For now: thanks again for documenting your issue so well. I hope a dev might take a look at it

Thanks for the additional information. I wish you luck with your further investigations.
One background comment, which may not be news to you.:
Since Bluetooth and WiFi B/G operate in the same frequency range and can use the same antennas, they are often served by the same chip. When they are not, they tend to interfere, so the coupling tends to be pretty tight.
When the WiFi is disabled/enabled it is easy to mistakenly disable or corrupt the initialization of the Bluetooth part of the component.

I suspect something of the sort is going on in my case where, for some reason, there is no visible access to wifi, whether or not Ethernet is in use. There are hints that this may be because the module that supports it is closed source and not compiled for the current ABI, but that is unclear.
It may also mean that lacking the wifi component, the BT side is not properly and robustly initialized either. Some default access is present under some circumstances.

Your issues may be entirely different, but adding a well supported device such as the CSR8510 can clearly fix a multitude of sins just by avoiding the sketchy implementation of the fairly random chipset included in these boxes.

Again, good luck.

Still going strong here moving the dongle away from the box worked instantly, I’m not saying there aren’t anything wrong with the bluetooth implementation, but what crossed my mind is I also had/have a Logitech K400+ keyboard connected with it’s ovn dongle connected side by side with the CSR8510, so moving those apart helped me big time.

Yes, Logitech runs in the same spectrum as Bluetooth and B/G Wifi, so it could interfere. My Bluetooth dongle works fine directly plugged into the N2, at least for now. That might support the idea of interference with the Logitech.
You could further test your suspicion by switching which adapter is plugged into the device and which to the extension cable. If it works equally well, then the proximity of the two would seem to be the critical issue rather than some interference from the device itself or of the device ‘shadowing’ the bluetooth dongle.