summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2022-12-20 12:06:59 +0700
committerhathach <[email protected]>2022-12-20 12:06:59 +0700
commit7004914d8c6c7d88908776eb153661b6b987e513 (patch)
tree8a1a57ac5ee50273f5d539b09379501823d60358
parentfc9321ce26ed5662cfa6a48b52507b4a39a8cc08 (diff)
fix hid host incorrect edpt release if failed to transmit
add CDC_CONTROL_LINE_STATE_DTR/RTS, TUSB_INDEX_INVALID enum
-rw-r--r--src/class/cdc/cdc.h10
-rw-r--r--src/class/hid/hid_host.c2
-rw-r--r--src/common/tusb_types.h5
3 files changed, 14 insertions, 3 deletions
diff --git a/src/class/cdc/cdc.h b/src/class/cdc/cdc.h
index c428af865..6a9669cf2 100644
--- a/src/class/cdc/cdc.h
+++ b/src/class/cdc/cdc.h
@@ -192,6 +192,12 @@ typedef enum
CDC_REQUEST_MDLM_SEMANTIC_MODEL = 0x60,
}cdc_management_request_t;
+enum
+{
+ CDC_CONTROL_LINE_STATE_DTR = 0x01,
+ CDC_CONTROL_LINE_STATE_RTS = 0x02,
+};
+
//--------------------------------------------------------------------+
// Management Element Notification (Notification Endpoint)
//--------------------------------------------------------------------+
@@ -390,8 +396,8 @@ TU_VERIFY_STATIC(sizeof(cdc_line_coding_t) == 7, "size is not correct");
typedef struct TU_ATTR_PACKED
{
- uint16_t dte_is_present : 1; ///< Indicates to DCE if DTE is presentor not. This signal corresponds to V.24 signal 108/2 and RS-232 signal DTR.
- uint16_t half_duplex_carrier_control : 1;
+ uint16_t dtr : 1;
+ uint16_t rts : 1;
uint16_t : 14;
} cdc_line_control_state_t;
diff --git a/src/class/hid/hid_host.c b/src/class/hid/hid_host.c
index 504ddca1e..42b5e2f4e 100644
--- a/src/class/hid/hid_host.c
+++ b/src/class/hid/hid_host.c
@@ -259,7 +259,7 @@ bool tuh_hid_receive_report(uint8_t dev_addr, uint8_t instance)
if ( !usbh_edpt_xfer(dev_addr, hid_itf->ep_in, hid_itf->epin_buf, hid_itf->epin_size) )
{
- usbh_edpt_claim(dev_addr, hid_itf->ep_in);
+ usbh_edpt_release(dev_addr, hid_itf->ep_in);
return false;
}
diff --git a/src/common/tusb_types.h b/src/common/tusb_types.h
index c4c9d4133..32cdba450 100644
--- a/src/common/tusb_types.h
+++ b/src/common/tusb_types.h
@@ -273,6 +273,11 @@ enum
CONTROL_STAGE_ACK
};
+enum
+{
+ TUSB_INDEX_INVALID = 0xff
+};
+
//--------------------------------------------------------------------+
// USB Descriptors
//--------------------------------------------------------------------+