FreeBSD kernel usb device Code
usbdi_util.h File Reference

Go to the source code of this file.

Data Structures

struct  usb_idesc_parse_state
 

Functions

usb_error_t usbd_do_request_proc (struct usb_device *udev, struct usb_process *pproc, struct usb_device_request *req, void *data, uint16_t flags, uint16_t *actlen, usb_timeout_t timeout)
 
struct usb_descriptorusb_desc_foreach (struct usb_config_descriptor *cd, struct usb_descriptor *desc)
 
struct usb_interface_descriptorusb_idesc_foreach (struct usb_config_descriptor *cd, struct usb_idesc_parse_state *ps)
 
struct usb_endpoint_descriptorusb_edesc_foreach (struct usb_config_descriptor *cd, struct usb_endpoint_descriptor *ped)
 
struct usb_endpoint_ss_comp_descriptorusb_ed_comp_foreach (struct usb_config_descriptor *cd, struct usb_endpoint_ss_comp_descriptor *ped)
 
uint8_t usbd_get_no_descriptors (struct usb_config_descriptor *cd, uint8_t type)
 
uint8_t usbd_get_no_alts (struct usb_config_descriptor *cd, struct usb_interface_descriptor *id)
 
usb_error_t usbd_req_get_report (struct usb_device *udev, struct mtx *mtx, void *data, uint16_t len, uint8_t iface_index, uint8_t type, uint8_t id)
 
usb_error_t usbd_req_get_report_descriptor (struct usb_device *udev, struct mtx *mtx, void *d, uint16_t size, uint8_t iface_index)
 
usb_error_t usbd_req_get_string_any (struct usb_device *udev, struct mtx *mtx, char *buf, uint16_t len, uint8_t string_index)
 
usb_error_t usbd_req_get_string_desc (struct usb_device *udev, struct mtx *mtx, void *sdesc, uint16_t max_len, uint16_t lang_id, uint8_t string_index)
 
usb_error_t usbd_req_set_config (struct usb_device *udev, struct mtx *mtx, uint8_t conf)
 
usb_error_t usbd_req_set_alt_interface_no (struct usb_device *udev, struct mtx *mtx, uint8_t iface_index, uint8_t alt_no)
 
usb_error_t usbd_req_set_idle (struct usb_device *udev, struct mtx *mtx, uint8_t iface_index, uint8_t duration, uint8_t id)
 
usb_error_t usbd_req_set_protocol (struct usb_device *udev, struct mtx *mtx, uint8_t iface_index, uint16_t report)
 
usb_error_t usbd_req_set_report (struct usb_device *udev, struct mtx *mtx, void *data, uint16_t len, uint8_t iface_index, uint8_t type, uint8_t id)
 
const char * usb_get_manufacturer (struct usb_device *)
 
const char * usb_get_product (struct usb_device *)
 
const char * usb_get_serial (struct usb_device *)
 

Function Documentation

◆ usb_desc_foreach()

◆ usb_ed_comp_foreach()

struct usb_endpoint_ss_comp_descriptor * usb_ed_comp_foreach ( struct usb_config_descriptor cd,
struct usb_endpoint_ss_comp_descriptor ped 
)

Definition at line 234 of file usb_parse.c.

References usb_endpoint_descriptor::bDescriptorType, usb_endpoint_descriptor::bLength, desc, UDESC_ENDPOINT, UDESC_ENDPOINT_SS_COMP, UDESC_INTERFACE, and usb_desc_foreach().

Referenced by usb_config_parse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ usb_edesc_foreach()

struct usb_endpoint_descriptor * usb_edesc_foreach ( struct usb_config_descriptor cd,
struct usb_endpoint_descriptor ped 
)

Definition at line 199 of file usb_parse.c.

References usb_endpoint_descriptor::bDescriptorType, usb_endpoint_descriptor::bLength, desc, UDESC_ENDPOINT, UDESC_INTERFACE, and usb_desc_foreach().

