1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

tests/usbus_cdc_ecm: Check if USB parameters are set via Kconfig

This also avoids running Kconfig by default, given that there is a
Kconfig file in the application folder.
This commit is contained in:
Leandro Lanzieri 2020-04-08 18:15:09 +02:00
parent dddeb54e7d
commit 4433b9bc7a
No known key found for this signature in database
GPG Key ID: 39607DE6080007A3
2 changed files with 23 additions and 4 deletions

View File

@ -0,0 +1,5 @@
config USB_VID
default 0x$(DEFAULT_VID) if KCONFIG_USB
config USB_PID
default 0x$(DEFAULT_PID) if KCONFIG_USB

View File

@ -11,15 +11,29 @@ USEMODULE += ps
# USB device vendor and product ID
# pid.codes test VID/PID, not globally unique
DEFAULT_VID = 1209
DEFAULT_PID = 7D00
export DEFAULT_VID = 1209
export DEFAULT_PID = 7D00
USB_VID ?= $(DEFAULT_VID)
USB_PID ?= $(DEFAULT_PID)
CFLAGS += -DCONFIG_USB_VID=0x$(USB_VID) -DCONFIG_USB_PID=0x$(USB_PID)
include $(RIOTBASE)/Makefile.include
# Set USB VID/PID via CFLAGS if not being set via Kconfig
ifndef CONFIG_USB_VID
CFLAGS += -DCONFIG_USB_VID=0x$(USB_VID)
else
USB_VID = $(patsubst 0x%,%,$(CONFIG_USB_VID))
endif
ifndef CONFIG_USB_PID
CFLAGS += -DCONFIG_USB_PID=0x$(USB_PID)
else
USB_PID = $(patsubst 0x%,%,$(CONFIG_USB_PID))
endif
# There is a Kconfig in the app folder, we need to indicate not to run it by default
SHOULD_RUN_KCONFIG ?=
.PHONY: usb_id_check
usb_id_check:
@if [ $(USB_VID) = $(DEFAULT_VID) -o $(USB_PID) = $(DEFAULT_PID) ] ; then \