@@ -60,6 +60,7 @@ USBD_CONFIGURATION_DEFINE(sample_hs_config,
6060 CONFIG_SAMPLE_USBD_MAX_POWER , & hs_cfg_desc );
6161/* doc configuration instantiation end */
6262
63+ #if CONFIG_SAMPLE_USBD_20_EXTENSION_DESC
6364/*
6465 * This does not yet provide valuable information, but rather serves as an
6566 * example, and will be improved in the future.
@@ -72,6 +73,7 @@ static const struct usb_bos_capability_lpm bos_cap_lpm = {
7273};
7374
7475USBD_DESC_BOS_DEFINE (sample_usbext , sizeof (bos_cap_lpm ), & bos_cap_lpm );
76+ #endif
7577
7678static void sample_fix_code_triple (struct usbd_context * uds_ctx ,
7779 const enum usbd_speed speed )
@@ -175,16 +177,16 @@ struct usbd_context *sample_usbd_setup_device(usbd_msg_cb_t msg_cb)
175177 /* doc device init-and-msg end */
176178 }
177179
178- if ( IS_ENABLED ( CONFIG_SAMPLE_USBD_20_EXTENSION_DESC )) {
179- (void )usbd_device_set_bcd_usb (& sample_usbd , USBD_SPEED_FS , 0x0201 );
180- (void )usbd_device_set_bcd_usb (& sample_usbd , USBD_SPEED_HS , 0x0201 );
180+ # if CONFIG_SAMPLE_USBD_20_EXTENSION_DESC
181+ (void )usbd_device_set_bcd_usb (& sample_usbd , USBD_SPEED_FS , 0x0201 );
182+ (void )usbd_device_set_bcd_usb (& sample_usbd , USBD_SPEED_HS , 0x0201 );
181183
182- err = usbd_add_descriptor (& sample_usbd , & sample_usbext );
183- if (err ) {
184- LOG_ERR ("Failed to add USB 2.0 Extension Descriptor" );
185- return NULL ;
186- }
184+ err = usbd_add_descriptor (& sample_usbd , & sample_usbext );
185+ if (err ) {
186+ LOG_ERR ("Failed to add USB 2.0 Extension Descriptor" );
187+ return NULL ;
187188 }
189+ #endif
188190
189191 return & sample_usbd ;
190192}
0 commit comments