Skip to content

Commit

Permalink
fix: Callback when USB port is disconnected
Browse files Browse the repository at this point in the history
Callback function was not being called when USB port was disconnected.
The deinit function removed the callback function from the USB driver,
deinit function is now after the callback function is called.
  • Loading branch information
Dzarda7 committed Nov 4, 2024
1 parent b49d250 commit c966fe6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions port/esp32_usb_cdc_acm_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ static void handle_usb_event(const cdc_acm_host_dev_event_data_t *event, void *u

case CDC_ACM_HOST_DEVICE_DISCONNECTED:
ESP_LOGI(TAG, "Device disconnected");
esp_loader_error_t deinit_status = loader_port_esp32_usb_cdc_acm_deinit();
assert(deinit_status == ESP_LOADER_SUCCESS);
if (s_device_disconnected_callback != NULL) {
s_device_disconnected_callback();
}
esp_loader_error_t deinit_status = loader_port_esp32_usb_cdc_acm_deinit();
assert(deinit_status == ESP_LOADER_SUCCESS);
break;

case CDC_ACM_HOST_SERIAL_STATE:
Expand Down

0 comments on commit c966fe6

Please sign in to comment.