JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
man pages section 9: DDI and DKI Properties and Data Structures     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

Introduction

Data Structures for Drivers

aio_req(9S)

audio_engine_ops(9S)

blksize(9P)

buf(9S)

cb_ops(9S)

copyreq(9S)

copyresp(9S)

datab(9S)

dblk(9S)

ddi_device_acc_attr(9S)

ddi_dma_attr(9S)

ddi_dma_cookie(9S)

ddi_dmae_req(9S)

ddi_dma_lim(9S)

ddi_dma_lim_sparc(9S)

ddi_dma_lim_x86(9S)

ddi_dma_req(9S)

ddi_fm_error(9S)

ddi-forceattach(9P)

ddi_idevice_cookie(9S)

ddi-no-autodetach(9P)

ddi-no-modunload(9P)

device-blksize(9P)

device-nblocks(9P)

device-pblksize(9P)

devmap_callback_ctl(9S)

dev_ops(9S)

fmodsw(9S)

free_rtn(9S)

gld_mac_info(9S)

gld_stats(9S)

hook_nic_event(9S)

hook_pkt_event(9S)

hook_t(9S)

inquiry-device-type(9P)

inquiry-product-id(9P)

inquiry-revision-id(9P)

inquiry-serial-no(9P)

inquiry-vendor-id(9P)

iocblk(9S)

iovec(9S)

kstat(9S)

kstat_intr(9S)

kstat_io(9S)

kstat_named(9S)

linkblk(9S)

lso_basic_tcp_ipv4(9S)

mac_callbacks(9S)

mac_capab_lso(9S)

mac_capab_rings(9S)

mac_group_info(9S)

mac_register(9S)

mac_ring_info(9S)

mblk(9S)

modldrv(9S)

modlinkage(9S)

modlmisc(9S)

modlstrmod(9S)

module_info(9S)

msgb(9S)

Nblock(9P)

net_inject_t(9S)

net_instance_t(9S)

no-involuntary-power-cycles(9P)

pblksize(9P)

pm(9P)

pm-components(9P)

qband(9S)

qinit(9S)

queclass(9S)

queue(9S)

removable-media(9P)

scsi_address(9S)

scsi_arq_status(9S)

scsi_asc_key_strings(9S)

scsi_device(9S)

scsi_extended_sense(9S)

scsi_hba_tran(9S)

scsi_inquiry(9S)

scsi_pkt(9S)

scsi_status(9S)

size(9P)

sof_ops(9S)

streamtab(9S)

stroptions(9S)

tuple(9S)

uio(9S)

usb_bulk_request(9S)

usb_callback_flags(9S)

usb_cfg_descr(9S)

usb_client_dev_data(9S)

usb_completion_reason(9S)

usb_ctrl_request(9S)

usb_dev_descr(9S)

usb_dev_qlf_descr(9S)

usb_ep_descr(9S)

usb_if_descr(9S)

usb_intr_request(9S)

usb_isoc_request(9S)

usb_other_speed_cfg_descr(9S)

usb_request_attributes(9S)

usb_string_descr(9S)

usb_client_dev_data

- Device configuration information

Synopsis

#include <sys/usb/usba.h> 

Interface Level

Solaris DDI specific (Solaris DDI)

Description

The usb_client_dev_data_t structure carries all device configuration information. It is provided to a USB client driver through a call to usb_get_dev_data(9F). Most USBA functions require information which comes from this structure.

