USB Transfers (in FreeBSD)

Recall that callback is executed before and after the endpoint specified by type, endpoint, and direction transfers data. Below is its function prototype:

typedef void (usb_callback_t)(struct usb_xfer *, usb_error_t);

Here, struct usb_xfer * contains the transfer state:

struct usb_xfer { ... uint8_t usb_state; /* Set when callback is executed before a data transfer. */ #define USB_ST_SETUP 0 /* Set when callback is executed after a data transfer. */ #define USB_ST_TRANSFERRED 1 /* Set when a transfer error occurs. */ #define ...

Get FreeBSD Device Drivers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.