'\" t .\" Title: struct usb_interface .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: January 2017 .\" Manual: Host-Side Data Types and Macros .\" Source: Kernel Hackers Manual 4.8.15 .\" Language: English .\" .TH "STRUCT USB_INTERFACE" "9" "January 2017" "Kernel Hackers Manual 4\&.8\&." "Host-Side Data Types and Macro" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" struct_usb_interface \- what usb device drivers talk to .SH "SYNOPSIS" .sp .nf struct usb_interface { struct usb_host_interface * altsetting; struct usb_host_interface * cur_altsetting; unsigned num_altsetting; struct usb_interface_assoc_descriptor * intf_assoc; int minor; enum usb_interface_condition condition; unsigned sysfs_files_created:1; unsigned ep_devs_created:1; unsigned unregistering:1; unsigned needs_remote_wakeup:1; unsigned needs_altsetting0:1; unsigned needs_binding:1; unsigned resetting_device:1; unsigned authorized:1; struct device dev; struct device * usb_dev; atomic_t pm_usage_cnt; struct work_struct reset_ws; }; .fi .SH "MEMBERS" .PP altsetting .RS 4 array of interface structures, one for each alternate setting that may be selected\&. Each one includes a set of endpoint configurations\&. They will be in no particular order\&. .RE .PP cur_altsetting .RS 4 the current altsetting\&. .RE .PP num_altsetting .RS 4 number of altsettings defined\&. .RE .PP intf_assoc .RS 4 interface association descriptor .RE .PP minor .RS 4 the minor number assigned to this interface, if this interface is bound to a driver that uses the USB major number\&. If this interface does not use the USB major, this field should be unused\&. The driver should set this value in the \fBprobe\fR function of the driver, after it has been assigned a minor number from the USB core by calling \fBusb_register_dev\fR\&. .RE .PP condition .RS 4 binding state of the interface: not bound, binding (in \fBprobe\fR), bound to a driver, or unbinding (in \fBdisconnect\fR) .RE .PP sysfs_files_created .RS 4 sysfs attributes exist .RE .PP ep_devs_created .RS 4 endpoint child pseudo\-devices exist .RE .PP unregistering .RS 4 flag set when the interface is being unregistered .RE .PP needs_remote_wakeup .RS 4 flag set when the driver requires remote\-wakeup capability during autosuspend\&. .RE .PP needs_altsetting0 .RS 4 flag set when a set\-interface request for altsetting 0 has been deferred\&. .RE .PP needs_binding .RS 4 flag set when the driver should be re\-probed or unbound following a reset or suspend operation it doesn\*(Aqt support\&. .RE .PP resetting_device .RS 4 USB core reset the device, so use alt setting 0 as current; needs bandwidth alloc after reset\&. .RE .PP authorized .RS 4 This allows to (de)authorize individual interfaces instead a whole device in contrast to the device authorization\&. .RE .PP dev .RS 4 driver model\*(Aqs view of this device .RE .PP usb_dev .RS 4 if an interface is bound to the USB major, this will point to the sysfs representation for that device\&. .RE .PP pm_usage_cnt .RS 4 PM usage counter for this interface .RE .PP reset_ws .RS 4 Used for scheduling resets from atomic context\&. .RE .SH "DESCRIPTION" .PP USB device drivers attach to interfaces on a physical device\&. Each interface encapsulates a single high level function, such as feeding an audio stream to a speaker or reporting a change in a volume control\&. Many USB devices only have one interface\&. The protocol used to talk to an interface\*(Aqs endpoints can be defined in a usb \(lqclass\(rq specification, or by a product\*(Aqs vendor\&. The (default) control endpoint is part of every interface, but is never listed among the interface\*(Aqs descriptors\&. .PP The driver that is bound to the interface can use standard driver model calls such as \fBdev_get_drvdata\fR on the dev member of this structure\&. .PP Each interface may have alternate settings\&. The initial configuration of a device sets altsetting 0, but the device driver can change that setting using \fBusb_set_interface\fR\&. Alternate settings are often used to control the use of periodic endpoints, such as by having different endpoints use different amounts of reserved USB bandwidth\&. All standards\-conformant USB devices that use isochronous endpoints will use them in non\-default settings\&. .PP The USB specification says that alternate setting numbers must run from 0 to one less than the total number of alternate settings\&. But some devices manage to mess this up, and the structures aren\*(Aqt necessarily stored in numerical order anyhow\&. Use \fBusb_altnum_to_altsetting\fR to look up an alternate setting in the altsetting array based on its number\&. .SH "COPYRIGHT" .br