summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <[email protected]>2018-11-09 11:30:51 -0800
committerScott Shawcroft <[email protected]>2018-11-09 11:32:59 -0800
commit299a2f12de2ddb76b9a488b23e7e562058faee90 (patch)
tree83b0a48ccf8fd9c3932d346ab7a84302f792cbe7
parent537a29273c08b1e047004e1bd71c37af82937dd4 (diff)
Support the no CDC protocol as well.
-rw-r--r--src/class/cdc/cdc.h3
-rw-r--r--src/class/cdc/cdc_device.c4
2 files changed, 5 insertions, 2 deletions
diff --git a/src/class/cdc/cdc.h b/src/class/cdc/cdc.h
index 0b6e57735..afac8379d 100644
--- a/src/class/cdc/cdc.h
+++ b/src/class/cdc/cdc.h
@@ -90,7 +90,8 @@ typedef enum
/// Communication Interface Protocol Codes
typedef enum
{
- CDC_COMM_PROTOCOL_ATCOMMAND = 0x01 , ///< AT Commands: V.250 etc
+ CDC_COMM_PROTOCOL_NONE = 0x00 , ///< No specific protocol
+ CDC_COMM_PROTOCOL_ATCOMMAND , ///< AT Commands: V.250 etc
CDC_COMM_PROTOCOL_ATCOMMAND_PCCA_101 , ///< AT Commands defined by PCCA-101
CDC_COMM_PROTOCOL_ATCOMMAND_PCCA_101_AND_ANNEXO , ///< AT Commands defined by PCCA-101 & Annex O
CDC_COMM_PROTOCOL_ATCOMMAND_GSM_707 , ///< AT Commands defined by GSM 07.07
diff --git a/src/class/cdc/cdc_device.c b/src/class/cdc/cdc_device.c
index ab9addc93..49e13c4b7 100644
--- a/src/class/cdc/cdc_device.c
+++ b/src/class/cdc/cdc_device.c
@@ -227,8 +227,10 @@ tusb_error_t cdcd_open(uint8_t rhport, tusb_desc_interface_t const * p_interface
{
if ( CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL != p_interface_desc->bInterfaceSubClass) return TUSB_ERROR_CDC_UNSUPPORTED_SUBCLASS;
+ // Only support AT commands, no protocol and vendor specific commands.
if ( !(tu_within(CDC_COMM_PROTOCOL_ATCOMMAND, p_interface_desc->bInterfaceProtocol, CDC_COMM_PROTOCOL_ATCOMMAND_CDMA) ||
- 0xff == p_interface_desc->bInterfaceProtocol) )
+ p_interface_desc->bInterfaceProtocol == CDC_COMM_PROTOCOL_NONE ||
+ p_interface_desc->bInterfaceProtocol == 0xff ) )
{
return TUSB_ERROR_CDC_UNSUPPORTED_PROTOCOL;
}