2 .\" Copyright (c) 2004, Sun Microsystems, Inc.,
3 .\" All Rights Reserved
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH USB_CLIENT_ATTACH 9F "Oct 30, 2016"
9 usb_client_attach, usb_client_detach \- USBA framework registration of client
14 #define USBDRV_MAJOR_VER <major>
15 #define USBDRV_MINOR_VER <minor>
16 #include <sys/usb/usba.h>
20 \fBint\fR \fBusb_client_attach\fR(\fBdev_info_t *\fR\fIdip\fR,
21 \fBuint_t\fR \fIversion\fR, \fBusb_flags_t\fR \fIflags\fR);
26 \fBvoid\fR \fBusb_client_detach\fR(\fBdev_info_t *\fR\fIdip\fR,
27 \fBusb_client_dev_data_t *\fR\fIdev_data\fR);
32 Solaris DDI specific (Solaris DDI)
35 For \fBusb_client_attach()\fR:
42 Pointer to the device's dev_info structure.
51 Must be set to USBDRV_VERSION. (See below.)
65 For \fBusb_client_detach()\fR:
72 Pointer to the device's dev_info structure.
81 Pointer to a usb_client_dev_data_t to free. Can be NULL.
86 The \fBusb_client_attach()\fR function registers a driver with the USBA
87 framework and must be called before any other USBA function. Usually,
88 \fBusb_client_attach()\fR is followed by a call to \fBusb_get_dev_data\fR(9F).
91 The \fBusb_client_detach()\fR function unregisters a driver with the USBA
92 framework. The \fBusb_client_detach()\fR function releases memory for all
93 strings, descriptors and trees set up by \fBusb_get_dev_data\fR(9F) when its
94 dev_data argument is non-NULL. The \fBusb_client_detach()\fR function is the
95 last USBA function a client calls before completing \fBdetach\fR(9E). It is not
96 necessary to call \fBusb_client_detach()\fR during a suspend operation.
99 USBDRV_VERSION is a macro which creates a version number based on the
100 USBDRV_MAJOR_VER and USBDRV_MINOR_VER definitions. It must be passed as the
104 For drivers version 2.0 or greater, the value of USBDRV_MAJOR_VERSION must
105 match its corresponding USBA_MAJOR_VER value in <\fBsys/usb/usbai.h\fR>, and
106 the value of USBDRV_MINOR_VERSION must not be greater than its corresponding
107 USBA_MINOR_VER value also in <sys/usb/usbai.h>.
110 Version 0.8 drivers from previous releases are binary compatible and run on
111 illumos, but are not compilable.
114 Definitions of USBDRV_MAJOR_VERSION and USBDRV_MINOR_VERSION must appear in the
115 client driver above the reference to <\fBsys/usb/usba.h\fR>. Note that
116 different releases have different USBA_[MAJOR|MINOR]_VER numbers.
119 For \fBusb_client_attach()\fR:
126 Registration is successful.
132 \fBUSB_INVALID_ARGS\fR
135 \fIdip\fR is \fBNULL\fR.
141 \fBUSB_INVALID_CONTEXT\fR
144 Called from interrupt context. Not called from an attach routine context.
150 \fBUSB_INVALID_VERSION\fR
153 Version passed in version is invalid.
162 Other internal error.
167 For \fBusb_client_detach()\fR:
171 \fBUSB_INVALID_ARGS\fR
174 \fIdip\fR is \fBNULL\fR.
180 \fBUSB_INVALID_CONTEXT\fR
183 Not called from an attach routine context.
188 The \fBusb_client_attach()\fR function may only be called from
192 The \fBusb_client_detach()\fR function may be called only from \fBattach\fR(9E)
197 if (usb_client_attach(dip, USBDRV_VERSION, 0) != USB_SUCCESS) {
198 cmn_err (CE_WARN, "%s%d: Couldn't register USB device",
199 ddi_driver_name(dip), ddi_get_instance(dip));
201 return (USB_FAILURE);
204 if (usb_get_dev_data(dip, &dev_data, USB_PARSE_LVL_IF, 0) !=
206 cmn_err (CE_WARN, "%s%d: Couldn't get device descriptor data.",
207 ddi_driver_name(dip), ddi_get_instance(dip));
209 return (USB_FAILURE);
217 See \fBattributes\fR(5) for descriptions of the following attributes:
225 ATTRIBUTE TYPE ATTRIBUTE VALUE
227 Architecture PCI-based systems
229 Interface stability Committed
234 \fBattributes\fR(5), \fBattach\fR(9E), \fBdetach\fR(9E),
235 \fBusb_get_dev_data\fR(9F)