You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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]>
Copy file name to clipboardExpand all lines: applications/nrf_desktop/doc/hid_state.rst
+32-14Lines changed: 32 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,8 +12,8 @@ It is responsible for the following operations:
12
12
13
13
* Tracking the state of HID subscribers and HID input report subscriptions.
14
14
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.
17
17
The module relies on HID report providers to aggregate the user input, form HID input reports, and submit a :c:struct:`hid_report_event`.
18
18
The HID input reports can be formatted according to either HID report protocol or HID boot protocol.
19
19
* Handling HID output reports.
@@ -40,18 +40,37 @@ For details related to HID configuration in the nRF Desktop, see the :ref:`nrf_d
40
40
Number of supported HID subscribers
41
41
===================================
42
42
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.
43
45
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``.
45
47
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
+
---------------------------------------
49
50
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.
52
70
53
71
.. 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.
55
74
56
75
HID keyboard LEDs
57
76
=================
@@ -108,14 +127,13 @@ This section describes implementation details related to responsibilities of the
108
127
Tracking state of HID subscribers
109
128
=================================
110
129
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.
112
130
A HID transport reports the state of a HID subscriber using the :c:struct:`hid_report_subscriber_event`.
113
131
When the connection to the HID host is indicated by this event, the |hid_state| will create an associated subscriber.
114
132
The |hid_state| tracks the state of the HID subscribers.
115
133
116
134
As part of the :c:struct:`hid_report_subscriber_event`, the subscriber provides the following parameters:
117
135
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).
119
137
* Pipeline size - The |hid_state| forwards this information to the HID report providers.
120
138
The information can be used, for example, to synchronize sensor sampling with sending the HID input reports to the HID host.
121
139
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
125
143
------------------------------------------
126
144
127
145
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.
129
147
The subscriber updates its HID report subscriptions using a :c:struct:`hid_report_subscription_event`.
130
148
131
149
The HID report subscriptions are tracked in the subscriber's structure :c:struct:`subscriber`.
@@ -213,5 +231,5 @@ HID output reports
213
231
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.
214
232
215
233
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