diff options
| author | Ha Thach <[email protected]> | 2020-11-23 13:06:20 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-11-23 13:06:20 +0700 |
| commit | 49f09f55d063876fcd33d21bbe30a940ac5bcf68 (patch) | |
| tree | 699295b00d1169fae133fc867cc3c58b0b23def6 /examples | |
| parent | 589dfdb0e58fe6630f2b67c49c7f682ac51aba8f (diff) | |
| parent | e4144d8b47b438ff57a09c54de49e7e6c68d9343 (diff) | |
Merge pull request #557 from hathach/rework-class-driver-control
Rework class driver control transfer
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/device/webusb_serial/src/main.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/examples/device/webusb_serial/src/main.c b/examples/device/webusb_serial/src/main.c index e1a098048..9309bbf6e 100644 --- a/examples/device/webusb_serial/src/main.c +++ b/examples/device/webusb_serial/src/main.c @@ -143,9 +143,14 @@ void tud_resume_cb(void) // WebUSB use vendor class //--------------------------------------------------------------------+ -// Invoked when received VENDOR control request -bool tud_vendor_control_request_cb(uint8_t rhport, tusb_control_request_t const * request) +// Invoked when a control transfer occurred on an interface of this class +// Driver response accordingly to the request and the transfer stage (setup/data/ack) +// return false to stall control endpoint (e.g unsupported request) +bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request) { + // nothing to with DATA & ACK stage + if (stage != CONTROL_STAGE_SETUP ) return true; + switch (request->bRequest) { case VENDOR_REQUEST_WEBUSB: @@ -194,16 +199,6 @@ bool tud_vendor_control_request_cb(uint8_t rhport, tusb_control_request_t const return true; } -// Invoked when DATA Stage of VENDOR's request is complete -bool tud_vendor_control_complete_cb(uint8_t rhport, tusb_control_request_t const * request) -{ - (void) rhport; - (void) request; - - // nothing to do - return true; -} - void webserial_task(void) { if ( web_serial_connected ) |
