Skip to content
This repository was archived by the owner on Jun 4, 2026. It is now read-only.

Commit 0dcb2a0

Browse files
committed
create HID report protocol compatibility tester application
1 parent 9d39f27 commit 0dcb2a0

11 files changed

Lines changed: 712 additions & 21 deletions

File tree

.vscode/tasks.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,29 @@
126126
"problemMatcher": [
127127
"$gcc"
128128
]
129+
},
130+
{
131+
"label": "Build hid-rp-compat-tester for nrf52840dk",
132+
"group": {
133+
"kind": "build",
134+
"isDefault": true
135+
},
136+
"options": {
137+
"cwd": "${workspaceFolder}"
138+
},
139+
"type": "process",
140+
"command": "west",
141+
"args": [
142+
"build",
143+
"--build-dir",
144+
"${cwd}/hid-rp-compat-tester/build/nrf52840dk",
145+
"${cwd}/hid-rp-compat-tester",
146+
"--board",
147+
"nrf52840dk/nrf52840"
148+
],
149+
"problemMatcher": [
150+
"$gcc"
151+
]
129152
}
130153
]
131154
}

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ command:
1313
west init -m https://github.com/IntergatedCircuits/c2usb-zephyr-examples c2usb-workspace
1414
# update Zephyr modules
1515
cd c2usb-workspace
16-
west update
17-
west patch
16+
west update && west patch
1817
```
1918

2019
## Application Index
@@ -26,6 +25,11 @@ A straightforward BLE HID keyboard. UART shell access is needed to complete BLE
2625
Use the button on the board to trigger a caps lock press,
2726
and observe as the host changes the caps lock state on the board's LED.
2827

28+
### hid-rp-compat-tester
29+
30+
A device that performs a sequence of USB enumerations, testing whether the host OS is capable
31+
of interpreting various HID report descriptor variations of an HID keyboard.
32+
2933
### usb-keyboard
3034

3135
A straightforward USB HID keyboard. Use the button on the board to trigger a caps lock press,
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
cmake_minimum_required(VERSION 3.20.0)
4+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
5+
project(hid-rp-compat-tester)
6+
7+
target_sources(app PRIVATE src/main.cpp)
8+
9+
# link the application to c2usb
10+
target_link_libraries(app PRIVATE
11+
c2usb
12+
c2usb-example-hid
13+
)

hid-rp-compat-tester/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
source "Kconfig.zephyr"
2+
rsource "../Kconfig"

hid-rp-compat-tester/prj.conf

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
CONFIG_LOG=y
2+
CONFIG_UDC_DRIVER_LOG_LEVEL_WRN=y
3+
#CONFIG_C2USB_UDC_MAC_LOG_LEVEL_DBG=y
4+
5+
CONFIG_INPUT=y
6+
CONFIG_INPUT_MODE_SYNCHRONOUS=y
7+
CONFIG_HWINFO=y
8+
9+
CONFIG_SHELL=y
10+
CONFIG_SHELL_BACKEND_C2USB=y
11+
# CONFIG_SHELL_BACKEND_SERIAL=y
12+
CONFIG_SHELL_LOG_BACKEND=y
13+
CONFIG_SHELL_MINIMAL=n
14+
# needs to be ~100 bytes more than default
15+
CONFIG_SHELL_STACK_SIZE=1536
16+
17+
CONFIG_C2USB_UDC_MAC=y
18+
# RAM optimization:
19+
# the buffer pool size can be cut down, as it's only used for control transfers
20+
# CONFIG_UDC_BUF_POOL_SIZE=optimize based on your application (and check asserts)
21+
# CONFIG_UDC_BUF_COUNT=3 + maximal used endpoint count in a configuration
22+
23+
# needed as at suspend the msgq is flooded otherwise
24+
# CONFIG_C2USB_UDC_MAC_MSGQ_SIZE=32
25+
26+
CONFIG_DEBUG=y
27+
CONFIG_DEBUG_OPTIMIZATIONS=y
28+
CONFIG_DEBUG_THREAD_INFO=y
29+
30+
# don't use picolibc in debug builds as only its module version can print verbose assert() logs
31+
# CONFIG_PICOLIBC_VERBOSE_ASSERT=y
32+
# but that's conflicting with the chosen C++ standard library
33+
CONFIG_NEWLIB_LIBC=y
34+
35+
CONFIG_USE_SEGGER_RTT=n
36+
37+
CONFIG_DEMO_MANUFACTURER="github.com/IntergatedCircuits/c2usb-zephyr-examples"
38+
CONFIG_DEMO_PRODUCT="HID RP compatibility tester"
39+
# use reserved VID/PID that won't conflict with real devices, in case of host OS blacklisting
40+
CONFIG_DEMO_MANUFACTURER_ID=0x335e
41+
CONFIG_DEMO_PRODUCT_ID=0x1cff

hid-rp-compat-tester/sample.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
sample:
2+
name: HID RP Compatibility Tester
3+
common:
4+
harness: button
5+
filter: dt_alias_exists("sw0") and dt_alias_exists("led0")
6+
depends_on:
7+
- gpio
8+
platform_allow:
9+
- nrf52840dk/nrf52840

0 commit comments

Comments
 (0)