From 8bbd539031fbcc9366c51f1d06c77a72d240d812 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 15 Jun 2020 14:52:35 -0500 Subject: [PATCH] supervisor.mk: Compute what USB_DEVICES should be, and check it against what it is --- supervisor/supervisor.mk | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk index 195e4a9b23..7eb7e26305 100644 --- a/supervisor/supervisor.mk +++ b/supervisor/supervisor.mk @@ -119,10 +119,25 @@ ifndef USB_DEVICES USB_DEVICES = "CDC,MSC,AUDIO,HID" endif +USB_DEVICES_COMPUTED := CDC,MSC +ifeq ($(CIRCUITPY_USB_MIDI),1) +USB_DEVICES_COMPUTED := $(USB_DEVICES_COMPUTED),AUDIO +endif +ifeq ($(CIRCUITPY_USB_HID),1) +USB_DEVICES_COMPUTED := $(USB_DEVICES_COMPUTED),HID +endif +USB_DEVICES_COMPUTED := "$(USB_DEVICES_COMPUTED)" + ifndef USB_HID_DEVICES USB_HID_DEVICES = "KEYBOARD,MOUSE,CONSUMER,GAMEPAD" endif +# During a transitional period, check that the COMPUTED values match. +# Once they do all match, we can remove all the hard-coded ones. +ifneq ($(USB_DEVICES),$(USB_DEVICES_COMPUTED)) +$(error Computed USB devices '$(USB_DEVICES_COMPUTED)' different than hard-coded USB devices '$(USB_DEVICES)') +endif + ifndef USB_MSC_MAX_PACKET_SIZE USB_MSC_MAX_PACKET_SIZE = 64 endif