Can you configure nRF Desktop to be both a mouse and a keyboard at the same time?

I'm working on a new nRF52840 based design that will be both a HID keyboard and a touchpad in one - so I've been working with nRF Desktop for my nRF52840 devkit, trying to merge the prj_gmouse.conf prj_keyboard.conf files into one that will pretend to be both a mouse and a keyboard at the same time.

I figured it would report as a keyboard, and two of the devkit buttons would do the simulated button presses and the other two would do the simulated mouse motion thing - but what I've got now doesn't even show up on a Bluetooth scanner so clearly I've got it in a broken state.  See image below of my current prj.conf compared to the keyboard one.

Anyway - what is the right way, assuming it's even possible, to have one nRF52840 send both keyboard AND mouse information over HID?

Oh - I'm using VSCode and SDK 2.0.0 currently (though I can upgrade to the latest if that would help)

Thanks,

Glen

Parents Reply Children
  • It should be possible beginning with the keyboard configuration and then enable motion sensor, mouse report, etc. Then finally edit the key map to tell which key_ids should be configured as mouse buttons. 

    The mouse report will be transmitted along the standard keyboard reports.
    -Priyanka
  • Hi Glen,

    I was able to implement both mouse and keyboard on the nRF52840DK. It would be better to use simulated mouse or a motion sensor for the mouse(I tried with simulated mouse). This is because the default values of CONFIG_DESKTOP_MOTION_XXXXX_KEY_ID are set to zero and since you just have 4 buttons on the DK, the values can get duplicated for the cases in the switch for the key IDs.

    You can begin, as mentioned by adding motion required CONFIG to the prj_keyboard.conf. You can add the required motion configuration as mentioned here.

    Don't forget to add the following config:

    CONFIG_DESKTOP_HID_REPORT_MOUSE_SUPPORT=y
    CONFIG_DESKTOP_HID_MOUSE=y
    CONFIG_DESKTOP_HID_BOOT_INTERFACE_MOUSE=y
    If using simulated motion, then don't forget to add the configuration for either edge impulse(which should be a value which is the power of 2) or scale factor of the mouse motion. 
    Also, keep in mind to increase number of repots supported in hids: (the following is the default value in prj_keyboard.conf)
    CONFIG_BT_HIDS_INPUT_REP_MAX=3
    CONFIG_BT_HIDS_OUTPUT_REP_MAX=1
    CONFIG_BT_HIDS_FEATURE_REP_MAX=1
    CONFIG_BT_HIDS_ATTR_MAX=32

    And number of supported GATT characteristics:
    CONFIG_BT_GATT_UUID16_POOL_SIZE=47
    CONFIG_BT_GATT_CHRC_POOL_SIZE=17
    CONFIG_BT_CONN_TX_MAX  may need to be increased to prevent problems when device buffers multiple data packets in HIDS.
    Once all these are done, you should be able to build and flash onto your DK and observe the required output.
    -Priyanka
  • Thanks Priyanka - I'm glad you got it working - that gives me a lot of confidence that our project is possible. I'll try it out as soon as I can. If you don't mind I'll leave this issue open for now until I've had a chance to test it.

    Edit: This worked - I ended up using nRF Connect version 2.1.0. Some of the items in the .conf have changed with 2.2.0 (I'm sure it would be easy to reconcile but I'll stick with what's working now). Thanks!

Related