1STRUCT USB_DRIVER(9)    Host-Side Data Types and Macro    STRUCT USB_DRIVER(9)
2
3
4

NAME

6       struct_usb_driver - identifies USB interface driver to usbcore
7

SYNOPSIS

9       struct usb_driver {
10         const char * name;
11         int (* probe) (struct usb_interface *intf,const struct usb_device_id *id);
12         void (* disconnect) (struct usb_interface *intf);
13         int (* ioctl) (struct usb_interface *intf, unsigned int code,void *buf);
14         int (* suspend) (struct usb_interface *intf, pm_message_t message);
15         int (* resume) (struct usb_interface *intf);
16         int (* reset_resume) (struct usb_interface *intf);
17         int (* pre_reset) (struct usb_interface *intf);
18         int (* post_reset) (struct usb_interface *intf);
19         const struct usb_device_id * id_table;
20         struct usb_dynids dynids;
21         struct usbdrv_wrap drvwrap;
22         unsigned int no_dynamic_id:1;
23         unsigned int supports_autosuspend:1;
24         unsigned int soft_unbind:1;
25       };
26

MEMBERS

28       name
29           The driver name should be unique among USB drivers, and should
30           normally be the same as the module name.
31
32       probe
33           Called to see if the driver is willing to manage a particular
34           interface on a device. If it is, probe returns zero and uses
35           usb_set_intfdata to associate driver-specific data with the
36           interface. It may also use usb_set_interface to specify the
37           appropriate altsetting. If unwilling to manage the interface,
38           return -ENODEV, if genuine IO errors occured, an appropriate
39           negative errno value.
40
41       disconnect
42           Called when the interface is no longer accessible, usually because
43           its device has been (or is being) disconnected or the driver module
44           is being unloaded.
45
46       ioctl
47           Used for drivers that want to talk to userspace through the “usbfs”
48           filesystem. This lets devices provide ways to expose information to
49           user space regardless of where they do (or don't) show up otherwise
50           in the filesystem.
51
52       suspend
53           Called when the device is going to be suspended by the system.
54
55       resume
56           Called when the device is being resumed by the system.
57
58       reset_resume
59           Called when the suspended device has been reset instead of being
60           resumed.
61
62       pre_reset
63           Called by usb_reset_device when the device is about to be reset.
64
65       post_reset
66           Called by usb_reset_device after the device has been reset
67
68       id_table
69           USB drivers use ID table to support hotplugging. Export this with
70           MODULE_DEVICE_TABLE(usb,...). This must be set or your driver's
71           probe function will never get called.
72
73       dynids
74           used internally to hold the list of dynamically added device ids
75           for this driver.
76
77       drvwrap
78           Driver-model core structure wrapper.
79
80       no_dynamic_id
81           if set to 1, the USB core will not allow dynamic ids to be added to
82           this driver by preventing the sysfs file from being created.
83
84       supports_autosuspend
85           if set to 0, the USB core will not allow autosuspend for interfaces
86           bound to this driver.
87
88       soft_unbind
89           if set to 1, the USB core will not kill URBs and disable endpoints
90           before calling the driver's disconnect method.
91

DESCRIPTION

93       USB interface drivers must provide a name, probe and disconnect
94       methods, and an id_table. Other driver fields are optional.
95
96       The id_table is used in hotplugging. It holds a set of descriptors, and
97       specialized data may be associated with each entry. That table is used
98       by both user and kernel mode hotplugging support.
99
100       The probe and disconnect methods are called in a context where they can
101       sleep, but they should avoid abusing the privilege. Most work to
102       connect to a device should be done when the device is opened, and
103       undone at the last close. The disconnect code needs to address
104       concurrency issues with respect to open and close methods, as well as
105       forcing all pending I/O requests to complete (by unlinking them as
106       necessary, and blocking until the unlinks complete).
107
109Kernel Hackers Manual 2.6.       November 2011            STRUCT USB_DRIVER(9)
Impressum