FreeBSD kernel usb device Code
usb_device.c File Reference
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
#include <sys/eventhandler.h>
#include <sys/queue.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/module.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/condvar.h>
#include <sys/sysctl.h>
#include <sys/sx.h>
#include <sys/unistd.h>
#include <sys/callout.h>
#include <sys/malloc.h>
#include <sys/priv.h>
#include <sys/conf.h>
#include <sys/fcntl.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
#include <dev/usb/usb_ioctl.h>
#include "usbdevs.h"
#include <dev/usb/usb_core.h>
#include <dev/usb/usb_debug.h>
#include <dev/usb/usb_process.h>
#include <dev/usb/usb_device.h>
#include <dev/usb/usb_busdma.h>
#include <dev/usb/usb_transfer.h>
#include <dev/usb/usb_request.h>
#include <dev/usb/usb_dynamic.h>
#include <dev/usb/usb_hub.h>
#include <dev/usb/usb_util.h>
#include <dev/usb/usb_msctest.h>
#include <dev/usb/quirk/usb_quirk.h>
#include <dev/usb/usb_controller.h>
#include <dev/usb/usb_bus.h>
Include dependency graph for usb_device.c:

Go to the source code of this file.

Macros

#define USB_DEBUG_VAR   usb_debug
 

Functions

static int sysctl_hw_usb_template (SYSCTL_HANDLER_ARGS)
 
static void usb_init_endpoint (struct usb_device *, uint8_t, struct usb_endpoint_descriptor *, struct usb_endpoint_ss_comp_descriptor *, struct usb_endpoint *)
 
static void usb_unconfigure (struct usb_device *, uint8_t)
 
static void usb_detach_device_sub (struct usb_device *, device_t *, char **, uint8_t)
 
static uint8_t usb_probe_and_attach_sub (struct usb_device *, struct usb_attach_arg *)
 
static void usb_init_attach_arg (struct usb_device *, struct usb_attach_arg *)
 
static void usb_suspend_resume_sub (struct usb_device *, device_t, uint8_t)
 
static usb_error_t usb_config_parse (struct usb_device *, uint8_t, uint8_t)
 
 SYSCTL_PROC (_hw_usb, OID_AUTO, template, CTLTYPE_INT|CTLFLAG_RWTUN|CTLFLAG_MPSAFE, NULL, 0, sysctl_hw_usb_template, "I", "Selected USB device side template")
 
static void usb_trigger_reprobe_on_off (int on_not_off)
 
static void usb_trigger_reprobe_all (void)
 
 SYSCTL_INT (_hw_usb, OID_AUTO, usb_lang_id, CTLFLAG_RWTUN, &usb_lang_id, 0, "Preferred USB language ID")
 
 SYSCTL_INT (_hw_usb, OID_AUTO, usb_lang_mask, CTLFLAG_RWTUN, &usb_lang_mask, 0, "Preferred USB language mask")
 
const char * usb_statestr (enum usb_dev_state state)
 
const char * usb_get_manufacturer (struct usb_device *udev)
 
const char * usb_get_product (struct usb_device *udev)
 
const char * usb_get_serial (struct usb_device *udev)
 
struct usb_endpointusbd_get_ep_by_addr (struct usb_device *udev, uint8_t ea_val)
 
struct usb_endpointusbd_get_endpoint (struct usb_device *udev, uint8_t iface_index, const struct usb_config *setup)
 
usb_error_t usbd_interface_count (struct usb_device *udev, uint8_t *count)
 
struct usb_endpointusb_endpoint_foreach (struct usb_device *udev, struct usb_endpoint *ep)
 
static void usb_wait_pending_refs (struct usb_device *udev)
 
usb_error_t usbd_set_config_index (struct usb_device *udev, uint8_t index)
 
usb_error_t usbd_set_alt_interface_index (struct usb_device *udev, uint8_t iface_index, uint8_t alt_index)
 
