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:
parent
dddeb54e7d
commit
4433b9bc7a
5
tests/usbus_cdc_ecm/Kconfig
Normal file
5
tests/usbus_cdc_ecm/Kconfig
Normal 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
|
||||||
@ -11,15 +11,29 @@ USEMODULE += ps
|
|||||||
|
|
||||||
# USB device vendor and product ID
|
# USB device vendor and product ID
|
||||||
# pid.codes test VID/PID, not globally unique
|
# pid.codes test VID/PID, not globally unique
|
||||||
DEFAULT_VID = 1209
|
export DEFAULT_VID = 1209
|
||||||
DEFAULT_PID = 7D00
|
export DEFAULT_PID = 7D00
|
||||||
USB_VID ?= $(DEFAULT_VID)
|
USB_VID ?= $(DEFAULT_VID)
|
||||||
USB_PID ?= $(DEFAULT_PID)
|
USB_PID ?= $(DEFAULT_PID)
|
||||||
|
|
||||||
CFLAGS += -DCONFIG_USB_VID=0x$(USB_VID) -DCONFIG_USB_PID=0x$(USB_PID)
|
|
||||||
|
|
||||||
include $(RIOTBASE)/Makefile.include
|
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
|
.PHONY: usb_id_check
|
||||||
usb_id_check:
|
usb_id_check:
|
||||||
@if [ $(USB_VID) = $(DEFAULT_VID) -o $(USB_PID) = $(DEFAULT_PID) ] ; then \
|
@if [ $(USB_VID) = $(DEFAULT_VID) -o $(USB_PID) = $(DEFAULT_PID) ] ; then \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user