USB_GET_CONFIG(Vt int) |
| Get the device configuration number. |
USB_SET_CONFIG(Vt int) |
| Set the device into the given configuration number. This operation can only be performed when the control endpoint is the sole open endpoint. |
USB_GET_ALTINTERFACE(Vt "struct usb_alt_interface") |
| Get the alternative setting number for the interface with the given index. The uai_config_index is ignored in this call.
struct usb_alt_interface {
intuai_config_index;
intuai_interface_index;
intuai_alt_no;
};
|
USB_SET_ALTINTERFACE(Vt "struct usb_alt_interface") |
| Set the alternative setting to the given number in the interface with the given index. The uai_config_index is ignored in this call. This operation can only be performed when no endpoints for the interface are open. |
USB_GET_NO_ALT(Vt "struct usb_alt_interface") |
| Return the number of different alternate settings in the uai_alt_no field. |
USB_GET_DEVICE_DESC(Vt usb_device_descriptor_t) |
| Return the device descriptor. |
USB_GET_CONFIG_DESC(Vt "struct usb_config_desc") |
| Return the descriptor for the configuration with the given index. For convenience the current configuration can be specified by USB_CURRENT_CONFIG_INDEX.
struct usb_config_desc {
intucd_config_index;
usb_config_descriptor_t ucd_desc;
};
|
USB_GET_INTERFACE_DESC(Vt "struct usb_interface_desc") |
| Return the interface descriptor for an interface specified by its configuration index, interface index, and alternative index. For convenience the current alternative can be specified by USB_CURRENT_ALT_INDEX.
struct usb_interface_desc {
intuid_config_index;
intuid_interface_index;
intuid_alt_index;
usb_interface_descriptor_t uid_desc;
};
|
USB_GET_ENDPOINT_DESC(Vt "struct usb_endpoint_desc") |
| Return the endpoint descriptor for the endpoint specified by its configuration index, interface index, alternative index, and endpoint index.
struct usb_endpoint_desc {
intued_config_index;
intued_interface_index;
intued_alt_index;
intued_endpoint_index;
usb_endpoint_descriptor_t ued_desc;
};
|
USB_GET_FULL_DESC(Vt "struct usb_full_desc") |
| Return all the descriptors for the given configuration.
struct usb_full_desc {
intufd_config_index;
u_int ufd_size;
u_char *ufd_data;
};
The ufd_data field should point to a memory area of the size given in the ufd_size field. The proper size can be determined by first issuing a USB_GET_CONFIG_DESC and inspecting the wTotalLength field. |
USB_GET_STRING_DESC(Vt "struct usb_string_desc") |
| Get a string descriptor for the given language ID and string index.
struct usb_string_desc {
intusd_string_index;
intusd_language_id;
usb_string_descriptor_t usd_desc;
};
|
USB_DO_REQUEST(Vt "struct usb_ctl_request") |
| Send a USB request to the device on the control endpoint. Any data sent to/from the device is located at ucr_data. The size of the transferred data is determined from the ucr_request. The ucr_addr field is ignored in this call. The ucr_flags field can be used to flag that the request is allowed to be shorter than the requested size, and the ucr_actlen will contain the actual size on completion.
struct usb_ctl_request {
intucr_addr;
usb_device_request_t ucr_request;
void *ucr_data;
intucr_flags;
#define USBD_SHORT_XFER_OK 0x04 /* allow short reads */
intucr_actlen; /* actual length transferred */
};
This is a dangerous operation in that it can perform arbitrary operations on the device. Some of the most dangerous (e.g., changing the device address) are not allowed. |
USB_GET_DEVICEINFO(Vt "struct usb_device_info") |
| Get an information summary for the device. This call will not issue any USB transactions. |
|
Note that there are two different ways of addressing configurations, interfaces, alternatives, and endpoints: by index or by number. The index is the ordinal number (starting from 0) of the descriptor as presented by the device. The number is the respective number of the entity as found in its descriptor. Enumeration of descriptors use the index, getting and setting typically uses numbers.
Example: all endpoints (except the control endpoint) for the current configuration can be found by iterating the interface_index from 0 to config_desc->bNumInterface -1 and for each of these iterating the endpoint_index from 0 to interface_desc->bNumEndpoints. The config_index should set to USB_CURRENT_CONFIG_INDEX and alt_index should be set to USB_CURRENT_ALT_INDEX.
FILES