Skip to content

Commit 8525e35

Browse files
MarekPietakapi-no
authored andcommitted
applications: nrf_desktop: Add HID system ctrl report provider
Introduce HID report provider for generating standard system control reports. Jira: NCSDK-31548 Signed-off-by: Marek Pieta <[email protected]>
1 parent 152beb6 commit 8525e35

File tree

4 files changed

+388
-0
lines changed

4 files changed

+388
-0
lines changed

applications/nrf_desktop/src/modules/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ target_sources_ifdef(CONFIG_DESKTOP_HID_REPORT_PROVIDER_MOUSE
5252
target_sources_ifdef(CONFIG_DESKTOP_HID_REPORT_PROVIDER_KEYBOARD
5353
app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/hid_provider_keyboard.c)
5454

55+
target_sources_ifdef(CONFIG_DESKTOP_HID_REPORT_PROVIDER_SYSTEM_CTRL
56+
app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/hid_provider_system_ctrl.c)
57+
5558
target_sources_ifdef(CONFIG_DESKTOP_HID_STATE_PM_ENABLE
5659
app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/hid_state_pm.c)
5760

applications/nrf_desktop/src/modules/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ menu "HID report providers"
1717
rsource "Kconfig.hid_provider_consumer_ctrl"
1818
rsource "Kconfig.hid_provider_mouse"
1919
rsource "Kconfig.hid_provider_keyboard"
20+
rsource "Kconfig.hid_provider_system_ctrl"
2021

2122
endmenu
2223

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
config DESKTOP_HID_REPORT_PROVIDER_SYSTEM_CTRL
8+
bool
9+
default y if !DESKTOP_HID_REPORT_PROVIDER_SYSTEM_CTRL_ALT
10+
depends on DESKTOP_HID_REPORT_SYSTEM_CTRL_SUPPORT
11+
select DESKTOP_HID_KEYMAP
12+
select DESKTOP_HID_EVENTQ
13+
select DESKTOP_KEYS_STATE
14+
help
15+
This option automatically enables the default HID system control
16+
report provider for HID peripheral that supports HID system control
17+
report.
18+
19+
config DESKTOP_HID_REPORT_PROVIDER_SYSTEM_CTRL_ALT
20+
bool "Use custom HID system control report provider"
21+
depends on DESKTOP_HID_REPORT_SYSTEM_CTRL_SUPPORT
22+
help
23+
Enable this option if you want to support HID system control report
24+
and use a custom HID system control report provider. Make sure to
25+
introduce the custom HID system control report provider if you
26+
enable this option.
27+
28+
if DESKTOP_HID_REPORT_PROVIDER_SYSTEM_CTRL
29+
30+
config DESKTOP_HID_REPORT_PROVIDER_SYSTEM_CTRL_KEYPRESS_EXPIRATION
31+
int "HID keypress expiration [ms]"
32+
default DESKTOP_HID_REPORT_EXPIRATION
33+
default 500
34+
help
35+
If a keypress is recorded before HID subscriber connects, it is stored
36+
in HID event queue and processed after the subscriber connects. This
37+
Kconfig option specifies time after which a queued keypress will be
38+
considered expired. The higher the value, the longer the period from
39+
which the module will recall pressed keys when the connection with HID
40+
host is established.
41+
42+
The first default is deprecated and used for backwards compatibility.
43+
44+
config DESKTOP_HID_REPORT_PROVIDER_SYSTEM_CTRL_EVENT_QUEUE_SIZE
45+
int "HID keypress queue size"
46+
default DESKTOP_HID_EVENT_QUEUE_SIZE
47+
default 12
48+
range 2 255
49+
help
50+
The option limits the number of keypresses (button press or release)
51+
on the HID event queue where the keypresses are stored before the
52+
connection with HID host is established. If there is no space in the
53+
queue to enqueue a new key state change, the oldest element is
54+
released.
55+
56+
The first default is deprecated and used for backwards compatibility.
57+
58+
module = DESKTOP_HID_REPORT_PROVIDER_SYSTEM_CTRL
59+
module-str = HID provider system control
60+
source "subsys/logging/Kconfig.template.log_config"
61+
62+
endif # DESKTOP_HID_REPORT_PROVIDER_SYSTEM_CTRL

0 commit comments

Comments
 (0)