Skip to content

Commit ac6f639

Browse files
committed
samples: zephyr: subsys: usb: enable hid testing for H20 and L20
Based on zephyr. Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
1 parent 48c2d82 commit ac6f639

File tree

9 files changed

+108
-0
lines changed

9 files changed

+108
-0
lines changed

CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,7 @@
677677
/samples/zephyr/sensor/bme680/ @nrfconnect/ncs-low-level-test
678678
/samples/zephyr/sensor/qdec/ @nrfconnect/ncs-low-level-test
679679
/samples/zephyr/subsys/settings/ @nrfconnect/ncs-low-level-test
680+
/samples/zephyr/subsys/usb/ @nrfconnect/ncs-low-level-test
680681

681682
/samples/**/*.svg @nrfconnect/ncs-doc-leads
682683
/samples/**/*.png @nrfconnect/ncs-doc-leads
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
cmake_minimum_required(VERSION 3.20.0)
8+
9+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
10+
project(hid-mouse)
11+
12+
include(${ZEPHYR_BASE}/samples/subsys/usb/common/common.cmake)
13+
FILE(GLOB app_sources ${ZEPHYR_BASE}/samples/subsys/usb/hid-mouse/src/*.c)
14+
target_sources(app PRIVATE ${app_sources})
15+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
source "samples/subsys/usb/hid-mouse/Kconfig"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This sample extends the same-named Zephyr sample to verify it
2+
with Nordic development kits.
3+
4+
Source code and basic configuration files can be found in the corresponding folder structure in zephyr/samples/subsys/usb/hid-mouse.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
CONFIG_USB_DEVICE_STACK=y
2+
CONFIG_USB_DEVICE_HID=y
3+
CONFIG_USB_DEVICE_PRODUCT="Zephyr HID mouse sample"
4+
CONFIG_USB_DEVICE_PID=0x0007
5+
CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n
6+
7+
CONFIG_LOG=y
8+
CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
9+
CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y
10+
11+
CONFIG_GPIO=y
12+
CONFIG_INPUT=y
13+
CONFIG_INPUT_MODE_SYNCHRONOUS=y
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
sample:
2+
name: USB HID mouse sample
3+
common:
4+
# harness: button
5+
filter: dt_alias_exists("sw0") and dt_alias_exists("led0")
6+
depends_on:
7+
- gpio
8+
tags:
9+
- ci_samples_zephyr_subsys_usb
10+
- usb
11+
12+
tests:
13+
nrf.extended.sample.usb_device_next.hid-mouse.h20:
14+
depends_on:
15+
- usbd
16+
integration_platforms:
17+
- nrf54h20dk/nrf54h20/cpuapp
18+
platform_allow:
19+
- nrf54h20dk/nrf54h20/cpuapp
20+
extra_args:
21+
- CONF_FILE="usbd_next_prj.conf"
22+
- EXTRA_DTC_OVERLAY_FILE="usbd_next.overlay"
23+
timeout: 15
24+
harness: console
25+
harness_config:
26+
type: multi_line
27+
regex:
28+
- "HS bNumConfigurations 1"
29+
- "FS bNumConfigurations 1"
30+
- "Actual device speed 2"
31+
- "s-in-status finished"
32+
nrf.extended.sample.usb_device_next.hid-mouse.l20:
33+
# depends_on:
34+
# - usbd
35+
integration_platforms:
36+
- nrf54l20pdk/nrf54l20/cpuapp
37+
platform_allow:
38+
- nrf54l20pdk/nrf54l20/cpuapp
39+
extra_args:
40+
- CONF_FILE="usbd_next_prj.conf"
41+
- EXTRA_DTC_OVERLAY_FILE="usbd_next.overlay"
42+
timeout: 15
43+
harness: console
44+
harness_config:
45+
type: multi_line
46+
regex:
47+
- "HS bNumConfigurations 1"
48+
- "FS bNumConfigurations 1"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/ {
2+
hid_dev_0: hid_dev_0 {
3+
compatible = "zephyr,hid-device";
4+
interface-name = "HID0";
5+
protocol-code = "none";
6+
in-polling-period-us = <1000>;
7+
in-report-size = <64>;
8+
};
9+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CONFIG_USB_DEVICE_STACK_NEXT=y
2+
CONFIG_USBD_HID_SUPPORT=y
3+
4+
CONFIG_LOG=y
5+
CONFIG_USBD_LOG_LEVEL_INF=y
6+
CONFIG_USBD_HID_LOG_LEVEL_WRN=y
7+
CONFIG_UDC_DRIVER_LOG_LEVEL_WRN=y
8+
CONFIG_LOG_BUFFER_SIZE=8192
9+
CONFIG_SAMPLE_USBD_PID=0x0007
10+
11+
CONFIG_GPIO=y
12+
CONFIG_INPUT=y

scripts/ci/tags.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -1614,3 +1614,8 @@ ci_samples_zephyr_drivers_adc:
16141614
files:
16151615
- nrf/samples/zephyr/drivers/adc/
16161616
- zephyr/samples/drivers/adc/
1617+
1618+
ci_samples_zephyr_subsys_usb:
1619+
files:
1620+
- nrf/samples/zephyr/subsys/usb/
1621+
- zephyr/samples/subsys/usb/

0 commit comments

Comments
 (0)