1usb_client_attach(9F)    Kernel Functions for Drivers    usb_client_attach(9F)
2
3
4

NAME

6       usb_client_attach,  usb_client_detach  - USBA framework registration of
7       client USB drivers
8

SYNOPSIS

10       #define USBDRV_MAJOR_VER    <major>
11       #define USBDRV_MINOR_VER    <minor>
12       #include <sys/usb/usba.h>
13
14
15
16       int usb_client_attach(dev_info_t *dip,
17           uint_t version, usb_flags_t flags);
18
19
20       void usb_client_detach(dev_info_t *dip,
21           usb_client_dev_data_t *dev_data);
22
23

INTERFACE LEVEL

25       Solaris DDI specific (Solaris DDI)
26

PARAMETERS

28       For usb_client_attach():
29
30       dip        Pointer to the device's dev_info structure.
31
32
33       version    Must be set to USBDRV_VERSION. (See below.)
34
35
36       flags      Not used.
37
38
39
40       For usb_client_detach():
41
42       dip         Pointer to the device's dev_info structure.
43
44
45       dev_data    Pointer to a usb_client_dev_data_t to free. Can be NULL.
46
47

DESCRIPTION

49       The usb_client_attach() function  registers  a  driver  with  the  USBA
50       framework  and  must be called before any other USBA function. Usually,
51       usb_client_attach() is followed by a call to usb_get_dev_data(9F).
52
53
54       The usb_client_detach() function unregisters a  driver  with  the  USBA
55       framework.  The  usb_client_detach()  function  releases memory for all
56       strings, descriptors and trees set up by usb_get_dev_data(9F) when  its
57       dev_data argument is non-NULL.  The usb_client_detach() function is the
58       last USBA function a client calls before completing detach(9E).  It  is
59       not necessary to call usb_client_detach() during a suspend operation.
60
61   VERSIONING
62       USBDRV_VERSION  is  a macro which creates a version number based on the
63       USBDRV_MAJOR_VER and USBDRV_MINOR_VER definitions. It must be passed as
64       the version argument.
65
66
67       For  drivers  version 2.0 or greater, the value of USBDRV_MAJOR_VERSION
68       must match its corresponding USBA_MAJOR_VER value in <sys/usb/usbai.h>,
69       and the value of USBDRV_MINOR_VERSION must not be greater than its cor‐
70       responding USBA_MINOR_VER value also in <sys/usb/usbai.h>.
71
72
73       Version 0.8 drivers from previous releases are  binary  compatible  and
74       run  on Solaris 10, but are not compilable. Version 0.8 binary compati‐
75       bility will not be supported in subsequent Solaris OS releases.
76
77
78       Definitions  of  USBDRV_MAJOR_VERSION  and  USBDRV_MINOR_VERSION   must
79       appear  in  the  client driver above the reference to <sys/usb/usba.h>.
80       Note that different releases have different USBA_[MAJOR|MINOR]_VER num‐
81       bers.
82

RETURN VALUES

84       For usb_client_attach():
85
86       USB_SUCCESS            Registration is successful.
87
88
89       USB_INVALID_ARGS       dip is NULL.
90
91
92       USB_INVALID_CONTEXT    Called  from  interrupt context. Not called from
93                              an attach routine context.
94
95
96       USB_INVALID_VERSION    Version passed in version is invalid.
97
98
99       USB_FAILURE            Other internal error.
100
101
102
103       For usb_client_detach():
104
105       USB_INVALID_ARGS       dip is NULL.
106
107
108       USB_INVALID_CONTEXT    Not called from an attach routine context.
109
110

CONTEXT

112       The usb_client_attach() function may only be called from attach(9E).
113
114
115       The usb_client_detach() function may be called only from attach(9E)  or
116       detach(9E).
117

EXAMPLES

119           if (usb_client_attach(dip, USBDRV_VERSION, 0) != USB_SUCCESS) {
120                     cmn_err (CE_WARN, "%s%d: Couldn't register USB device",
121                         ddi_driver_name(dip), ddi_get_instance(dip));
122
123                    return (USB_FAILURE);
124            }
125
126            if (usb_get_dev_data(dip, &dev_data, USB_PARSE_LVL_IF, 0) !=
127                USB_SUCCESS) {
128                    cmn_err (CE_WARN, "%s%d: Couldn't get device descriptor data.",
129                        ddi_driver_name(dip), ddi_get_instance(dip));
130
131                    return (USB_FAILURE);
132            }
133
134
135

ATTRIBUTES

137       See attributes(5) for descriptions of the following attributes:
138
139
140
141
142       ┌─────────────────────────────┬─────────────────────────────┐
143       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
144       ├─────────────────────────────┼─────────────────────────────┤
145       │Architecture                 │PCI-based systems            │
146       ├─────────────────────────────┼─────────────────────────────┤
147       │Interface stability          │Committed                    │
148       ├─────────────────────────────┼─────────────────────────────┤
149       │Availability                 │SUNWusb                      │
150       └─────────────────────────────┴─────────────────────────────┘
151

SEE ALSO

153       attributes(5), attach(9E), detach(9E), usb_get_dev_data(9F)
154
155
156
157SunOS 5.11                        5 Jan 2004             usb_client_attach(9F)
Impressum