usb_error_t usbd_set_endpoint_stall (struct usb_device *udev, struct usb_endpoint *ep, uint8_t do_stall)
 
usb_error_t usb_reset_iface_endpoints (struct usb_device *udev, uint8_t iface_index)
 
void usb_detach_device (struct usb_device *udev, uint8_t iface_index, uint8_t flag)
 
void usbd_set_parent_iface (struct usb_device *udev, uint8_t iface_index, uint8_t parent_index)
 
usb_error_t usb_probe_and_attach (struct usb_device *udev, uint8_t iface_index)
 
usb_error_t usb_suspend_resume (struct usb_device *udev, uint8_t do_suspend)
 
static void usbd_clear_stall_proc (struct usb_proc_msg *_pm)
 
void usb_get_langid (struct usb_device *udev)
 
struct usb_deviceusb_alloc_device (device_t parent_dev, struct usb_bus *bus, struct usb_device *parent_hub, uint8_t depth, uint8_t port_index, uint8_t port_no, enum usb_dev_speed speed, enum usb_hc_mode mode)
 
void usb_free_device (struct usb_device *udev, uint8_t flag)
 
struct usb_interfaceusbd_get_iface (struct usb_device *udev, uint8_t iface_index)
 
void * usbd_find_descriptor (struct usb_device *udev, void *id, uint8_t iface_index, uint8_t type, uint8_t type_mask, uint8_t subtype, uint8_t subtype_mask)
 
void usb_devinfo (struct usb_device *udev, char *dst_ptr, uint16_t dst_len)
 
void usb_set_device_strings (struct usb_device *udev)
 
enum usb_hc_mode usbd_get_mode (struct usb_device *udev)
 
enum usb_dev_speed usbd_get_speed (struct usb_device *udev)
 
uint32_t usbd_get_isoc_fps (struct usb_device *udev)
 
struct usb_device_descriptorusbd_get_device_descriptor (struct usb_device *udev)
 
struct usb_config_descriptorusbd_get_config_descriptor (struct usb_device *udev)
 
uint8_t usb_test_quirk (const struct usb_attach_arg *uaa, uint16_t quirk)
 
struct usb_interface_descriptorusbd_get_interface_descriptor (struct usb_interface *iface)
 
uint8_t usbd_get_interface_altindex (struct usb_interface *iface)
 
uint8_t usbd_get_bus_index (struct usb_device *udev)
 
uint8_t usbd_get_device_index (struct usb_device *udev)
 
uint8_t usb_peer_can_wakeup (struct usb_device *udev)
 
void usb_set_device_state (struct usb_device *udev, enum usb_dev_state state)
 
enum usb_dev_state usb_get_device_state (struct usb_device *udev)
 
uint8_t usbd_device_attached (struct usb_device *udev)
 
uint8_t usbd_enum_lock (struct usb_device *udev)
 
void usbd_enum_unlock (struct usb_device *udev)
 
void usbd_sr_lock (struct usb_device *udev)
 
void usbd_sr_unlock (struct usb_device *udev)
 
uint8_t usbd_enum_is_locked (struct usb_device *udev)
 
uint8_t usbd_ctrl_lock (struct usb_device *udev)
 
void usbd_ctrl_unlock (struct usb_device *udev)
 
usb_error_t usbd_set_pnpinfo (struct usb_device *udev, uint8_t iface_index, const char *pnpinfo)
 
usb_error_t usbd_add_dynamic_quirk (struct usb_device *udev, uint16_t quirk)
 
usb_error_t usbd_set_endpoint_mode (struct usb_device *udev, struct usb_endpoint *ep, uint8_t ep_mode)
 
uint8_t usbd_get_endpoint_mode (struct usb_device *udev, struct usb_endpoint *ep)
 

Variables

static usb_proc_callback_t usbd_clear_stall_proc
 
int usb_template = -1
 
static int usb_lang_id = 0x0009
 
