mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-20 22:20:55 +00:00
migrate vendor device to new control xfer cb
This commit is contained in:
parent
3cc1979adb
commit
61ad7bef71
@ -143,9 +143,14 @@ void tud_resume_cb(void)
|
|||||||
// WebUSB use vendor class
|
// WebUSB use vendor class
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
|
||||||
// Invoked when received VENDOR control request
|
// Invoked when a control transfer occurred on an interface of this class
|
||||||
bool tud_vendor_control_request_cb(uint8_t rhport, tusb_control_request_t const * request)
|
// 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)
|
switch (request->bRequest)
|
||||||
{
|
{
|
||||||
case VENDOR_REQUEST_WEBUSB:
|
case VENDOR_REQUEST_WEBUSB:
|
||||||
@ -194,16 +199,6 @@ bool tud_vendor_control_request_cb(uint8_t rhport, tusb_control_request_t const
|
|||||||
return true;
|
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)
|
void webserial_task(void)
|
||||||
{
|
{
|
||||||
if ( web_serial_connected )
|
if ( web_serial_connected )
|
||||||
|
@ -158,8 +158,7 @@ static usbd_class_driver_t const _usbd_driver[] =
|
|||||||
.init = vendord_init,
|
.init = vendord_init,
|
||||||
.reset = vendord_reset,
|
.reset = vendord_reset,
|
||||||
.open = vendord_open,
|
.open = vendord_open,
|
||||||
.control_xfer_cb = tud_vendor_control_request_cb,
|
.control_xfer_cb = tud_vendor_control_xfer_cb,
|
||||||
.control_complete = tud_vendor_control_complete_cb,
|
|
||||||
.xfer_cb = vendord_xfer_cb,
|
.xfer_cb = vendord_xfer_cb,
|
||||||
.sof = NULL
|
.sof = NULL
|
||||||
},
|
},
|
||||||
|
@ -127,10 +127,6 @@ TU_ATTR_WEAK void tud_resume_cb(void);
|
|||||||
// Invoked when received control request with VENDOR TYPE
|
// Invoked when received control request with VENDOR TYPE
|
||||||
TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request);
|
TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request);
|
||||||
|
|
||||||
// Invoked when vendor control request is complete
|
|
||||||
TU_ATTR_WEAK bool tud_vendor_control_complete_cb(uint8_t rhport, tusb_control_request_t const * request);
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// Binary Device Object Store (BOS) Descriptor Templates
|
// Binary Device Object Store (BOS) Descriptor Templates
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
Loading…
x
Reference in New Issue
Block a user