Skip Navigation Links | |
Exit Print View | |
man pages section 9: DDI and DKI Kernel Functions Oracle Solaris 11.1 Information Library |
csx_AccessConfigurationRegister(9F)
csx_Parse_CISTPL_BYTEORDER(9F)
csx_Parse_CISTPL_CFTABLE_ENTRY(9F)
csx_Parse_CISTPL_DEVICEGEO(9F)
csx_Parse_CISTPL_DEVICEGEO_A(9F)
csx_Parse_CISTPL_DEVICE_OA(9F)
csx_Parse_CISTPL_DEVICE_OC(9F)
csx_Parse_CISTPL_LINKTARGET(9F)
csx_Parse_CISTPL_LONGLINK_A(9F)
csx_Parse_CISTPL_LONGLINK_C(9F)
csx_Parse_CISTPL_LONGLINK_MFC(9F)
ddi_get_soft_iblock_cookie(9F)
ddi_intr_get_supported_types(9F)
ddi_prop_lookup_byte_array(9F)
ddi_prop_lookup_int64_array(9F)
ddi_prop_lookup_string_array(9F)
ddi_prop_update_byte_array(9F)
ddi_prop_update_int64_array(9F)
ddi_prop_update_string_array(9F)
ldi_prop_lookup_byte_array(9F)
ldi_prop_lookup_int64_array(9F)
ldi_prop_lookup_string_array(9F)
mac_prop_info_set_default_link_flowctrl(9F)
mac_prop_info_set_default_str(9F)
mac_prop_info_set_default_uint8(9F)
mac_prop_info_set_range_uint32(9F)
net_event_notify_unregister(9F)
net_instance_notify_register(9F)
net_instance_notify_unregister(9F)
net_instance_protocol_unregister(9F)
net_protocol_notify_register(9F)
nvlist_lookup_boolean_array(9F)
nvlist_lookup_boolean_value(9F)
nvlist_lookup_nvlist_array(9F)
nvlist_lookup_string_array(9F)
nvlist_lookup_uint16_array(9F)
nvlist_lookup_uint32_array(9F)
nvlist_lookup_uint64_array(9F)
nvpair_value_boolean_array(9F)
pci_plist_lookup_int16_array(9F)
pci_plist_lookup_int32_array(9F)
pci_plist_lookup_int64_array(9F)
pci_plist_lookup_int8_array(9F)
pci_plist_lookup_string_array(9F)
pci_plist_lookup_uint16_array(9F)
pci_plist_lookup_uint32_array(9F)
pci_plist_lookup_uint64_array(9F)
pci_plist_lookup_uint8_array(9F)
scsi_get_device_type_scsi_options(9F)
scsi_get_device_type_string(9F)
scsi_sense_cmdspecific_uint64(9F)
usb_get_current_frame_number(9F)
usb_get_max_pkts_per_isoc_request(9F)
usb_pipe_get_max_bulk_transfer_size(9F)
usb_pipe_stop_intr_polling(9F)
usb_pipe_stop_isoc_polling(9F)
- Retrieve device configuration information
#include <sys/usb/usba.h> int usb_get_dev_data(dev_info_t *dip, usb_client_dev_data_t **dev_data, usb_reg_parse_lvl_t parse_level, usb_flags_t flags);
void usb_free_dev_data(dev_info_t *dip, usb_client_dev_data_t *dev_data);
void usb_free_descr_tree(dev_info_t *dip, usb_client_dev_data_t *dev_data);
int usb_print_descr_tree(dev_info_t *dip, usb_client_dev_data_t *dev_data);
Solaris DDI specific (Solaris DDI)
For usb_get_dev_data():
Pointer to device's dev_info structure.
Address in which pointer to info is returned.
Portion of device represented in the tree of parsed descriptors. See below for possible usb_reg_parse_lvl_t values and explanations.
Not used.
For usb_free_dev_data():
Pointer to device's dev_info structure.
Pointer to usb_client_dev_data_t to be freed.
For usb_free_descr_tree():
Pointer to device's dev_info structure.
Pointer to usb_client_dev_data_t containing the descriptor tree to free.
For usb_print_descr_tree():
Pointer to device's dev_info structure.
Pointer to usb_client_dev_data_t containing the descriptor tree to display on-screen.
The usb_get_dev_data() function interrogates a device and returns its configuration information in a usb_client_dev_data_t structure. Most USBA functions require information which comes from a usb_client_dev_data_t, and all other functions in this man page operate on this structure. Please see usb_client_dev_data(9S) for a full content description. Pass the usb_client_dev_data_t structure to usb_client_detach(9F) to completely deallocate it.
A descriptor tree is included in the information returned. The usb_reg_parse_lvl_t type represents the extent of the device to be represented by the returned tree (2nd arg to usb_get_dev_data) or what is actually represented in the returned tree (dev_parse_level field of the returned usb_client_dev_data_t). It has the following possible values:
Build no tree. dev_n_cfg returns 0, dev_cfg and dev_curr_cfg are returned NULL, and the dev_curr_xxx fields are invalid.
If configuration number and interface properties are set (as when different interfaces are viewed by the OS as different device instances), parse configured interface only. If an OS device instance is set up to represent an entire physical device, USB_PARSE_LVL_IF works like USB_PARSE_LVL_ALL.
Parse entire configuration of configured interface only. Behaves similarly to USB_PARSE_LVL_IF, except that entire configuration is returned.
Parse entire device (all configurations), even when driver is bound to a single interface of a single configuration.
The usb_free_dev_data() function undoes what usb_get_dev_data() set up. It releases memory for all strings, descriptors, and trees set up by usb_get_dev_data().
The usb_free_descr_tree() function frees the descriptor tree of its usb_client_dev_data_t argument, while leaving the rest of the information intact. The intent is for drivers to free memory after copying needed descriptor information from the tree. Upon return, the following usb_client_dev_data_t fields are modified as follows: dev_cfg is NULL, dev_n_cfg is zero and dev_parse_level is USB_PARSE_LVL_NONE. Additionally, dev_curr_cfg is NULL and dev_curr_if is invalid.
The usb_print_descr_tree() function is an easy-to-use diagnostic aid which dumps the descriptor tree to the screen when the system is verbose booted (boot -v). Output is spaced with blank lines for readability and provides you with an on-screen look at what a device has to offer.
For usb_get_dev_data():
Registration is successful.
dip or dev_data is NULL. parse_level is invalid.
Called from interrupt context.
usb_client_attach(9F) was not called first.
Bad descriptor info or other internal error.
For usb_free_dev_data(): None
For usb_free_descr_tree(): None, but no operation occurs if dip and/or dev_data are NULL.
For usb_print_descr_tree():
Descriptor tree dump is successful.
dev_data or dip are NULL.
Called from interrupt context.
Other error.
The usb_get_dev_data() and usb_print_descr_tree() functions may be called from user or kernel context.
The usb_free_dev_data() and usb_free_descr_tree() functions may be called from user, kernel or interrupt context.
In this example, assume a device has the configuration shown below, and the endpoint of config 2, iface 1, alt 1 which supports intr IN transfers needs to be found. Config 2, iface 1 is the "default" config/iface for the current OS device node. config 1 iface 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 usb_client_dev_data_t *dev_data; usb_ep_descr_t ep_descr; usb_ep_data_t *ep_tree_node; uint8_t interface = 1; uint8_t alternate = 1; uint8_t first_ep_number = 0; /* * We want default config/iface, so specify USB__PARSE_LVL_IF. * Default config will be returned as dev_cfg[0]. / if (usb_get_dev_data(dip, &dev_data, USB_PARSE_LVL_IF, 0) != USB_SUCCESS) { cmn_err (CE_WARN, "%s%d: Couldn't get USB configuration descr tree", ddi_driver_name(dip), ddi_get_instance(dip)); return (USB_FAILURE); } ep_tree_node = usb_lookup_ep_data(dip, dev_data, interface, alternate, first_ep_number, USB_EP_ATTR_INTR, USB_EP_DIR_IN); if (ep_tree_node != NULL) { ep_descr = ep_tree_node->ep_descr; } else { cmn_r (CE_WARN, "%s%d: Device is missing intr-IN endpoint", ddi_driver_name(dip), ddi_get_instance(dip)); usb_free_descr_tree(dip, &dev_data); return (USB_FAILURE); }
See attributes(5) for descriptions of the following attributes:
|
attributes(5), usb_client_attach(9F), usb_get_alt_if(9F), usb_get_cfg(9F), usb_get_string_descr(9F), usb_lookup_ep_data(9F), usb_parse_data(9F), usb_pipe_open(9F), usb_cfg_descr(9S), usb_client_dev_data(9S), usb_ep_descr(9S), usb_if_descr(9S), usb_string_descr(9S)