@@ -122,7 +122,9 @@ void usb_set_defaults(void) {
122
122
#endif
123
123
};
124
124
125
+ #if CIRCUITPY_USB_IDENTIFICATION
125
126
supervisor_allocation * usb_identification_allocation ;
127
+ #endif
126
128
127
129
// Some dynamic USB data must be saved after boot.py. How much is needed?
128
130
size_t usb_boot_py_data_size (void ) {
@@ -137,16 +139,21 @@ size_t usb_boot_py_data_size(void) {
137
139
138
140
// Fill in the data to save.
139
141
void usb_get_boot_py_data (uint8_t * temp_storage , size_t temp_storage_size ) {
142
+ #if CIRCUITPY_USB_IDENTIFICATION
140
143
if (usb_identification_allocation ) {
141
144
memcpy (temp_storage , usb_identification_allocation -> ptr , sizeof (usb_identification_t ));
142
145
free_memory (usb_identification_allocation );
146
+ #else
147
+ if (false) {
148
+ // Nothing
149
+ #endif
143
150
} else {
144
- usb_identification_t defaults = {
145
- . vid = USB_VID ,
146
- . pid = USB_PID ,
147
- . manufacturer_name = USB_MANUFACTURER ,
148
- . product_name = USB_PRODUCT ,
149
- } ;
151
+ usb_identification_t defaults ;
152
+ // This compiles to less code than using a struct initializer.
153
+ defaults . vid = USB_VID ;
154
+ defaults . pid = USB_PID ;
155
+ strcpy ( defaults . manufacturer_name , USB_MANUFACTURER );
156
+ strcpy ( defaults . product_name , USB_PRODUCT ) ;
150
157
memcpy (temp_storage , & defaults , sizeof (defaults ));
151
158
}
152
159
0 commit comments