diff options
| author | sakimisu <[email protected]> | 2023-06-21 19:39:48 +0800 |
|---|---|---|
| committer | sakimisu <[email protected]> | 2023-06-21 19:39:48 +0800 |
| commit | d970f88f065249d3e6c73ed87935ba035cb81a82 (patch) | |
| tree | 1bf2316fa5046cc58ec817ba88f59eea6fc5c405 /class | |
| parent | 2d1b4b8b828c0fae600b21584feee977bf487414 (diff) | |
add cdc send break request
Diffstat (limited to 'class')
| -rw-r--r-- | class/cdc/usbd_cdc.c | 21 | ||||
| -rw-r--r-- | class/cdc/usbd_cdc.h | 1 |
2 files changed, 12 insertions, 10 deletions
diff --git a/class/cdc/usbd_cdc.c b/class/cdc/usbd_cdc.c index e3e310f3..e9cbb503 100644 --- a/class/cdc/usbd_cdc.c +++ b/class/cdc/usbd_cdc.c @@ -48,15 +48,10 @@ static int cdc_acm_class_interface_request_handler(struct usb_setup_packet *setu parity_name[line_coding.bParityType], stop_name[line_coding.bCharFormat]); - /* check if current line coding is the same with last, if they are the same, do not set line coding */ - usbd_cdc_acm_get_line_coding(intf_num, &line_coding_last); - if (memcmp(&line_coding_last, &line_coding, sizeof(struct cdc_line_coding))) { - usbd_cdc_acm_set_line_coding(intf_num, &line_coding); - } - + usbd_cdc_acm_set_line_coding(intf_num, &line_coding); break; - case CDC_REQUEST_SET_CONTROL_LINE_STATE: { + case CDC_REQUEST_SET_CONTROL_LINE_STATE: dtr = (setup->wValue & 0x0001); rts = (setup->wValue & 0x0002); USB_LOG_DBG("Set intf:%d DTR 0x%x,RTS 0x%x\r\n", @@ -65,7 +60,7 @@ static int cdc_acm_class_interface_request_handler(struct usb_setup_packet *setu rts); usbd_cdc_acm_set_dtr(intf_num, dtr); usbd_cdc_acm_set_rts(intf_num, rts); - } break; + break; case CDC_REQUEST_GET_LINE_CODING: usbd_cdc_acm_get_line_coding(intf_num, &line_coding); @@ -78,7 +73,9 @@ static int cdc_acm_class_interface_request_handler(struct usb_setup_packet *setu line_coding.bParityType, line_coding.bDataBits); break; - + case CDC_REQUEST_SEND_BREAK: + usbd_cdc_acm_send_break(intf_num); + break; default: USB_LOG_WRN("Unhandled CDC Class bRequest 0x%02x\r\n", setup->bRequest); return -1; @@ -115,4 +112,8 @@ __WEAK void usbd_cdc_acm_set_dtr(uint8_t intf, bool dtr) __WEAK void usbd_cdc_acm_set_rts(uint8_t intf, bool rts) { -}
\ No newline at end of file +} + +__WEAK void usbd_cdc_acm_send_break(uint8_t intf) +{ +} diff --git a/class/cdc/usbd_cdc.h b/class/cdc/usbd_cdc.h index b4f5d993..90e08f4a 100644 --- a/class/cdc/usbd_cdc.h +++ b/class/cdc/usbd_cdc.h @@ -20,6 +20,7 @@ void usbd_cdc_acm_set_line_coding(uint8_t intf, struct cdc_line_coding *line_cod void usbd_cdc_acm_get_line_coding(uint8_t intf, struct cdc_line_coding *line_coding); void usbd_cdc_acm_set_dtr(uint8_t intf, bool dtr); void usbd_cdc_acm_set_rts(uint8_t intf, bool rts); +void usbd_cdc_acm_send_break(uint8_t intf); #ifdef __cplusplus } |
