Skip to content

Commit eef0a7e

Browse files
MarekPietarlubos
authored andcommitted
applications: nrf_desktop: Update HID state documentation
Change updates documentation of the HID state module to inform about selective HID report subscription handling. Jira: NCSDK-35718 Signed-off-by: Marek Pieta <[email protected]> Signed-off-by: Divya Pillai <[email protected]> Signed-off-by: Pekka Niskanen <[email protected]>
1 parent 13d36da commit eef0a7e

File tree

1 file changed

+32
-14
lines changed

1 file changed

+32
-14
lines changed

applications/nrf_desktop/doc/hid_state.rst

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ It is responsible for the following operations:
1212

1313
* Tracking the state of HID subscribers and HID input report subscriptions.
1414
The module can simultaneously handle HID input report subscriptions of multiple HID subscribers.
15-
The module provides HID input reports only to one subscriber (*active subscriber*).
16-
* Providing HID input reports to the active HID subscriber.
15+
The module provides HID input reports only to subscribers with the highest priority (*active subscribers*).
16+
* Providing HID input reports to the active HID subscribers.
1717
The module relies on HID report providers to aggregate the user input, form HID input reports, and submit a :c:struct:`hid_report_event`.
1818
The HID input reports can be formatted according to either HID report protocol or HID boot protocol.
1919
* Handling HID output reports.
@@ -40,18 +40,37 @@ For details related to HID configuration in the nRF Desktop, see the :ref:`nrf_d
4040
Number of supported HID subscribers
4141
===================================
4242

43+
A HID transport (for example, :ref:`nrf_desktop_hids` or :ref:`nrf_desktop_usb_state`) is a module that forwards HID reports to a HID host and forwards HID input report subscriptions of the HID host.
44+
In most cases, a HID transport registers a single HID subscriber that handles all HID input reports.
4345
If your application configuration supports more than one HID subscriber, you must align the maximum number of HID subscribers that can be handled simultaneously (:option:`CONFIG_DESKTOP_HID_STATE_SUBSCRIBER_COUNT`).
44-
For example, to use a configuration that allows to simultaneously subscribe to HID reports from HID over GATT (Bluetooth LE) and a single USB HID instance, set the value of this Kconfig option to ``2``.
46+
For example, to use a configuration that allows to simultaneously subscribe to HID input reports from HID over GATT (Bluetooth LE) and a single USB HID instance, set the value of this Kconfig option to ``2``.
4547

46-
If multiple HID subscribers are simultaneously connected, the |hid_state| selects the one with the highest priority as the active subscriber.
47-
The |hid_state| provides HID input reports only to the active subscriber.
48-
The |hid_state| displays the HID keyboard LED state associated with the active subscriber.
48+
Selective HID input report subscription
49+
---------------------------------------
4950

50-
By default, the subscriber that is associated with USB has priority over a subscriber associated with Bluetooth LE.
51-
As a result, if a HID host connects through the USB while another HID host is connected over the Bluetooth LE, the HID reports will be routed to the USB.
51+
In some cases, a single HID transport can register multiple HID subscribers.
52+
Every HID subscriber handles a subset of HID input reports.
53+
54+
For example, an nRF Desktop peripheral might use the USB selective HID report subscription feature to split HID input reports among multiple HID-class USB instances (every HID-class USB instance handles a predefined subset of HID input report IDs).
55+
For more details regarding the feature, see the :ref:`nrf_desktop_usb_state_hid_class_instance` documentation section of the USB state module.
56+
57+
Using selective HID input report subscription requires increasing the value of the :option:`CONFIG_DESKTOP_HID_STATE_SUBSCRIBER_COUNT` Kconfig option.
58+
For example, if a configuration allows simultaneously subscribing to HID input reports from HID over GATT (Bluetooth LE) and two USB HID instances, increase the value of the Kconfig option to ``3``.
59+
60+
HID subscriber priority
61+
-----------------------
62+
63+
If multiple HID subscribers are simultaneously connected, the |hid_state| selects the ones with the highest priority as the active subscribers.
64+
The |hid_state| provides HID input reports only to the active subscribers.
65+
The |hid_state| displays the HID keyboard LED state associated with the active subscriber of the HID keyboard input report.
66+
HID subscribers with the same priority cannot simultaneously subscribe to the same HID input report.
67+
68+
If a HID transport uses a selective HID input report subscription, all subscribers registered by the transport must share the same priority.
69+
Otherwise, subscribers with lower priority would not receive HID input reports from the HID state.
5270

5371
.. note::
54-
The subscriber priority must be unique, which means that two or more subscribers cannot share the same priority value.
72+
By default, a subscriber that is associated with USB has priority over a subscriber associated with Bluetooth LE.
73+
If a HID host connects through the USB while another HID host is connected over the Bluetooth LE, the HID reports will be routed to the USB.
5574

5675
HID keyboard LEDs
5776
=================
@@ -108,14 +127,13 @@ This section describes implementation details related to responsibilities of the
108127
Tracking state of HID subscribers
109128
=================================
110129

111-
A HID transport (for example :ref:`nrf_desktop_hids` or :ref:`nrf_desktop_usb_state`) is a module that forwards HID reports to a HID host and forwards HID subscriptions of the HID host.
112130
A HID transport reports the state of a HID subscriber using the :c:struct:`hid_report_subscriber_event`.
113131
When the connection to the HID host is indicated by this event, the |hid_state| will create an associated subscriber.
114132
The |hid_state| tracks the state of the HID subscribers.
115133

116134
As part of the :c:struct:`hid_report_subscriber_event`, the subscriber provides the following parameters:
117135

118-
* Subscriber priority - The |hid_state| provides HID input reports only to the subscriber with the highest priority (active subscriber).
136+
* Subscriber priority - The |hid_state| provides HID input reports only to subscribers with the highest priority (active subscribers).
119137
* Pipeline size - The |hid_state| forwards this information to the HID report providers.
120138
The information can be used, for example, to synchronize sensor sampling with sending the HID input reports to the HID host.
121139
See the :ref:`nrf_desktop_hid_mouse_report_handling` section for information how the pipeline size is used for HID mouse reports.
@@ -125,7 +143,7 @@ Tracking state of HID report subscriptions
125143
------------------------------------------
126144

127145
For each subscriber, the |hid_state| tracks the state of HID input report subscriptions.
128-
The HID input reports are only provided after the active subscriber enables the subscription.
146+
The HID input reports are only provided after one of the active subscribers enables the subscription.
129147
The subscriber updates its HID report subscriptions using a :c:struct:`hid_report_subscription_event`.
130148

131149
The HID report subscriptions are tracked in the subscriber's structure :c:struct:`subscriber`.
@@ -213,5 +231,5 @@ HID output reports
213231
When the |hid_state| receives a :c:struct:`hid_report_event` that contains a HID output report, it updates the stored information about the state of the HID output report of the appropriate subscriber.
214232

215233
By default, nRF Desktop supports only HID keyboard LED output report.
216-
The nRF Desktop peripheral displays the state of the keyboard LEDs that was specified by the active HID subscriber.
217-
When the active subscriber is changed or it updates the state of the keyboard LEDs, the |hid_state| sends :c:struct:`leds_event` to update the state of the hardware LEDs.
234+
The nRF Desktop peripheral displays the state of the keyboard LEDs that was specified by the active HID subscriber of a HID keyboard input report.
235+
When the subscriber changes or updates the state of the keyboard LEDs, the |hid_state| sends a :c:struct:`leds_event` to update the state of the hardware LEDs.

0 commit comments

Comments
 (0)