static int usb_lang_mask = 0x00FF
 
static const char * statestr [USB_STATE_MAX]
 

Macro Definition Documentation

◆ USB_DEBUG_VAR

#define USB_DEBUG_VAR   usb_debug

Definition at line 64 of file usb_device.c.

Function Documentation

◆ sysctl_hw_usb_template()

static int sysctl_hw_usb_template ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 235 of file usb_device.c.

References error, req, usb_template, usb_trigger_reprobe_all(), usb_trigger_reprobe_on_off(), and val.

Here is the call graph for this function:

◆ SYSCTL_INT() [1/2]

SYSCTL_INT ( _hw_usb  ,
OID_AUTO  ,
usb_lang_id  ,
CTLFLAG_RWTUN  ,
usb_lang_id,
,
"Preferred USB language ID"   
)

◆ SYSCTL_INT() [2/2]

SYSCTL_INT ( _hw_usb  ,
OID_AUTO  ,
usb_lang_mask  ,
CTLFLAG_RWTUN  ,
usb_lang_mask,
,
"Preferred USB language mask"   
)

◆ SYSCTL_PROC()

SYSCTL_PROC ( _hw_usb  ,
OID_AUTO  ,
template  ,
CTLTYPE_INT|CTLFLAG_RWTUN|  CTLFLAG_MPSAFE,
NULL  ,
,
sysctl_hw_usb_template  ,
"I"  ,
"Selected USB device side template"   
)

◆ usb_alloc_device()

struct usb_device * usb_alloc_device ( device_t  parent_dev,
struct usb_bus bus,
struct usb_device parent_hub,
uint8_t  depth,
uint8_t  port_index,
uint8_t  port_no,
enum usb_dev_speed  speed,
enum usb_hc_mode  mode 
)

Definition at line 1737 of file usb_device.c.

References usb_device::address, usb_endpoint_descriptor::bDescriptorType, usb_endpoint_ss_comp_descriptor::bDescriptorType, usb_bus::bdev, usb_endpoint_descriptor::bEndpointAddress, usb_endpoint_descriptor::bInterval, usb_endpoint_descriptor::bLength, usb_endpoint_ss_comp_descriptor::bLength, usb_endpoint_descriptor::bmAttributes, usb_device_descriptor::bMaxPacketSize, usb_device_descriptor::bNumConfigurations, usb_config_descriptor::bNumInterface, usb_device::bus, usb_device::cdesc, usb_device::cs_msg, usb_device::ctrl_ep, usb_device::ctrl_ep_comp_desc, usb_device::ctrl_ep_desc, usb_device::ctrl_sx, usb_device::ctrlreq_cv, usb_device::curr_config_index, usb_device::curr_config_no, usb_device::ddesc, usb_device::depth, usb_device::device_index, usb_bus_methods::device_init, usb_device::device_mtx, usb_bus::devices, usb_bus::devices_max, DPRINTF, usb_device::enum_sx, usb_device::flags, usb_udev_msg::hdr, usb_device::hs_hub_addr, usb_device::hs_port_no, usb_device::hub, usb_power_save::last_xfer_time, usb_bus::methods, usb_device_flags::no_strings, usb_device::parent_dev, usb_device::parent_hs_hub, usb_device::parent_hub, usb_device::plugtime, usb_proc_msg::pm_callback, usb_device::port_index, usb_device::port_no, usb_hub::ports, usb_device::power, usb_device::power_mode, usb_device::pwr_save, usb_device::ref_cv, usb_device::refcount, usb_device_flags::self_powered, usb_device::speed, usb_device::sr_sx, UDESC_ENDPOINT, UDESC_ENDPOINT_SS_COMP, usb_udev_msg::udev, UE_CONTROL, UQ_BUS_POWERED, usb_device_flags::uq_bus_powered, UQ_CFG_INDEX_0, UQ_CFG_INDEX_1, UQ_CFG_INDEX_2, UQ_CFG_INDEX_3, UQ_CFG_INDEX_4, UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_PREVENT_ALLOW, UQ_MSC_NO_START_STOP, UQ_MSC_NO_SYNC_CACHE, UQ_MSC_NO_TEST_UNIT_READY, UQ_NO_STRINGS, usb_alloc_symlink(), usb_bus_port_set_device(), USB_CONTROL_ENDPOINT, usb_free_device(), USB_GENERIC_NAME, usb_get_langid(), usb_get_manufacturer(), usb_get_product(), usb_iface_is_cdrom(), usb_init_attach_arg(), usb_init_endpoint(), USB_MAX_IPACKET, USB_MIN_POWER, usb_device_flags::usb_mode, USB_MODE_DEVICE, USB_MODE_HOST, usb_msc_auto_quirk(), USB_POWER_MODE_ON, USB_ROOT_HUB_ADDR, usb_set_device_state(), usb_set_device_strings(), USB_SPEED_HIGH, USB_START_ADDR, USB_STATE_ADDRESSED, USB_STATE_POWERED, usb_temp_setup_by_index_p, usb_template, usb_test_quirk(), USB_UNCONFIG_INDEX, USB_UNCONFIG_NO, usbd_clear_stall_proc, usbd_errstr(), usbd_filter_power_mode(), usbd_get_no_descriptors(), usbd_req_re_enumerate(), usbd_req_set_address(), usbd_set_config_index(), usbd_setup_device_desc(), and usb_endpoint_descriptor::wMaxPacketSize.

