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

Bluetooth LE watchAdvertisements doesn't work on Linux Ubuntu + Chrome while it works on Android or Windows #794

Open
gregoiregentil opened this issue Feb 27, 2023 · 8 comments

Comments

@gregoiregentil
Copy link

A clean install of Ubuntu 22.04 LTS with the latest version of Google Chrome as of February 2023 such as 110, watchAdvertisements doesn't work in the sense that no device is seen. There is no error on the page https://googlechrome.github.io/samples/web-bluetooth/watch-advertisements-and-connect.html, it just says:

> Requested AutoCamera`
Getting existing permitted Bluetooth devices...
> Got 1 Bluetooth devices.
Watching advertisements from "AutoCamera"...

The same page on Android or on Windows 10 (even with an old Google Chrome) is working, it lists the advertisements and successfully connects to the device.

Once again, a live ISO of Ubuntu 22.04 LTS with google-chrome.deb installed shows up the problem.

@gregoiregentil gregoiregentil changed the title device.watchAdvertisements doesn't work on Linux Ubuntu + Chrome while it works on Android or Windows Bluetooth LE watchAdvertisements doesn't work on Linux Ubuntu + Chrome while it works on Android or Windows Feb 27, 2023
@beaufortfrancois
Copy link
Member

@gregoiregentil
Copy link
Author

gregoiregentil commented Feb 27, 2023

OK. Thank you.

I'm using Linux+Chrome for development purpose. The page says that "GATT Server Connect" is supported. But I tried device.gatt.connect() on the response of navigator.bluetooth.requestDevice() but it doesn't succeed. Once again, the same device is connected from Windows + chrome upon reception of the Advertisement watch.

I'm in a case which I own the device with its Gatt server. Is there a way to manage to connect to a BLE device from Linux+Chrome without using scanLE and without watch advertisement?

@beaufortfrancois
Copy link
Member

Does this help?

If you own the device, can you expose the GATT Battery Service and try https://googlechrome.github.io/samples/web-bluetooth/battery-level-async-await.html?

@gregoiregentil
Copy link
Author

Ubuntu 22.04 is way beyond kernel 3.19 and BlueZ 5.41. I'm on Ubuntu 20.04 (kernel 5.15 and bluez 5.53) and I can connect to the device from a plain C application.

request device works and I get a structure such as {deviceId: 'ui5gjtwifKM+.....', name: 'AutoCamera'}. But the connect() fails.

And the connect works in Android.

I really would like to make this work because it will save me a lot of time to work on Linux+Chrome.

@gregoiregentil
Copy link
Author

The error in Linux is "connect error: DOMException: Connection Error: Connection attempt failed."

@beaufortfrancois
Copy link
Member

Could you file a web bluetooth bug at https://crbug.com/new and follow https://www.chromium.org/developers/how-tos/file-web-bluetooth-bugs/#linux instructions?

@gregoiregentil
Copy link
Author

I'm not totally sure of my own implementation of the Gatt server on my device, but the same "very simple" page works on Android and fails on Linux. And it also works in a native Android java app, as well as in a native Linux C app.

I have emailed you a full log report (to fbe....com)

@beaufortfrancois
Copy link
Member

beaufortfrancois commented Feb 28, 2023

As shared by email, it looks like a Bluez issue:

= bluetoothd: 70:2C:1F:6C:81:4A: error updating services: Connection refused (111)

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