The usb_client_dev_data_t structure fields are:

 usb_pipe_handle_t   dev_default_ph;   /* deflt ctrl pipe handle */

 ddi_iblock_cookie_t dev_iblock_cookie;/* for calls to mutex_init */
                                       /* for mutexes used by intr */
                                       /* context callbacks. */

 usb_dev_descr_t     *dev_descr;      /* parsed* dev. descriptor */

 char                *dev_mfg;        /* manufacturer's ID string */

 char                *dev_product;    /* product ID string */

 char                *dev_serial;     /* serial num. string */

 usb_reg_parse_lvl_t dev_parse_level; /* Parse level */
                                      /* reflecting the tree */
                                      /* (if any) returned through */
                                      /* the dev_cfg array. */

 usb_cfg_data_t      *dev_cfg;        /* parsed* descr  tree.*/

 uint_t              dev_n_cfg;       /* num cfgs in parsed descr. */
                                      /* tree, dev_cfg array below.*/

 usb_cfg_data_t      *dev_curr_cfg;   /* Pointer to the tree config*/
                                      /* corresponding to the cfg */
                                      /* active at the time of the */
                                      /* usb_get_dev_data() call */

 int                 dev_curr_if;     /* First active interface in */
                                      /* tree under driver's control.*/

                                      /* Always zero when driver */
                                      /* controls whole device. */

* A parsed descriptor is in a struct whose fields' have been adjusted
  to the host processor.  This may include endianness adjustment (the USB
  standard defines that devices report in little-endian bit order) or
  structure padding as necessary.

dev_parse_level represents the extent of the device represented by the tree returned by the dev_cfg field and has the following possible values:

USB_PARSE_LVL_NONE

Build no tree. dev_n_cfg returns 0, dev_cfg and dev_curr_cfg are returned NULL, the dev_curr_xxx fields are invalid.

USB_PARSE_LVL_IF

Parse configured interface only, if configuration# and interface properties are set (as when different interfaces are viewed by the OS as different device instances). If an OS device instance is set up to represent an entire physical device, this works like USB_PARSE_LVL_ALL.

USB_PARSE_LVL_CFG

Parse entire configuration of configured interface only. This is like USB_PARSE_LVL_IF except entire configuration is returned.

USB_PARSE_LVL_ALL

Parse entire device (all configurations), even when driver is bound to a single interface of a single configuration.

The default control pipe handle is used mainly for control commands and device setup.

The dev_iblock_cookie is used to initialize client driver mutexes which are used in interrupt-context callback handlers. (All callback handlers called with USB_CB_INTR_CONTEXT in their usb_cb_flags_t arg execute in interrupt context.) This cookie is used in lieu of one returned by ddi_get_iblock_cookie(9F). Mutexes used in other handlers or under other conditions should initialize per mutex_init(9F).

The parsed standard USB device descriptor is used for device type identification.

The several ID strings, including the manufacturer's ID, product ID, and serial number may be used to identify the device in messages or to compare it to other devices.

The descriptor tree, returned by dev_cfg, makes a device's parsed standard USB descriptors available to the driver. The tree is designed to be easily traversed to get any or all standard USB 2.0 descriptors. (See the “Tree Structure” section of this manpage below.) dev_n_cfg returns the number of configurations in the tree. Note that this value may differ from the number of configurations returned in the device descriptor.

A returned parse_level field of USB_PARSE_LVL_ALL indicates that all configurations are represented in the tree. This results when USB_PARSE_LVL_ALL is explicitly requested by the caller in the flags argument to usb_get_dev_data(), or when the whole device is seen by the system for the current OS device node (as opposed to only a single configuration for that OS device node). USB_PARSE_LVL_CFG is returned when one entire configuration is returned in the tree. USB_PARSE_LVL_IF is returned when one interface of one configuration is returned in the tree. In the latter two cases, the returned configuration is at dev_cfg[USB_DEV_DEFAULT_CONFIG_INDEX]. USB_PARSE_LVL_NONE is returned when no tree is returned. Note that the value of this field can differ from the parse_level requested as an argument to usb_get_dev_data().

TREE STRUCTURE

The root of the tree is dev_cfg, an array of usb_cfg_data_t configuration nodes, each representing one device configuration. The array index does not correspond to a configuration's value; use the bConfigurationValue field of the configuration descriptor within to find out the proper number for a given configuration.

The size of the array is returned in dev_n_cfg. The array itself is not NULL terminated.

