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_REGISTER_HOTPLUG_CBS 9F "Aug 17, 2004"
9 usb_register_hotplug_cbs, usb_unregister_hotplug_cbs \- Register/unregister for
10 notification of device hotplug events
14 #include <sys/usb/usba.h>
18 \fB\fR\fBint\fR \fBusb_register_hotplug_cbs\fR(\fBdev_info_t *\fR\fIdip\fR,
19 \fBint\fR \fI(*disconnection_event_handler)\fR(dev_info_t *\fIdip\fR,
20 \fBint\fR \fI(*reconnection_event_handler)\fR(dev_info_t *\fIdip\fR);
25 \fBvoid\fR \fB\fR\fBusb_unregister_hotplug_cbs\fR(\fBdev_info_t *\fR\fIdip\fR);
31 Solaris DDI specific (Solaris DDI)
35 For \fBusb_register_hotplug_cbs()\fR
43 Pointer to the device's \fBdev_info\fR structure.
49 \fB\fIdisconnection_event_handler\fR\fR
53 Called when device is disconnected. This handler takes a dev_info_t as an
54 argument (representing the device being disconnected) and always returns
61 \fB\fIreconnection_event_handler\fR\fR
65 Called when device is reconnected. This handler takes a dev_info_t as an
66 argument (representing the device being reconnected) and always returns
72 For \fBusb_unregister_hotplug_cbs()\fR:
79 Pointer to the device's \fBdev_info\fR structure.
85 The \fBusb_register_hotplug_cbs()\fR function registers callbacks to be
86 executed when the USB device represented by \fIdip\fR is hotplugged or removed.
89 The \fBusb_unregister_hotplug_cbs()\fR function unregisters or disengages
90 callbacks from executing when the USB device represented by \fIdip\fR is
91 hotplugged or removed.
95 For \fBusb_register_hotplug_cbs()\fR:
102 Callbacks were successfully registered.
111 One or more arguments were NULL.
113 Callbacks could not be successfully registered.
118 For \fBusb_unregister_hotplug_cbs()\fR: None
122 The \fBusb_register_hotplug_cbs()\fR function may be called only from
126 The \fBusb_unregister_hotplug_cbs()\fR function may be called only from
130 Registered callback handlers requiring the use of any DDI (section 9F) function
131 (except ddi_taskq_* functions), should launch a separate thread using
132 ddi_taskq_* routines for processing their event, to avoid deadlocks. The new
133 thread can then safely call any DDI function it needs to handle the event.
136 The registered callback handlers execute in kernel context.
142 int remove_device(dev_info_t *)
146 return (USB_SUCCESS);
149 int accommodate_device(dev_info_t *)
153 return (USB_SUCCESS);
156 if (usb_register_hotplug_cbs(
157 dip, remove_device, accommodate_device) == USB_FAILURE) {
159 "%s%d: Could not register hotplug handlers.",
160 ddi_driver_name(dip), ddi_get_instance(dip));
169 See \fBattributes\fR(5) for descriptions of the following attributes:
177 ATTRIBUTE TYPE ATTRIBUTE VALUE
179 Architecture PCI-based systems
181 Interface stability Committed
187 \fBattributes\fR(5), \fBattach\fR(9E), \fBdetach\fR(9E),
188 \fBusb_get_status\fR(9F)