Skip to content

Commit

Permalink
feat(modem_usb): Deprecated cdc_compliant field
Browse files Browse the repository at this point in the history
Starting from CDC-ACM driver v2.0.4 the compliance is detected automatically
  • Loading branch information
tore-espressif committed Oct 2, 2024
1 parent 9be78b9 commit d227032
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
4 changes: 4 additions & 0 deletions host/class/cdc/esp_modem_usb_dte/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Unreleased

- Deprecated `cdc_compliant` configuration. The driver will now automatically detect CDC compliance

## 1.2.1

- Added support to transmit larger payloads than the buffer_size of DTE
Expand Down
14 changes: 4 additions & 10 deletions host/class/cdc/esp_modem_usb_dte/esp_modem_usb.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -88,15 +88,9 @@ class UsbTerminal : public Terminal, private CdcAcmDevice {
// Determine Terminal interface index
const uint8_t intf_idx = term_idx == 0 ? usb_config->interface_idx : usb_config->secondary_interface_idx;

if (usb_config->cdc_compliant) {
ESP_MODEM_THROW_IF_ERROR(
this->CdcAcmDevice::open(usb_config->vid, usb_config->pid, intf_idx, &esp_modem_cdc_acm_device_config),
"USB Device open failed");
} else {
ESP_MODEM_THROW_IF_ERROR(
this->CdcAcmDevice::open_vendor_specific(usb_config->vid, usb_config->pid, intf_idx, &esp_modem_cdc_acm_device_config),
"USB Device open failed");
}
ESP_MODEM_THROW_IF_ERROR(
this->CdcAcmDevice::open(usb_config->vid, usb_config->pid, intf_idx, &esp_modem_cdc_acm_device_config),
"USB Device open failed");
};

~UsbTerminal()
Expand Down
2 changes: 1 addition & 1 deletion host/class/cdc/esp_modem_usb_dte/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ url: https://github.com/espressif/esp-usb/tree/master/host/class/cdc/esp_modem_u

dependencies:
idf: ">=4.4"
usb_host_cdc_acm: "2.*"
usb_host_cdc_acm: "^2.0.4"
esp_modem: ">=0.1.28,<2.0.0"
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct esp_modem_usb_term_config {
int secondary_interface_idx; /*!< USB Interface index that will be used for secondary terminal: data. Set to -1 for modems with 1 AT port. */
uint32_t timeout_ms; /*!< Time for a USB modem to connect to USB host. 0 means wait forever. */
int xCoreID; /*!< Core affinity of created tasks: CDC-ACM driver task and optional USB Host task */
bool cdc_compliant; /*!< Treat the USB device as CDC-compliant. Read CDC-ACM driver documentation for more details */
bool cdc_compliant __attribute__((deprecated("The driver will automatically detect CDC compliance")));
bool install_usb_host; /*!< Flag whether USB Host driver should be installed */
};

Expand Down Expand Up @@ -54,7 +54,6 @@ struct esp_modem_usb_term_config {
.secondary_interface_idx = _intf2, \
.timeout_ms = 0, \
.xCoreID = 0, \
.cdc_compliant = false, \
.install_usb_host = true \
}
#define ESP_MODEM_DEFAULT_USB_CONFIG(_vid, _pid, _intf) ESP_MODEM_DEFAULT_USB_CONFIG_DUAL(_vid, _pid, _intf, -1)
Expand Down

0 comments on commit d227032

Please sign in to comment.