Referenced by uhub_reattach_port(), and usb_bus_attach().

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

◆ usb_config_parse()

◆ usb_detach_device()

void usb_detach_device ( struct usb_device udev,
uint8_t  iface_index,
uint8_t  flag 
)

Definition at line 1264 of file usb_device.c.

References usb_device::enum_sx, usb_interface::pnpinfo, usb_interface::subdev, usb_detach_device_sub(), USB_IFACE_INDEX_ANY, USB_IFACE_MAX, and usbd_get_iface().

Referenced by bbb_attach(), and usb_unconfigure().

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

◆ usb_detach_device_sub()

static void usb_detach_device_sub ( struct usb_device udev,
device_t *  ppdev,
char **  ppnpinfo,
uint8_t  flag 
)
static

Definition at line 1206 of file usb_device.c.

References usb_device::address, dev, error, usb_device::flags, usb_device::parent_dev, usb_device_flags::peer_suspended, and usb_device::port_no.

Referenced by usb_detach_device().

Here is the caller graph for this function:

◆ usb_devinfo()

void usb_devinfo ( struct usb_device udev,
char *  dst_ptr,
uint16_t  dst_len 
)

◆ usb_endpoint_foreach()

struct usb_endpoint * usb_endpoint_foreach ( struct usb_device udev,
struct usb_endpoint ep 
)

◆ usb_free_device()

◆ usb_get_device_state()

enum usb_dev_state usb_get_device_state ( struct usb_device udev)

Definition at line 2877 of file usb_device.c.

References usb_device::state, and USB_STATE_DETACHED.

Referenced by xhci_device_state_change().

Here is the caller graph for this function:

◆ usb_get_langid()

◆ 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_init_attach_arg()

◆ usb_init_endpoint()

◆ usb_peer_can_wakeup()

uint8_t usb_peer_can_wakeup ( struct usb_device udev)

◆ usb_probe_and_attach()

◆ usb_probe_and_attach_sub()

static uint8_t usb_probe_and_attach_sub ( struct usb_device udev,
struct usb_attach_arg uaa 
)
static

◆ usb_reset_iface_endpoints()

usb_error_t usb_reset_iface_endpoints ( struct usb_device udev,
uint8_t  iface_index 
)

Definition at line 1178 of file usb_device.c.

