From 6a509308fe00a2fe42bd5b1755f8d636f1b63156 Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Sat, 30 Oct 2021 11:49:48 +0200 Subject: [PATCH] usbus/cdc_acm: Return stall on line coding not supported The SetLineCoding request is optional to support (CDC PSTN subclass). No need to claim to support it to the host and actually discard the data if it is not supported by the implementation. --- sys/usb/usbus/cdc/acm/cdc_acm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/usb/usbus/cdc/acm/cdc_acm.c b/sys/usb/usbus/cdc/acm/cdc_acm.c index cdff77fcf9c4..a99097c3d718 100644 --- a/sys/usb/usbus/cdc/acm/cdc_acm.c +++ b/sys/usb/usbus/cdc/acm/cdc_acm.c @@ -259,6 +259,11 @@ static int _control_handler(usbus_t *usbus, usbus_handler_t *handler, usbus_cdcacm_device_t *cdcacm = (usbus_cdcacm_device_t*)handler; switch(setup->request) { case USB_CDC_MGNT_REQUEST_SET_LINE_CODING: + if (!(cdcacm->coding_cb)) { + /* Line coding not supported, return STALL */ + DEBUG("CDCACM: line coding not supported\n"); + return -1; + } if ((state == USBUS_CONTROL_REQUEST_STATE_OUTDATA) && (setup->length == sizeof(usb_req_cdcacm_coding_t))) { size_t len = 0;