Hello Nordic Dev Team!
Environment Details
Hardware | nRF52840 (dev kit for test, xiao-ble-sense for production) |
---|---|
NCS Version | v2.5.0 |
Host operating system | Windows 11 -- though should be OS-independent |
Objective
I am working on a wearable computer mouse for people with motor disabilities. I would like to enable configuration of mouse parameters like sensitivity, and many others, over BLE using HID Feature Reports.
We have a local app that can send and receive feature report data, so my main focus is on the NCS Input/Output flow of data.
The end-goal is to be able to have a bi-directional conversation with an application on the Host Computer. We will send a few kB (~2kB) of data to the host when requested -- which we expect to serialize into MTU-size chunks. We will also receive data sent to our device and store it in the device's persistent memory.
Why not just build your own service?
It would be really nice to just have a custom GATT Service to handle this, but we have two goals which make that more complicated.
- No local software installation required. We would like our device to work out-of-the-box without extensive setup required on our users' machines.
- We would like the configuration process of this mouse to be achievable using only our mouse. Therefore, it has to be connected as an HID Device while it is configured.
To make this happen, we are configuring the device via a Google Chrome Web App. Although Chrome can directly pair a device and access a service, this doesn't allow simultaneous configuration and operation of the device. Both Windows and Mac seem to have some security guardrails that prevent a web browser from connecting to services on a device that is also handling HID input to the host.
Resources
In this section, I list out resources that I've used to build my understanding of the system, both to cite my sources, and to create a resource for future readers of this post
1. [Chrome Dev WebHID] developer.chrome.com/.../webhid
2. DevZone Posts
1. ["Need an Example" (Bk37)] devzone.nordicsemi.com/.../need-an-hid-feature-report-example-using-zephyr
1. Points to post #2
2. ["Zephyr USB Feature reports"] devzone.nordicsemi.com/.../405636
1. Refer to nRF Desktop
2. [nRF Desktop Doc Link] docs.nordicsemi.com/.../README.html
3. ["Hid Report Desc Code File"] docs.nordicsemi.com/.../README.html
3. ["Need BLE HoG feature report sample"] devzone.nordicsemi.com/.../need-ble-hog-feature-report-sample
1. This user describes basically exactly what I want to do, says they figured it out, and then didn't say how they achieved their goals.
3. Tools for HID Feature Report Introspection
1. [HID Feature Report Explorer] nondebug.github.io/.../
1. Note: must run on chrome
4. Nordic Docs about Config Channel
1. [nRF Desktop Config Channel Docs] docs.nordicsemi.com/.../config_channel.html
2. [HID Service Module Doc Page] docs.nordicsemi.com/.../hids.html
Request for Guidance
While I work on an isolated and minimized sample, I'd like to ask for more general guidance about the behavior of the config channel in nRF Desktop.
- When I connect an nRF Desktop Peripheral with the config channel enabled in the prj.conf, then connect to it via the HID Feature Report Explorer, I am able to connect to the feature report service (which shows up as 1915:xxxx, with xs being either a keyboard or mouse identity, as configured).
- When I send data, if it begins with
06 06
, it is received in thehids.c
feature_report_handler
method, and I can log the data with a hex-dump, and observe incoming data from the tool. - If, after sending that data, I click the "receive" button, I get data back from the device, but I'm confused as to where that information is populated?
Conclusion
My most important questions, while I try to create a more concise and minimized example is this:
What is the correct way to utilize this system in the way I have described?
What resources would you recommend to better understand this system?
Thank you very much for your time and guidance.
- Finn