Skip to content

Commit 8bbd539

Browse files
committed
supervisor.mk: Compute what USB_DEVICES should be, and check it against what it is
1 parent 9d5cccc commit 8bbd539

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

supervisor/supervisor.mk

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,25 @@ ifndef USB_DEVICES
119119
USB_DEVICES = "CDC,MSC,AUDIO,HID"
120120
endif
121121

122+
USB_DEVICES_COMPUTED := CDC,MSC
123+
ifeq ($(CIRCUITPY_USB_MIDI),1)
124+
USB_DEVICES_COMPUTED := $(USB_DEVICES_COMPUTED),AUDIO
125+
endif
126+
ifeq ($(CIRCUITPY_USB_HID),1)
127+
USB_DEVICES_COMPUTED := $(USB_DEVICES_COMPUTED),HID
128+
endif
129+
USB_DEVICES_COMPUTED := "$(USB_DEVICES_COMPUTED)"
130+
122131
ifndef USB_HID_DEVICES
123132
USB_HID_DEVICES = "KEYBOARD,MOUSE,CONSUMER,GAMEPAD"
124133
endif
125134

135+
# During a transitional period, check that the COMPUTED values match.
136+
# Once they do all match, we can remove all the hard-coded ones.
137+
ifneq ($(USB_DEVICES),$(USB_DEVICES_COMPUTED))
138+
$(error Computed USB devices '$(USB_DEVICES_COMPUTED)' different than hard-coded USB devices '$(USB_DEVICES)')
139+
endif
140+
126141
ifndef USB_MSC_MAX_PACKET_SIZE
127142
USB_MSC_MAX_PACKET_SIZE = 64
128143
endif

0 commit comments

Comments
 (0)