Referenced by usb_config_parse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ usb_get_manufacturer()

const char * usb_get_manufacturer ( struct usb_device udev)

Definition at line 281 of file usb_device.c.

References usb_device::manufacturer.

Referenced by u3g_test_autoinst(), ubser_probe(), uhso_attach(), usb_alloc_device(), usb_devinfo(), usb_free_device(), usbhid_fill_device_info(), and usie_autoinst().

Here is the caller graph for this function:

◆ usb_get_product()

const char * usb_get_product ( struct usb_device udev)

Definition at line 287 of file usb_device.c.

References usb_device::product.

Referenced by is_jtag_interface(), u3g_test_autoinst(), uftdi_probe(), uhso_attach(), usb_alloc_device(), usb_devinfo(), usb_free_device(), usbhid_fill_device_info(), and usie_autoinst().

Here is the caller graph for this function:

◆ usb_get_serial()

const char * usb_get_serial ( struct usb_device udev)

Definition at line 293 of file usb_device.c.

References usb_device::serial.

Referenced by udl_select_chip(), uep_attach(), uhub_child_pnpinfo(), ukbd_attach(), umass_cam_action(), umass_cam_cb(), ums_attach(), usbhid_fill_device_info(), wmt_attach(), and wsp_attach().

Here is the caller graph for this function:

◆ usb_idesc_foreach()

struct usb_interface_descriptor * usb_idesc_foreach ( struct usb_config_descriptor cd,
struct usb_idesc_parse_state ps 
)

Definition at line 126 of file usb_parse.c.

References usb_idesc_parse_state::desc, DPRINTF, id, usb_idesc_parse_state::iface_index, usb_idesc_parse_state::iface_index_alt, usb_idesc_parse_state::iface_no_last, UDESC_INTERFACE, usb_desc_foreach(), and USB_IFACE_MAX.

Referenced by usb_config_parse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ usbd_do_request_proc()

usb_error_t usbd_do_request_proc ( struct usb_device udev,
struct usb_process pproc,
struct usb_device_request req,
void *  data,
uint16_t  flags,
uint16_t *  actlen,
usb_timeout_t  timeout 
)

Definition at line 742 of file usb_request.c.

References usb_xfer::actlen, data, usb_xfer::flags, len, req, usb_xfer::timeout, UE_DIR_IN, UGETW, usb_process::up_mtx, USB_ERR_IOERROR, usb_proc_is_gone(), and usbd_do_request_flags().

Referenced by umcs7840_get_reg_sync(), umcs7840_get_UART_reg_sync(), umcs7840_set_reg_sync(), and umcs7840_set_UART_reg_sync().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ usbd_get_no_alts()

uint8_t usbd_get_no_alts ( struct usb_config_descriptor cd,
struct usb_interface_descriptor id 
)

Definition at line 288 of file usb_parse.c.

References usb_endpoint_descriptor::bDescriptorType, usb_endpoint_descriptor::bLength, desc, id, n, UDESC_INTERFACE, and usb_desc_foreach().

Referenced by usb_check_alt_setting().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ usbd_get_no_descriptors()

uint8_t usbd_get_no_descriptors ( struct usb_config_descriptor cd,
uint8_t  type 
)

Definition at line 264 of file usb_parse.c.

References usb_endpoint_descriptor::bDescriptorType, count, desc, type, and usb_desc_foreach().

Referenced by usb_alloc_device().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ usbd_req_get_report()

usb_error_t usbd_req_get_report ( struct usb_device udev,
struct mtx *  mtx,
void *  data,
uint16_t  len,
uint8_t  iface_index,
uint8_t  type,
uint8_t  id 
)

◆ usbd_req_get_report_descriptor()

usb_error_t usbd_req_get_report_descriptor ( struct usb_device udev,
struct mtx *  mtx,
void *  d,
uint16_t  size,
uint8_t  iface_index 
)

Definition at line 1890 of file usb_request.c.

