summaryrefslogtreecommitdiff
path: root/src/device/usbd.c
diff options
context:
space:
mode:
authorNathan Conrad <[email protected]>2019-11-03 17:50:41 -0500
committerGitHub <[email protected]>2019-11-03 17:50:41 -0500
commit68a53e05fc49bfa46c7cfb1c8e598519d90ec39c (patch)
tree7d93ecb09489e30c87ad16114eb470e504226fe3 /src/device/usbd.c
parentcebc06681315cab60febe057e0b1e9e197518316 (diff)
parent62f8c14fae1c7c2f7d5cd5246e18f305d638f5f6 (diff)
Merge pull request #2 from hathach/pigrew-ZLP_Request2
zlp request2. PR for PR (has issues with STM32F0 FSDEV)
Diffstat (limited to 'src/device/usbd.c')
-rw-r--r--src/device/usbd.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c
index 46affdab4..997416901 100644
--- a/src/device/usbd.c
+++ b/src/device/usbd.c
@@ -376,7 +376,7 @@ void tud_task (void)
case DCD_EVENT_SETUP_RECEIVED:
TU_LOG2(" ");
- TU_LOG2_MEM(&event.setup_received, 1, 8);
+ TU_LOG1_MEM(&event.setup_received, 1, 8);
// Mark as connected after receiving 1st setup packet.
// But it is easier to set it every time instead of wasting time to check then set
@@ -385,6 +385,7 @@ void tud_task (void)
// Process control request
if ( !process_control_request(event.rhport, &event.setup_received) )
{
+ TU_LOG1(" Stall EP0\r\n");
// Failed -> stall both control endpoint IN and OUT
dcd_edpt_stall(event.rhport, 0);
dcd_edpt_stall(event.rhport, 0 | TUSB_DIR_IN_MASK);
@@ -404,7 +405,7 @@ void tud_task (void)
if ( 0 == epnum )
{
- // control transfer DATA stage callback
+ TU_LOG1(" EP Addr = 0x%02X, len = %ld\r\n", ep_addr, event.xfer_complete.len);
usbd_control_xfer_cb(event.rhport, ep_addr, event.xfer_complete.result, event.xfer_complete.len);
}
else
@@ -785,6 +786,8 @@ static bool process_get_descriptor(uint8_t rhport, tusb_control_request_t const
case TUSB_DESC_CONFIGURATION:
{
tusb_desc_configuration_t const* desc_config = (tusb_desc_configuration_t const*) tud_descriptor_configuration_cb(desc_index);
+ TU_ASSERT(desc_config);
+
uint16_t total_len;
memcpy(&total_len, &desc_config->wTotalLength, 2); // possibly mis-aligned memory
@@ -867,10 +870,6 @@ void dcd_event_handler(dcd_event_t const * event, bool in_isr)
break;
case DCD_EVENT_XFER_COMPLETE:
- // skip zero-length control status complete event, should DCD notify us.
- // TODO could cause issue with actual zero length data used by class such as DFU
- if ( (0 == tu_edpt_number(event->xfer_complete.ep_addr)) && (event->xfer_complete.len == 0) ) break;
-
osal_queue_send(_usbd_q, event, in_isr);
TU_ASSERT(event->xfer_complete.result == XFER_RESULT_SUCCESS,);
break;