diff --git a/src/generic/usb_cdc.c b/src/generic/usb_cdc.c index 3899d7c3..a87ab810 100644 --- a/src/generic/usb_cdc.c +++ b/src/generic/usb_cdc.c @@ -412,9 +412,8 @@ static void usb_state_ready(void) { struct usb_ctrlrequest req; - int_fast8_t ret = usb_read_ep0(&req, sizeof(req)); + int_fast8_t ret = usb_read_ep0_setup(&req, sizeof(req)); if (ret != sizeof(req)) - // XXX - should verify that packet was sent with a setup token return; switch (req.bRequest) { case USB_REQ_GET_DESCRIPTOR: usb_req_get_descriptor(&req); break; diff --git a/src/generic/usb_cdc.h b/src/generic/usb_cdc.h index 21646900..4771d08c 100644 --- a/src/generic/usb_cdc.h +++ b/src/generic/usb_cdc.h @@ -15,6 +15,7 @@ enum { int_fast8_t usb_read_bulk_out(void *data, uint_fast8_t max_len); int_fast8_t usb_send_bulk_in(void *data, uint_fast8_t len); int_fast8_t usb_read_ep0(void *data, uint_fast8_t max_len); +int_fast8_t usb_read_ep0_setup(void *data, uint_fast8_t max_len); int_fast8_t usb_send_ep0(const void *data, uint_fast8_t len); int_fast8_t usb_send_ep0_progmem(const void *data, uint_fast8_t len); void usb_stall_ep0(void); diff --git a/src/lpc176x/usbserial.c b/src/lpc176x/usbserial.c index 1dc3836c..fba2fd0b 100644 --- a/src/lpc176x/usbserial.c +++ b/src/lpc176x/usbserial.c @@ -189,6 +189,12 @@ usb_read_ep0(void *data, uint_fast8_t max_len) return usb_read_packet(EP0OUT, data, max_len); } +int_fast8_t +usb_read_ep0_setup(void *data, uint_fast8_t max_len) +{ + return usb_read_ep0(data, max_len); +} + int_fast8_t usb_send_ep0(const void *data, uint_fast8_t len) { diff --git a/src/samd21/usbserial.c b/src/samd21/usbserial.c index 0d8f3155..bac75853 100644 --- a/src/samd21/usbserial.c +++ b/src/samd21/usbserial.c @@ -127,6 +127,12 @@ usb_read_ep0(void *data, uint_fast8_t max_len) return usb_read_packet(0, 0, data, max_len); } +int_fast8_t +usb_read_ep0_setup(void *data, uint_fast8_t max_len) +{ + return usb_read_ep0(data, max_len); +} + int_fast8_t usb_send_ep0(const void *data, uint_fast8_t len) {