Skip to content

Instantly share code, notes, and snippets.

@sultanqasim
Created November 9, 2022 14:21
Show Gist options
  • Save sultanqasim/29416f61af312221ed0dcb48547d1596 to your computer and use it in GitHub Desktop.
Save sultanqasim/29416f61af312221ed0dcb48547d1596 to your computer and use it in GitHub Desktop.
static int
dfu_handle(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
{
struct usb_gadget *gadget = f->config->cdev->gadget;
struct usb_request *req = f->config->cdev->req;
struct f_dfu *f_dfu = f->config->cdev->req->context;
if (req_type == USB_TYPE_STANDARD) {
} else /* DFU specific request */
value = dfu_state[f_dfu->dfu_state] (f_dfu, ctrl, gadget, req);
if (value >= 0) {
req->length = value;
req->zero = value < len;
value = usb_ep_queue(gadget->ep0, req, 0);
if (value < 0) {
debug("ep_queue --> %d\n", value);
req->status = 0;
}
}
return value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment