Linux-enabled BLE HID peripheral

I am trying to develop a BLE HID peripheral that can be used on Ubuntu 24.04.

When I try to connect the peripheral_hids_mouse example to a Linux machine, it immediately disconnects and becomes unusable.

Is there any sample code that has been confirmed to work with Linux machines?
Or is this a problem specific to my environment?

I am using nRF52840DK and NCS 3.0.2.

The host Linux machine is a Lenovo ThinkPad T14s. It works fine with other Logitech devices.

  • flash_dump.hex

    The hex file has been dumped. Please check it.

    I'm using the nRF52833DK (an old 1.1.0 board, but that shouldn't be an issue here)

  • This is what I got from my attempt connecting to my computer:

    Using nRF Connect for Desktop, I got a popup for a split second, but then I saw that I needed to check of these options:

    Does it work in that case?

    If so, then the issue is probably that the OS (Ubuntu) doesn't use MITM for HID Mouse, and hence it doesn't bond successfully. 

    Let me know what you see, and we can look into it.

    Best regards,

    Edvin

  • I thought about it for a bit...

    peripheral_hids_mouse sample performs MITM authentication by displaying a key on the mouse device.

    However, mouse generally do not have the ability to display text. Linux machines also assume this,

    so I think they are configured not to perform MITM authentication with mice.

    It should probably work if you change the settings on your Linux machine and enable MITM regardless of the device.
    Fundamentally, the specification of peripheral_hids_mouse is probably incorrect.

  • Indeed. I agree.

    Can you try to add these to your prj.conf?

    CONFIG_BT_HIDS_SECURITY_ENABLED=n
    CONFIG_BT_SMP=y

    It still requires 

    But perhaps that is default in the ubuntu OS. Let me know if it doesn't work.

    Best regards,

    Edvin

  • As a result, I still couldn't connect to the Linux machine.

    Regular advertising started
    [00:00:04.936,492] <wrn> bt_smp: The in-progress pairing has been deleted!
    Disconnected from 14:5A:FC:4B:71:00 (public), reason 0x08

    The MITM popup is no longer displayed, but I still get immediately disconnected.
    There seems to be another problem...

    In conclusion, the title of this post indicates that there is a problem with the sample code, but I am still interested in the cause of this problem.
    It is probably the same cause as the mouse I am currently developing that cannot connect to a Linux machine.

Related