Browse Source

usb_serial: Implemented support for the GDB serial interface for the GET_LINE_CODING request

feature/usb-windows-os-descriptors
dragonmux 2 years ago
parent
commit
50a226870a
No known key found for this signature in database GPG Key ID: 64861EA89B35507A
  1. 13
      src/platforms/common/usb_serial.c

13
src/platforms/common/usb_serial.c

@ -67,9 +67,20 @@ static enum usbd_request_return_codes gdb_uart_control_request(usbd_device *dev,
gdb_uart_dtr = req->wValue & 1;
return USBD_REQ_HANDLED;
case USB_CDC_REQ_SET_LINE_CODING:
if (*len < sizeof(struct usb_cdc_line_coding))
if (*len < sizeof(usb_cdc_line_coding_s))
return USBD_REQ_NOTSUPP;
return USBD_REQ_HANDLED; /* Ignore on GDB Port */
case USB_CDC_REQ_GET_LINE_CODING: {
if (*len < sizeof(usb_cdc_line_coding_s))
return USBD_REQ_NOTSUPP;
usb_cdc_line_coding_s *line_coding = (usb_cdc_line_coding_s *)*buf;
/* This tells the host that we talk 1MBaud, 8-bit no parity w/ 1 stop bit */
line_coding->dwDTERate = 1 * 1000 * 1000;
line_coding->bCharFormat = USB_CDC_1_STOP_BITS;
line_coding->bParityType = USB_CDC_NO_PARITY;
line_coding->bDataBits = 8;
return USBD_REQ_HANDLED;
}
}
return USBD_REQ_NOTSUPP;
}

Loading…
Cancel
Save