When USB_PARSE_LVL_ALL is returned in dev_parse_level, index 0 pertains to the first valid configuration. This pertains to device configuration 1 as USB configuration 0 is not defined. When dev_parse_level returns USB_PARSE_LVL_CFG or USB_PARSE_LVL_IF, index 0 pertains to the device's one configuration recognized by the system. (Note that the configuration level is the only descriptor level in the tree where the index value does not correspond to the descriptor's value.)

Each usb_cfg_data_t configuration node contains a parsed usb configuration descriptor (usb_cfg_descr_t cfg_descr) a pointer to its string description (char *cfg_str) and string size (cfg_strsize), a pointer to an array of interface nodes (usb_if_data_t *cfg_if), and a pointer to an array of class/vendor (cv) descriptor nodes (usb_cvs_data_t *cfg_cvs). The interface node array size is kept in cfg_n_if, and the cv node array size is kept in cfg_n_cvs; neither array is NULL terminated. When USB_PARSE_LVL_IF is returned in dev_parse_level, the only interface (or alternate group) included in the tree is that which is recognized by the system for the current OS device node.

Each interface can present itself potentially in one of several alternate ways. An alternate tree node (usb_alt_if_data_t) represents an alternate representation. Each usb_if_data_t interface node points to an array of alternate nodes (usb_alt_if_data_t *if_alt) and contains the size of the array (if_n_alt).

Each interface alternate node holds an interface descriptor (usb_if_descr_t altif_descr), a pointer to its string description (char *altif_str), and has its own set of endpoints and bound cv descriptors. The pointer to the array of endpoints is usb_ep_data_t *altif_ep); the endpoint array size is altif_n_ep. The pointer to the array of cv descriptors is usb_cvs_data_t *altif_cvs; the cv descriptor array size is altif_n_cvs.

Each endpoint node holds an endpoint descriptor (usb_ep_descr_t ep_descr), a pointer to an array of cv descriptors for that endpoint (usb_cvs_data_t *ep_cvs), and the size of that array (ep_n_cvs). An endpoint descriptor may be passed to usb_pipe_open(9F) to establish a logical connection for data transfer.

Class and vendor descriptors (cv descriptors) are grouped with the configuration, interface or endpoint descriptors they immediately follow in the raw data returned by the device. Tree nodes representing such descriptors (usb_cvs_data_t) contain a pointer to the raw data (uchar_t *cvs_buf) and the size of the data (uint_t cvs_buf_len).

Configuration and interface alternate nodes return string descriptions. Note that all string descriptions returned have a maximum length of USB_MAXSTRINGLEN bytes and are in English ASCII.

Examples

In the following example, a device's configuration data, including the following descriptor tree, is retrieved by usb_get_dev_data(9F) into usb_client_dev_data_t *reg_data:

       config 1
            iface 0
                alt 0
                    endpt 0
        config 2
            iface 0
            iface 1
                alt 0
                    endpt 0
                        cv 0
                alt 1
                    endpt 0
                    endpt 1
                        cv 0
                    endpt 2
                alt 2
                    endpt 0
                        cv 0

        and suppose that the C/V data is of the following format:

        typedef struct cv_data {
            char char1;
            short short1;
            char char2;
        } cv_data_t;

        Parse the data of C/V descriptor 0, second configuration
        (index 1), iface 1, alt 2, endpt 0.

        usb_client_dev_data_t reg_data;
        usb_cvs_data_t *cv_node;
        cv_data_t parsed_data;

        cv_node =
           &reg_data->dev_cfg[1].cfg_if[1].if_alt[2].altif_ep[0].ep_cvs[0];
        (void)usb_parse_data("csc",
           (void *)(&cv_node->cvs_buf), cv_node->cvs_buf_len,
           &parsed_data, sizeof(cv_data_t));

Attributes

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Architecture
PCI-based systems
Interface Stability
Committed
Availability
system/io/usb

See Also

usb_get_alt_if(9F), usb_get_cfg(9F), usb_get_dev_data(9F), usb_get_string_descr(9F), usb_lookup_ep_data(9F), usb_parse_data(9F), usb_pipe_open(9F), usb_cfg_descr(9S), usb_if_descr(9S), usb_ep_descr(9S), usb_string_descr(9S)