Skip to content

Commit

Permalink
firmware: delay honor_fpga_adv until request is finished
Browse files Browse the repository at this point in the history
  • Loading branch information
mndza committed Feb 16, 2024
1 parent f68195e commit 3cd4f79
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions firmware/src/vendor.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,15 @@ bool handle_force_fpga_offline(uint8_t rhport, tusb_control_request_t const* req
*/
bool handle_honor_fpga_adv(uint8_t rhport, tusb_control_request_t const* request)
{
honor_fpga_adv();
return tud_control_xfer(rhport, request, NULL, 0);
}

bool handle_honor_fpga_adv_finish(uint8_t rhport, tusb_control_request_t const* request)
{
honor_fpga_adv();
return true;
}



/**
Expand Down Expand Up @@ -201,6 +206,19 @@ static bool handle_vendor_request_complete(uint8_t rhport, tusb_control_request_

}

/**
* Called when a vendor request is finished.
*/
static bool handle_vendor_request_finish(uint8_t rhport, tusb_control_request_t const * request)
{
switch (request->bRequest) {
case VENDOR_REQUEST_HONOR_FPGA_ADV:
return handle_honor_fpga_adv_finish(rhport, request);
default:
return true;
}
}


bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request)
{
Expand All @@ -209,10 +227,11 @@ bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_requ
return handle_vendor_request_setup(rhport, request);
case CONTROL_STAGE_DATA:
return handle_vendor_request_complete(rhport, request);
case CONTROL_STAGE_ACK:
return handle_vendor_request_finish(rhport, request);
default:
return true;;
return true;

}


}

0 comments on commit 3cd4f79

Please sign in to comment.