Skip to content

Commit b7a15c3

Browse files
MarekPietarlubos
authored andcommitted
applications: nrf_desktop: Add a new Kconfig for HID forward
Change allows configuring HID subscriber count in HID forward. This is needed in case a single USB HID instance is used for all of the HID peripherals connected over Bluetooth LE. Jira: NCSDK-30002 Signed-off-by: Marek Pieta <[email protected]>
1 parent 6a08601 commit b7a15c3

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

applications/nrf_desktop/src/modules/Kconfig.hid_forward

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ config DESKTOP_HID_FORWARD_ENABLE
1818

1919
if DESKTOP_HID_FORWARD_ENABLE
2020

21+
config DESKTOP_HID_FORWARD_SUBSCRIBER_COUNT
22+
int "Number of HID subscribers"
23+
range 1 255
24+
default DESKTOP_HID_DONGLE_BOND_COUNT
25+
help
26+
By default, the module uses a dedicated HID subscriber (USB HID class
27+
instance) for every BLE bonded HID peripheral. Set this option to 1 to
28+
forward all of the HID reports received from HID peripherals to one
29+
subscriber (required if using a single USB HID instance).
30+
31+
The configured number of HID subscribers must match number of USB HID
32+
class instances.
33+
2134
config BT_HOGP_REPORTS_MAX
2235
default 12
2336
help

applications/nrf_desktop/src/modules/hid_forward.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ struct hids_peripheral {
5858
uint8_t sub_id;
5959
};
6060

61-
static struct subscriber subscribers[CONFIG_DESKTOP_HID_DONGLE_BOND_COUNT];
61+
static struct subscriber subscribers[CONFIG_DESKTOP_HID_FORWARD_SUBSCRIBER_COUNT];
6262
static bt_addr_le_t peripheral_address[CONFIG_BT_MAX_PAIRED];
6363
static struct hids_peripheral peripherals[CONFIG_BT_MAX_CONN];
6464
static uint8_t peripheral_cache[CONFIG_BT_MAX_CONN];
@@ -68,7 +68,7 @@ static bool suspended;
6868
static void hogp_out_rep_write_cb(struct bt_hogp *hogp, struct bt_hogp_rep_info *rep, uint8_t err);
6969
static int send_hid_out_report(struct bt_hogp *hogp, const uint8_t *data, size_t size);
7070

71-
#if CONFIG_DESKTOP_HID_DONGLE_BOND_COUNT > 1
71+
#if CONFIG_DESKTOP_HID_FORWARD_SUBSCRIBER_COUNT > 1
7272
static void verify_data(const struct bt_bond_info *info, void *user_data)
7373
{
7474
for (size_t i = 0; i < ARRAY_SIZE(peripheral_address); i++) {
@@ -116,7 +116,7 @@ static int verify_peripheral_address(void)
116116

117117
SETTINGS_STATIC_HANDLER_DEFINE(hid_forward, MODULE_NAME, NULL, settings_set,
118118
verify_peripheral_address, NULL);
119-
#endif /* CONFIG_DESKTOP_HID_DONGLE_BOND_COUNT > 1 */
119+
#endif /* CONFIG_DESKTOP_HID_FORWARD_SUBSCRIBER_COUNT > 1 */
120120

121121
static int store_peripheral_address(void)
122122
{

0 commit comments

Comments
 (0)