Kernel Functions for Drivers usbclientattach(9F)
NAME
usbclientattach, usbclientdetach - USBA framework regis-
tration of client USB drivers
SYNOPSIS
#define USBDRVMAJORVER
#define USBDRVMINORVER
#include
int usbclientattach(devinfot *dip,
uintt version, usbflagst flags);
void usbclientdetach(devinfot *dip,
usbclientdevdatat *devdata);
INTERFACE LEVEL
Solaris DI specific (Solaris DI)
PARAMETERS
For usbclientattach():
dip Pointer to the device's devinfo structure.
version Must be set to USBDRVERSION. (See below.)
flags Not used.
For usbclientdetach():
dip Pointer to the device's devinfo structure.
devdata Pointer to a usbclientdevdatat to free. Can
be NUL.
DESCRIPTION
The usbclientattach() function registers a driver with the
USBA framework and must be called before any other USBA
function. Usually, usbclientattach() is followed by a call
to usbgetdevdata(9F).
SunOS 5.11 Last change: 5 Jan 2004 1
Kernel Functions for Drivers usbclientattach(9F)
The usbclientdetach() function unregisters a driver with
the USBA framework. The usbclientdetach() function
releases memory for all strings, descriptors and trees set
up by usbgetdevdata(9F) when its devdata argument is
non-NUL. The usbclientdetach() function is the last USBA
function a client calls before completing detach(9E). It is
not necessary to call usbclientdetach() during a suspend
operation.
VERSIONING
USBDRVERSION is a macro which creates a version number
based on the USBDRVMAJORVER and USBDRVMINORVER defini-
tions. It must be passed as the version argument.
For drivers version 2.0 or greater, the value of
USBDRVMAJORVERSION must match its corresponding
USBAMAJORVER value in , and the value of
USBDRVMINORVERSION must not be greater than its
corresponding USBAMINORVER value also in
.
Version 0.8 drivers from previous releases are binary compa-
tible and run on Solaris 10, but are not compilable. Version
0.8 binary compatibility will not be supported in subsequent
Solaris OS releases.
Definitions of USBDRVMAJORVERSION and USBDRVMINORVERSION
must appear in the client driver above the reference to
. Note that different releases have dif-
ferent USBA[MAJORMINOR]VER numbers.
RETURN VALUES
For usbclientattach():
USBSUCES Registration is successful.
USBINVALIDARGS dip is NUL.
USBINVALIDCONTEXT Called from interrupt context. Not
called from an attach routine con-
text.
USBINVALIDVERSION Version passed in version is invalid.
SunOS 5.11 Last change: 5 Jan 2004 2
Kernel Functions for Drivers usbclientattach(9F)
USBFAILURE Other internal error.
For usbclientdetach():
USBINVALIDARGS dip is NUL.
USBINVALIDCONTEXT Not called from an attach routine
context.
CONTEXT
The usbclientattach() function may only be called from
attach(9E).
The usbclientdetach() function may be called only from
attach(9E) or detach(9E).
EXAMPLES
if (usbclientattach(dip, USBDRVERSION, 0) != USBSUCES) {
cmnerr (CEWARN, "%s%d: Couldn't register USB device",
ddidrivername(dip), ddigetinstance(dip));
return (USBFAILURE);
}
if (usbgetdevdata(dip, &devdata, USBPARSELVLIF, 0) !=
USBSUCES) {
cmnerr (CEWARN, "%s%d: Couldn't get device descriptor data.",
ddidrivername(dip), ddigetinstance(dip));
return (USBFAILURE);
}
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
SunOS 5.11 Last change: 5 Jan 2004 3
Kernel Functions for Drivers usbclientattach(9F)
ATRIBUTE TYPE ATRIBUTE VALUE
Architecture PCI-based systems
Interface stability Committed
Availability SUNWusb
SEE ALSO
attributes(5), attach(9E), detach(9E), usbgetdevdata(9F)
SunOS 5.11 Last change: 5 Jan 2004 4
|