References usb_endpoint::edesc, usb_device::endpoints, usb_device::endpoints_max, usb_endpoint::iface_index, and usbd_set_endpoint_stall().

Referenced by usb_handle_iface_request().

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

◆ usb_set_device_state()

void usb_set_device_state ( struct usb_device udev,
enum usb_dev_state  state 
)

Definition at line 2857 of file usb_device.c.

References usb_device::bus, usb_bus_methods::device_state_change, DPRINTF, usb_bus::methods, usb_device::state, state, usb_ref_lock, USB_STATE_MAX, and usb_statestr().

Referenced by usb_alloc_device(), usb_free_device(), usbd_req_re_enumerate(), and usbd_set_config_index().

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

◆ usb_set_device_strings()

◆ usb_statestr()

const char * usb_statestr ( enum usb_dev_state  state)

Definition at line 275 of file usb_device.c.

References usb_device::state, statestr, and USB_STATE_MAX.

Referenced by usb_set_device_state().

Here is the caller graph for this function:

◆ usb_suspend_resume()

usb_error_t usb_suspend_resume ( struct usb_device udev,
uint8_t  do_suspend 
)

Definition at line 1586 of file usb_device.c.

References usb_device::bus, usb_device::flags, usb_device_flags::peer_suspended, usb_device::sr_sx, usb_interface::subdev, USB_BUS_LOCK, USB_BUS_UNLOCK, USB_IFACE_MAX, usb_suspend_resume_sub(), and usbd_get_iface().

Referenced by usb_dev_resume_peer(), and usb_dev_suspend_peer().

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

◆ usb_suspend_resume_sub()

static void usb_suspend_resume_sub ( struct usb_device udev,
device_t  dev,
uint8_t  do_suspend 
)
static

Definition at line 1555 of file usb_device.c.

References dev.

Referenced by usb_suspend_resume().

Here is the caller graph for this function:

◆ usb_test_quirk()

◆ usb_trigger_reprobe_all()

static void usb_trigger_reprobe_all ( void  )
static

Definition at line 215 of file usb_device.c.

References USB_MS_TO_TICKS, usb_pause_mtx(), USB_POWER_DOWN_TIME, and usb_trigger_reprobe_on_off().

Referenced by sysctl_hw_usb_template().

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

◆ usb_trigger_reprobe_on_off()

◆ usb_unconfigure()

◆ usb_wait_pending_refs()

static void usb_wait_pending_refs ( struct usb_device udev)
static

Definition at line 587 of file usb_device.c.

References DPRINTF, usb_device::ref_cv, usb_device::refcount, USB_DEV_REF_MAX, and usb_ref_lock.

Referenced by usb_free_device().

Here is the caller graph for this function:

◆ usbd_add_dynamic_quirk()

usb_error_t usbd_add_dynamic_quirk ( struct usb_device udev,
uint16_t  quirk 
)

Definition at line 3045 of file usb_device.c.

References usb_device::autoQuirk, USB_ERR_NOMEM, and USB_MAX_AUTO_QUIRK.

◆ usbd_clear_stall_proc()

static void usbd_clear_stall_proc ( struct usb_proc_msg _pm)
static

◆ usbd_ctrl_lock()

uint8_t usbd_ctrl_lock ( struct usb_device udev)

Definition at line 2983 of file usb_device.c.

References usb_device::ctrl_sx, usbd_enum_is_locked(), and usbd_sr_unlock().

Referenced by device_set_usb_desc(), uhub_child_pnpinfo(), usb_get_langid(), usb_set_device_strings(), usb_temp_setup(), usbd_do_request_flags(), and usbd_transfer_setup().

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

◆ usbd_ctrl_unlock()

void usbd_ctrl_unlock ( struct usb_device udev)

Definition at line 2999 of file usb_device.c.

References usb_device::ctrl_sx, usbd_enum_is_locked(), and usbd_sr_lock().