References usb_interface_descriptor::bInterfaceNumber, usb_interface::idesc, req, size, UDESC_REPORT, UR_GET_DESCRIPTOR, USB_ERR_INVAL, usbd_do_request, usbd_get_iface(), USETW, USETW2, and UT_READ_INTERFACE.

Referenced by usbd_req_get_hid_desc(), and usbhid_get_rdesc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ usbd_req_get_string_any()

usb_error_t usbd_req_get_string_any ( struct usb_device udev,
struct mtx *  mtx,
char *  buf,
uint16_t  len,
uint8_t  string_index 
)

Definition at line 1100 of file usb_request.c.

References usb_device::flags, usb_device::langid, len, n, usb_device_flags::no_strings, UGETW, USB_ERR_INVAL, USB_ERR_NORMAL_COMPLETION, USB_ERR_STALLED, and usbd_req_get_string_desc().

Referenced by cdce_attach(), device_set_usb_desc(), and usb_set_device_strings().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ usbd_req_get_string_desc()

usb_error_t usbd_req_get_string_desc ( struct usb_device udev,
struct mtx *  mtx,
void *  sdesc,
uint16_t  max_len,
uint16_t  lang_id,
uint8_t  string_index 
)

Definition at line 1206 of file usb_request.c.

References UDESC_STRING, and usbd_req_get_desc().

Referenced by usb_get_langid(), and usbd_req_get_string_any().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ usbd_req_set_alt_interface_no()

usb_error_t usbd_req_set_alt_interface_no ( struct usb_device udev,
struct mtx *  mtx,
uint8_t  iface_index,
uint8_t  alt_no 
)

Definition at line 1434 of file usb_request.c.

References usb_interface_descriptor::bInterfaceNumber, DPRINTF, usb_interface::idesc, usb_interface::num_altsetting, req, UR_SET_INTERFACE, USB_ERR_INVAL, USB_ERR_STALLED, usbd_do_request, usbd_get_iface(), USETW, and UT_WRITE_INTERFACE.

Referenced by u3g_sael_m460_init(), and usbd_set_alt_interface_index().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ usbd_req_set_config()

usb_error_t usbd_req_set_config ( struct usb_device udev,
struct mtx *  mtx,
uint8_t  conf 
)

Definition at line 1920 of file usb_request.c.

References DPRINTF, req, UR_SET_CONFIG, usbd_do_request, USETW, and UT_WRITE_DEVICE.

Referenced by axe_reset(), axge_reset(), kue_reset(), muge_reset(), smsc_reset(), usbd_set_config_index(), and zyd_init_locked().

Here is the caller graph for this function:

◆ usbd_req_set_idle()

usb_error_t usbd_req_set_idle ( struct usb_device udev,
struct mtx *  mtx,
uint8_t  iface_index,
uint8_t  duration,
uint8_t  id 
)

Definition at line 1862 of file usb_request.c.

References usb_interface_descriptor::bInterfaceNumber, usb_interface::idesc, req, UR_SET_IDLE, USB_ERR_INVAL, usbd_do_request, usbd_get_iface(), USETW, USETW2, and UT_WRITE_CLASS_INTERFACE.

Referenced by uhid_attach(), ukbd_attach(), and usbhid_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ usbd_req_set_protocol()

usb_error_t usbd_req_set_protocol ( struct usb_device udev,
struct mtx *  mtx,
uint8_t  iface_index,
uint16_t  report 
)

Definition at line 1777 of file usb_request.c.

References usb_interface_descriptor::bInterfaceNumber, usb_interface::idesc, report, req, UR_SET_PROTOCOL, USB_ERR_INVAL, usbd_do_request, usbd_get_iface(), USETW, and UT_WRITE_CLASS_INTERFACE.

Referenced by ukbd_attach(), and ums_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ usbd_req_set_report()

usb_error_t usbd_req_set_report ( struct usb_device udev,
struct mtx *  mtx,
void *  data,
uint16_t  len,
uint8_t  iface_index,
uint8_t  type,
uint8_t  id 
)