summaryrefslogtreecommitdiff
path: root/src/class
diff options
context:
space:
mode:
authorhathach <[email protected]>2024-01-16 12:00:28 +0700
committerhathach <[email protected]>2024-01-16 12:00:28 +0700
commit57c6f8cfa27f5c7b34a52e20b66cc81fe62c2815 (patch)
treec6b50cacb4baf706da40791ca03fcdf66e5f0581 /src/class
parent1f2901e8b12258c953e3c338897f188c98b5eaed (diff)
parent938cae818f5f53887ad12e34189e6746dbce4889 (diff)
Merge branch 'master' into cdc_ch34x_support
# Conflicts: # src/class/cdc/cdc_host.c
Diffstat (limited to 'src/class')
-rw-r--r--src/class/cdc/cdc_host.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/class/cdc/cdc_host.c b/src/class/cdc/cdc_host.c
index ca5bfff04..c018cf057 100644
--- a/src/class/cdc/cdc_host.c
+++ b/src/class/cdc/cdc_host.c
@@ -104,9 +104,9 @@ static bool acm_set_baudrate(cdch_interface_t* p_cdc, uint32_t baudrate, tuh_xfe
#if CFG_TUH_CDC_FTDI
#include "serial/ftdi_sio.h"
-static uint16_t const ftdi_pids[] = { CFG_TUH_CDC_FTDI_PID_LIST };
+static uint16_t const ftdi_vid_pid_list[][2] = {CFG_TUH_CDC_FTDI_VID_PID_LIST };
enum {
- FTDI_PID_COUNT = TU_ARRAY_SIZE(ftdi_pids)
+ FTDI_PID_COUNT = TU_ARRAY_SIZE(ftdi_vid_pid_list)
};
// Store last request baudrate since divisor to baudrate is not easy
@@ -122,9 +122,9 @@ static bool ftdi_sio_set_baudrate(cdch_interface_t* p_cdc, uint32_t baudrate, tu
#if CFG_TUH_CDC_CP210X
#include "serial/cp210x.h"
-static uint16_t const cp210x_pids[] = { CFG_TUH_CDC_CP210X_PID_LIST };
+static uint16_t const cp210x_vid_pid_list[][2] = {CFG_TUH_CDC_CP210X_VID_PID_LIST };
enum {
- CP210X_PID_COUNT = TU_ARRAY_SIZE(cp210x_pids)
+ CP210X_PID_COUNT = TU_ARRAY_SIZE(cp210x_vid_pid_list)
};
static bool cp210x_open(uint8_t daddr, tusb_desc_interface_t const *itf_desc, uint16_t max_len);
@@ -645,21 +645,17 @@ bool cdch_open(uint8_t rhport, uint8_t daddr, tusb_desc_interface_t const *itf_d
TU_VERIFY(tuh_vid_pid_get(daddr, &vid, &pid));
#if CFG_TUH_CDC_FTDI
- if (TU_FTDI_VID == vid) {
- for (size_t i = 0; i < FTDI_PID_COUNT; i++) {
- if (ftdi_pids[i] == pid) {
- return ftdi_open(daddr, itf_desc, max_len);
- }
+ for (size_t i = 0; i < FTDI_PID_COUNT; i++) {
+ if (ftdi_vid_pid_list[i][0] == vid && ftdi_vid_pid_list[i][1] == pid) {
+ return ftdi_open(daddr, itf_desc, max_len);
}
}
#endif
#if CFG_TUH_CDC_CP210X
- if (TU_CP210X_VID == vid) {
- for (size_t i = 0; i < CP210X_PID_COUNT; i++) {
- if (cp210x_pids[i] == pid) {
- return cp210x_open(daddr, itf_desc, max_len);
- }
+ for (size_t i = 0; i < CP210X_PID_COUNT; i++) {
+ if (cp210x_vid_pid_list[i][0] == vid && cp210x_vid_pid_list[i][1] == pid) {
+ return cp210x_open(daddr, itf_desc, max_len);
}
}
#endif