1usb_register_hotplug_cbs(9KFe)rnel Functions for Driveurssb_register_hotplug_cbs(9F)
2
3
4

NAME

6       usb_register_hotplug_cbs,  usb_unregister_hotplug_cbs - Register/unreg‐
7       ister for notification of device hotplug events
8

SYNOPSIS

10       #include <sys/usb/usba.h>
11
12
13
14       int usb_register_hotplug_cbs(dev_info_t *dip,
15            int (*disconnection_event_handler)(dev_info_t *dip,
16            int (*reconnection_event_handler)(dev_info_t *dip);
17
18
19        void usb_unregister_hotplug_cbs(dev_info_t *dip);
20
21

INTERFACE LEVEL

23       Solaris DDI specific (Solaris DDI)
24

PARAMETERS

26       For usb_register_hotplug_cbs()
27
28       dip
29
30           Pointer to the device's dev_info structure.
31
32
33       disconnection_event_handler
34
35           Called when device is disconnected. This handler takes a dev_info_t
36           as  an  argument  (representing  the device being disconnected) and
37           always returns USB_SUCCESS.
38
39
40       reconnection_event_handler
41
42           Called when device is reconnected. This handler takes a  dev_info_t
43           as  an  argument  (representing  the  device being reconnected) and
44           always returns USB_SUCCESS.
45
46
47
48       For usb_unregister_hotplug_cbs():
49
50       dip    Pointer to the device's dev_info structure.
51
52

DESCRIPTION

54       The usb_register_hotplug_cbs() function registers callbacks to be  exe‐
55       cuted when the USB device represented by dip is hotplugged or removed.
56
57
58       The  usb_unregister_hotplug_cbs()  function  unregisters  or disengages
59       callbacks from executing when the USB device represented by dip is hot‐
60       plugged or removed.
61

RETURN VALUES

63       For usb_register_hotplug_cbs():
64
65       USB_SUCCESS    Callbacks were successfully registered.
66
67
68       USB_FAILURE    One or more arguments were NULL.
69
70                      Callbacks could not be successfully registered.
71
72
73
74       For usb_unregister_hotplug_cbs(): None
75

CONTEXT

77       The   usb_register_hotplug_cbs()  function  may  be  called  only  from
78       attach(9E).
79
80
81       The usb_unregister_hotplug_cbs()  function  may  be  called  only  from
82       detach(9E).
83
84
85       Registered  callback handlers requiring the use of any DDI (section 9F)
86       function (except  ddi_taskq_*  functions),  should  launch  a  separate
87       thread  using ddi_taskq_* routines for processing their event, to avoid
88       deadlocks. The new thread can then safely  call  any  DDI  function  it
89       needs to handle the event.
90
91
92       The registered callback handlers execute in kernel context.
93

EXAMPLES

95             int remove_device(dev_info_t *)
96             {
97                     ...
98                     ...
99                     return (USB_SUCCESS);
100             }
101
102             int accommodate_device(dev_info_t *)
103             {
104                     ...
105                     ...
106                     return (USB_SUCCESS);
107             }
108
109             if (usb_register_hotplug_cbs(
110                 dip, remove_device, accommodate_device) == USB_FAILURE) {
111                     cmn_err (CE_WARN,
112                         "%s%d: Could not register hotplug handlers.",
113                         ddi_driver_name(dip), ddi_get_instance(dip));
114             }
115
116
117

ATTRIBUTES

119       See attributes(5) for descriptions of the following attributes:
120
121
122
123
124       ┌─────────────────────────────┬─────────────────────────────┐
125       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
126       ├─────────────────────────────┼─────────────────────────────┤
127       │Architecture                 │PCI-based systems            │
128       ├─────────────────────────────┼─────────────────────────────┤
129       │Interface stability          │Committed                    │
130       ├─────────────────────────────┼─────────────────────────────┤
131       │Availability                 │SUNWusb                      │
132       └─────────────────────────────┴─────────────────────────────┘
133

SEE ALSO

135       attributes(5), attach(9E), detach(9E), usb_get_status(9F)
136
137
138
139SunOS 5.11                        17 Aug 2004     usb_register_hotplug_cbs(9F)
Impressum