summaryrefslogtreecommitdiff
path: root/src/device
diff options
context:
space:
mode:
authorhathach <[email protected]>2020-11-19 21:26:06 +0700
committerhathach <[email protected]>2020-11-19 21:26:06 +0700
commitdd07fecc5f37c85b87060c7f7158d26ff19757a6 (patch)
tree50a3ef387e1abc116a3658894d46cdff6d05d525 /src/device
parent3c31d0805130e9551f97afae94f765b5d032991b (diff)
migrate cdc_device to new control_xfer_cb
Diffstat (limited to 'src/device')
-rw-r--r--src/device/usbd.c3
-rw-r--r--src/device/usbd_control.c9
2 files changed, 10 insertions, 2 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c
index 02f631dea..dbe11d380 100644
--- a/src/device/usbd.c
+++ b/src/device/usbd.c
@@ -97,8 +97,7 @@ static usbd_class_driver_t const _usbd_driver[] =
.init = cdcd_init,
.reset = cdcd_reset,
.open = cdcd_open,
- .control_xfer_cb = cdcd_control_request,
- .control_complete = cdcd_control_complete,
+ .control_xfer_cb = cdcd_control_xfer_cb,
.xfer_cb = cdcd_xfer_cb,
.sof = NULL
},
diff --git a/src/device/usbd_control.c b/src/device/usbd_control.c
index f1edad376..bb631320a 100644
--- a/src/device/usbd_control.c
+++ b/src/device/usbd_control.c
@@ -171,7 +171,16 @@ bool usbd_control_xfer_cb (uint8_t rhport, uint8_t ep_addr, xfer_result_t result
if ( tu_edpt_dir(ep_addr) != _ctrl_xfer.request.bmRequestType_bit.direction )
{
TU_ASSERT(0 == xferred_bytes);
+
+ // invoke optional dcd hook if available
if (dcd_edpt0_status_complete) dcd_edpt0_status_complete(rhport, &_ctrl_xfer.request);
+
+ if (_ctrl_xfer.complete_cb)
+ {
+ // TODO refactor with usbd_driver_print_control_complete_name
+ _ctrl_xfer.complete_cb(rhport, CONTROL_STAGE_ACK, &_ctrl_xfer.request);
+ }
+
return true;
}