1

NOTE: yes, I have looked at this question but I am not sure I am using a secure characteristic. To be honest, I can't find a clear explanation of what a secure characteristic is.

I am writing a simple webpage using html and javascript in order to read and change settings on my BLE device. The device acts as both a keyboard and mouse, but the settings are on a separate characteristic.

On Linux and Mac, the device is paired with the desktop, and this code works to connect:

        let filters = [];
        // this UUID is the specific UUID for my settings service
        filters.push({services: [MY_SERVICE]});

        let optionalServices = [];
        optionalServices.push(DEVICE_INFORMATION);

        let options = {};
        options.filters = filters;
        options.optionalServices = optionalServices;

        console.log('Requesting My device...');

        navigator.bluetooth.requestDevice(options).then(device => {
            savedDevice = device;
            return device;
        }).then...

It works on Chrome and Chromium on Ubuntu ( after using the chrome://flags/#enable-experimental-web-platform-features ), and on Chrome on MacOS. while I am in my web page, changing settings, I can still use the device as a mouse and keyboard and make adjustments.

HOWEVER, when I try this on Chrome on Windows (Or chromium based Edge), when the device is connected and working, my device is not seen in the pairing dialog which the browser puts up. In order to see it, I have to turn it off and on, and it looks like there is some sort of "race" as to whether the browser sees it first or the windows OS sees it and connects to it. If the browser sees it, I can connect and read and write settings, but while I am connected, the device is NOT working as either a mouse or a keyboard. Even when I disconnect the browser (and close it), the device does not function as a mouse or keyboard again (even if I turn it off and on) until I go into the Windows Bluetooth settings and remove it then re-pair with it.

Obviously, this behaviour is not something I would like to release, and since it works fine on Linux and Mac, I am inclined to think it is a Windows only issue.

Has anyone seen this sort of behaviour and found a workaround? Is the Chromium team working on a fix? I saw this link but I'm not sure it's the same thing, though it might be related, in any case, unclear to me if it's fixed, fixable or workaround-able.

I tried setting the Web Bluetooth permissions on the browser to "Enabled" as detailed here but that actually made the behaviour worse in that I couldn't connect at all. "Disabled" works as detailed above. Someone suggested it might be an issue with a particular Bluetooth chipset or driver, and I tried on a different Windows machine - same sort of "race" to allow the device to be seen by the browser, but once it was connected, I could still use it as a mouse and keyboard, as well as make changes to the settings (both Windows machines were running the most updated Win10 I could install).

Has anyone encountered and beaten this problem?

Thanks

Kibi
  • 1,860
  • 1
  • 29
  • 39
  • Can you include more information about your device? You mention that you can use it as a mouse and keyboard which makes me think it is some kind of human-interface device. Windows implements some restrictions on the GATT API when it comes to such devices and have run into issues like crbug.com/1065017 before. – Reilly Grant Aug 31 '21 at 18:22
  • Hi @ReillyGrant I'll check what I'm allowed to say - what information would help? It is a human-interface device, basically it acts as a mouse and a keyboard. Works fine generally with Windows, Mac and Linux – Kibi Sep 01 '21 at 09:16
  • If it is a custom device (not one we can buy to test) then that's probably all. CC yourself on crbug.com/1065017 as that will probably resolve the issue for you. – Reilly Grant Sep 03 '21 at 05:32
  • @ReillyGrant This is the device, made by my company: https://www.tapwithus.com/ anyone who wants to can buy it and try out what I described – Kibi Sep 12 '21 at 09:32

0 Answers0