Referenced by device_set_usb_desc(), uhub_child_pnpinfo(), usb_get_langid(), usb_set_device_strings(), usb_temp_setup(), usbd_do_request_flags(), and usbd_transfer_setup().

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

◆ usbd_device_attached()

uint8_t usbd_device_attached ( struct usb_device udev)

Definition at line 2885 of file usb_device.c.

References usb_device::state, and USB_STATE_DETACHED.

◆ usbd_enum_is_locked()

uint8_t usbd_enum_is_locked ( struct usb_device udev)

Definition at line 2972 of file usb_device.c.

References usb_device::enum_sx.

Referenced by usbd_ctrl_lock(), and usbd_ctrl_unlock().

Here is the caller graph for this function:

◆ usbd_enum_lock()

◆ usbd_enum_unlock()

◆ usbd_find_descriptor()

void * usbd_find_descriptor ( struct usb_device udev,
void *  id,
uint8_t  iface_index,
uint8_t  type,
uint8_t  type_mask,
uint8_t  subtype,
uint8_t  subtype_mask 
)

Definition at line 2395 of file usb_device.c.

References usb_endpoint_descriptor::bDescriptorType, desc, type, UDESC_INTERFACE, usb_desc_foreach(), usbd_get_config_descriptor(), usbd_get_iface(), and usbd_get_interface_descriptor().

Referenced by cdce_attach(), uhso_attach_muxserial(), umodem_attach(), umodem_get_desc(), and urndis_attach().

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

◆ usbd_get_bus_index()

uint8_t usbd_get_bus_index ( struct usb_device udev)

Definition at line 2668 of file usb_device.c.

References usb_bus::bdev, and usb_device::bus.

Referenced by uftdi_probe().

Here is the caller graph for this function:

◆ usbd_get_config_descriptor()

◆ usbd_get_device_descriptor()

struct usb_device_descriptor * usbd_get_device_descriptor ( struct usb_device udev)

Definition at line 2608 of file usb_device.c.

References usb_device::ddesc.

Referenced by kue_load_fw(), uftdi_devtype_setup(), and uplcom_attach().

Here is the caller graph for this function:

◆ usbd_get_device_index()

uint8_t usbd_get_device_index ( struct usb_device udev)

Definition at line 2674 of file usb_device.c.

References usb_device::device_index.

Referenced by uftdi_probe().

Here is the caller graph for this function:

◆ usbd_get_endpoint()

◆ usbd_get_endpoint_mode()

uint8_t usbd_get_endpoint_mode ( struct usb_device udev,
struct usb_endpoint ep 
)

Definition at line 3092 of file usb_device.c.

References usb_endpoint::ep_mode.

◆ usbd_get_ep_by_addr()

struct usb_endpoint * usbd_get_ep_by_addr ( struct usb_device udev,
uint8_t  ea_val 
)

◆ usbd_get_iface()

◆ usbd_get_interface_altindex()

uint8_t usbd_get_interface_altindex ( struct usb_interface iface)

Definition at line 2662 of file usb_device.c.

References usb_interface::alt_index.

◆ usbd_get_interface_descriptor()

◆ usbd_get_isoc_fps()

uint32_t usbd_get_isoc_fps ( struct usb_device udev)

Definition at line 2595 of file usb_device.c.

References usb_device::speed, USB_SPEED_FULL, and USB_SPEED_LOW.

◆ usbd_get_mode()

enum usb_hc_mode usbd_get_mode ( struct usb_device udev)

Definition at line 2579 of file usb_device.c.

References usb_device::flags, and usb_device_flags::usb_mode.

Referenced by cdce_bulk_read_callback(), cdce_bulk_write_callback(), cdce_init(), cdce_intr_read_callback(), cdce_intr_write_callback(), and cdceem_init().

Here is the caller graph for this function:

◆ usbd_get_speed()

◆ usbd_interface_count()

usb_error_t usbd_interface_count ( struct usb_device udev,
uint8_t *  count 
)

