Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 25a3951

Browse files
purdeaandreiwhitequark
authored andcommitted
examples/cdc-acm: Don't use deprecated SETUP_EP0_BUF()
This commit doesn't introduce any kind of functional change. The cdc-acm example wasn't vulnerable to the race condition caused by using `SETUP_EP0_BUF(0)`. I have tested that both the original and new versions of cdc-acm work correctly.
1 parent 1c8a910 commit 25a3951

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

examples/cdc-acm/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ void handle_usb_setup(__xdata struct usb_req_setup *req) {
199199
if(req->bmRequestType == (USB_RECIP_IFACE|USB_TYPE_CLASS|USB_DIR_OUT) &&
200200
req->bRequest == USB_CDC_PSTN_REQ_SET_LINE_CODING &&
201201
req->wIndex == 0 && req->wLength == 7) {
202-
SETUP_EP0_BUF(0);
202+
SETUP_EP0_OUT_BUF();
203+
ACK_EP0(); // Since we're throwing away the buffer, it's okay to immediately just ACK it.
203204
return;
204205
}
205206

0 commit comments

Comments
 (0)