Skip to content
This repository was archived by the owner on Apr 16, 2021. It is now read-only.

Commit e21da95

Browse files
committed
Don't stop after first successfull callback_set_configuration()
1 parent efc9e2a commit e21da95

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

cores/arduino/PluggableUSBDevice.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,6 @@ void PluggableUSBDevice::callback_set_configuration(uint8_t configuration)
161161
bool ret = false;
162162
for (node = rootNode; node; node = node->next) {
163163
ret = node->callback_set_configuration(configuration);
164-
if (ret) {
165-
complete_set_configuration(ret);
166-
return;
167-
}
168164
}
169165
complete_set_configuration(ret);
170166
}

libraries/USBSerial/USBCDC.cpp

+7-9
Original file line numberDiff line numberDiff line change
@@ -284,17 +284,15 @@ bool USBCDC::callback_set_configuration(uint8_t configuration)
284284
/* Called in ISR context */
285285

286286
bool ret = false;
287-
if (configuration == DEFAULT_CONFIGURATION) {
288-
// Configure endpoints > 0
289-
PluggableUSBD().endpoint_add(_int_in, CDC_MAX_PACKET_SIZE, USB_EP_TYPE_INT);
290-
PluggableUSBD().endpoint_add(_bulk_in, CDC_MAX_PACKET_SIZE, USB_EP_TYPE_BULK, ::mbed::callback(this, &USBCDC::_send_isr));
291-
PluggableUSBD().endpoint_add(_bulk_out, CDC_MAX_PACKET_SIZE, USB_EP_TYPE_BULK, ::mbed::callback(this, &USBCDC::_receive_isr));
287+
// Configure endpoints > 0
288+
PluggableUSBD().endpoint_add(_int_in, CDC_MAX_PACKET_SIZE, USB_EP_TYPE_INT);
289+
PluggableUSBD().endpoint_add(_bulk_in, CDC_MAX_PACKET_SIZE, USB_EP_TYPE_BULK, ::mbed::callback(this, &USBCDC::_send_isr));
290+
PluggableUSBD().endpoint_add(_bulk_out, CDC_MAX_PACKET_SIZE, USB_EP_TYPE_BULK, ::mbed::callback(this, &USBCDC::_receive_isr));
292291

293-
PluggableUSBD().read_start(_bulk_out, _rx_buf, sizeof(_rx_buffer));
294-
_rx_in_progress = true;
292+
PluggableUSBD().read_start(_bulk_out, _rx_buf, sizeof(_rx_buffer));
293+
_rx_in_progress = true;
295294

296-
ret = true;
297-
}
295+
ret = true;
298296

299297
return ret;
300298
}

0 commit comments

Comments
 (0)