◆ usbd_set_alt_interface_index()

usb_error_t usbd_set_alt_interface_index ( struct usb_device udev,
uint8_t  iface_index,
uint8_t  alt_index 
)

◆ usbd_set_config_index()

◆ usbd_set_endpoint_mode()

usb_error_t usbd_set_endpoint_mode ( struct usb_device udev,
struct usb_endpoint ep,
uint8_t  ep_mode 
)

Definition at line 3065 of file usb_device.c.

References usb_device::bus, usb_endpoint::ep_mode, error, usb_bus::methods, usb_bus_methods::set_endpoint_mode, USB_EP_MODE_DEFAULT, USB_ERR_INVAL, usbd_enum_lock(), and usbd_enum_unlock().

Referenced by usb_init_endpoint().

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

◆ usbd_set_endpoint_stall()

◆ usbd_set_parent_iface()

void usbd_set_parent_iface ( struct usb_device udev,
uint8_t  iface_index,
uint8_t  parent_index 
)

Definition at line 1395 of file usb_device.c.

References usb_interface::parent_iface_index, and usbd_get_iface().

Referenced by cdce_attach(), g_audio_attach(), g_modem_attach(), u3g_attach(), ufoma_modem_setup(), ugensa_attach(), ugold_attach(), umodem_attach(), uplcom_attach(), and usie_attach().

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

◆ usbd_set_pnpinfo()

usb_error_t usbd_set_pnpinfo ( struct usb_device udev,
uint8_t  iface_index,
const char *  pnpinfo 
)

Definition at line 3021 of file usb_device.c.

References usb_interface::pnpinfo, USB_ERR_INVAL, USB_ERR_NOMEM, and usbd_get_iface().

Referenced by ucom_set_pnpinfo_usb().

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

◆ usbd_sr_lock()

void usbd_sr_lock ( struct usb_device udev)

Definition at line 2946 of file usb_device.c.

References usb_device::sr_sx.

Referenced by usb_dev_resume_peer(), usb_dev_suspend_peer(), and usbd_ctrl_unlock().

Here is the caller graph for this function:

◆ usbd_sr_unlock()

void usbd_sr_unlock ( struct usb_device udev)

Definition at line 2960 of file usb_device.c.

References usb_device::sr_sx.

Referenced by usb_dev_resume_peer(), usb_dev_suspend_peer(), and usbd_ctrl_lock().

Here is the caller graph for this function:

Variable Documentation

◆ statestr

const char* statestr[USB_STATE_MAX]
static
Initial value:
= {
[USB_STATE_DETACHED] = "DETACHED",
[USB_STATE_ATTACHED] = "ATTACHED",
[USB_STATE_POWERED] = "POWERED",
[USB_STATE_ADDRESSED] = "ADDRESSED",
[USB_STATE_CONFIGURED] = "CONFIGURED",
}
@ USB_STATE_POWERED
Definition: usb.h:790
@ USB_STATE_CONFIGURED
Definition: usb.h:792
@ USB_STATE_DETACHED
Definition: usb.h:788
@ USB_STATE_ATTACHED
Definition: usb.h:789
@ USB_STATE_ADDRESSED
Definition: usb.h:791

Definition at line 266 of file usb_device.c.

Referenced by usb_statestr().

◆ usb_lang_id

int usb_lang_id = 0x0009
static

Definition at line 257 of file usb_device.c.

Referenced by usb_get_langid().

◆ usb_lang_mask

int usb_lang_mask = 0x00FF
static

Definition at line 258 of file usb_device.c.

Referenced by usb_get_langid().

◆ usb_template

int usb_template = -1

Definition at line 120 of file usb_device.c.

Referenced by sysctl_hw_usb_template(), and usb_alloc_device().

◆ usbd_clear_stall_proc

usb_proc_callback_t usbd_clear_stall_proc
static

Definition at line 104 of file usb_device.c.

Referenced by usb_alloc_device().