-
Notifications
You must be signed in to change notification settings - Fork 0
/
group__libusb__hotplug.html
402 lines (382 loc) · 27.2 KB
/
group__libusb__hotplug.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libusb-1.0: Device hotplug event notification</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">libusb-1.0
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#define-members">Macros</a> |
<a href="#typedef-members">Typedefs</a> |
<a href="#enum-members">Enumerations</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">Device hotplug event notification</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:ga477938f3054724f16d9c34bc1e26d9bd"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__hotplug.html#ga477938f3054724f16d9c34bc1e26d9bd">LIBUSB_HOTPLUG_NO_FLAGS</a>   0</td></tr>
<tr class="separator:ga477938f3054724f16d9c34bc1e26d9bd"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga6d4f5e524a3b7ab4a25b751073335d4c"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__hotplug.html#ga6d4f5e524a3b7ab4a25b751073335d4c">LIBUSB_HOTPLUG_MATCH_ANY</a>   -1</td></tr>
<tr class="separator:ga6d4f5e524a3b7ab4a25b751073335d4c"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:ga4868157346bbf2c70b6af0cb0a6c0094"><td class="memItemLeft" align="right" valign="top">typedef int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__hotplug.html#ga4868157346bbf2c70b6af0cb0a6c0094">libusb_hotplug_callback_handle</a></td></tr>
<tr class="separator:ga4868157346bbf2c70b6af0cb0a6c0094"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga34e9904eb8e5124057a866f777cc99a8"><td class="memItemLeft" align="right" valign="top">typedef int(<a class="el" href="group__libusb__misc.html#gaa7d6035eb2692d455d27144560a0f68d">LIBUSB_CALL</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__hotplug.html#ga34e9904eb8e5124057a866f777cc99a8">libusb_hotplug_callback_fn</a>) (<a class="el" href="structlibusb__context.html">libusb_context</a> *ctx, <a class="el" href="structlibusb__device.html">libusb_device</a> *device, <a class="el" href="group__libusb__hotplug.html#ga556d598ca379618a41bbec3597f55dcf">libusb_hotplug_event</a> event, <a class="el" href="group__libusb__asyncio.html#ga8ca3594d1761da8da91be2851f4e8f21">void</a> *user_data)</td></tr>
<tr class="separator:ga34e9904eb8e5124057a866f777cc99a8"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:ga556d598ca379618a41bbec3597f55dcf"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__hotplug.html#ga556d598ca379618a41bbec3597f55dcf">libusb_hotplug_event</a> { <a class="el" href="group__libusb__hotplug.html#gga556d598ca379618a41bbec3597f55dcfac012270cba6e08dafe7e3bec204dffd6">LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED</a> = (1 << 0),
<a class="el" href="group__libusb__hotplug.html#gga556d598ca379618a41bbec3597f55dcfac8234e02b673893ed549329ef3180a27">LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT</a> = (1 << 1)
}</td></tr>
<tr class="separator:ga556d598ca379618a41bbec3597f55dcf"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga95ce2ec85dec177854c423cea2853c52"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__hotplug.html#ga95ce2ec85dec177854c423cea2853c52">libusb_hotplug_flag</a> { <a class="el" href="group__libusb__hotplug.html#gga95ce2ec85dec177854c423cea2853c52a01a1c0c9f4e6852cb6df713f2e8a7f6b">LIBUSB_HOTPLUG_ENUMERATE</a> = (1 << 0)
}</td></tr>
<tr class="separator:ga95ce2ec85dec177854c423cea2853c52"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga99561f74bde8a5abe4c165a84422706c"><td class="memItemLeft" align="right" valign="top">int <a class="el" href="group__libusb__misc.html#gaa7d6035eb2692d455d27144560a0f68d">LIBUSB_CALL</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__hotplug.html#ga99561f74bde8a5abe4c165a84422706c">libusb_hotplug_register_callback</a> (<a class="el" href="structlibusb__context.html">libusb_context</a> *ctx, int events, int flags, int vendor_id, int product_id, int dev_class, <a class="el" href="group__libusb__hotplug.html#ga34e9904eb8e5124057a866f777cc99a8">libusb_hotplug_callback_fn</a> cb_fn, <a class="el" href="group__libusb__asyncio.html#ga8ca3594d1761da8da91be2851f4e8f21">void</a> *user_data, <a class="el" href="group__libusb__hotplug.html#ga4868157346bbf2c70b6af0cb0a6c0094">libusb_hotplug_callback_handle</a> *callback_handle)</td></tr>
<tr class="separator:ga99561f74bde8a5abe4c165a84422706c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga19be9965224155cbc6ab5493f55e9ef1"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__libusb__asyncio.html#ga8ca3594d1761da8da91be2851f4e8f21">void</a> <a class="el" href="group__libusb__misc.html#gaa7d6035eb2692d455d27144560a0f68d">LIBUSB_CALL</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__hotplug.html#ga19be9965224155cbc6ab5493f55e9ef1">libusb_hotplug_deregister_callback</a> (<a class="el" href="structlibusb__context.html">libusb_context</a> *ctx, <a class="el" href="group__libusb__hotplug.html#ga4868157346bbf2c70b6af0cb0a6c0094">libusb_hotplug_callback_handle</a> callback_handle)</td></tr>
<tr class="separator:ga19be9965224155cbc6ab5493f55e9ef1"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga1a7b163cfc5abc1b5f8a4056f544649a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__libusb__asyncio.html#ga8ca3594d1761da8da91be2851f4e8f21">void</a> *<a class="el" href="group__libusb__misc.html#gaa7d6035eb2692d455d27144560a0f68d">LIBUSB_CALL</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__hotplug.html#ga1a7b163cfc5abc1b5f8a4056f544649a">libusb_hotplug_get_user_data</a> (<a class="el" href="structlibusb__context.html">libusb_context</a> *ctx, <a class="el" href="group__libusb__hotplug.html#ga4868157346bbf2c70b6af0cb0a6c0094">libusb_hotplug_callback_handle</a> callback_handle)</td></tr>
<tr class="separator:ga1a7b163cfc5abc1b5f8a4056f544649a"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>This page details how to use the libusb hotplug interface, where available.</p>
<p>Be mindful that not all platforms currently implement hotplug notification and that you should first call on <a class="el" href="group__libusb__misc.html#ga567724921075e6cf93da31305e09c072">libusb_has_capability()</a> with parameter <a class="el" href="group__libusb__misc.html#ggaab1b3fa0728c06fafbee897795889bd5a8b1bbccc648a6677cb9030a6ba827438">LIBUSB_CAP_HAS_HOTPLUG</a> to confirm that hotplug support is available. </p>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="ga6d4f5e524a3b7ab4a25b751073335d4c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga6d4f5e524a3b7ab4a25b751073335d4c">◆ </a></span>LIBUSB_HOTPLUG_MATCH_ANY</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define LIBUSB_HOTPLUG_MATCH_ANY   -1</td>
</tr>
</table>
</div><div class="memdoc">
<p>Wildcard matching for hotplug events </p>
</div>
</div>
<a id="ga477938f3054724f16d9c34bc1e26d9bd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga477938f3054724f16d9c34bc1e26d9bd">◆ </a></span>LIBUSB_HOTPLUG_NO_FLAGS</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define LIBUSB_HOTPLUG_NO_FLAGS   0</td>
</tr>
</table>
</div><div class="memdoc">
<p>Convenience macro when not using any flags </p>
</div>
</div>
<h2 class="groupheader">Typedef Documentation</h2>
<a id="ga34e9904eb8e5124057a866f777cc99a8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga34e9904eb8e5124057a866f777cc99a8">◆ </a></span>libusb_hotplug_callback_fn</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef int(<a class="el" href="group__libusb__misc.html#gaa7d6035eb2692d455d27144560a0f68d">LIBUSB_CALL</a> * libusb_hotplug_callback_fn) (<a class="el" href="structlibusb__context.html">libusb_context</a> *ctx, <a class="el" href="structlibusb__device.html">libusb_device</a> *device, <a class="el" href="group__libusb__hotplug.html#ga556d598ca379618a41bbec3597f55dcf">libusb_hotplug_event</a> event, <a class="el" href="group__libusb__asyncio.html#ga8ca3594d1761da8da91be2851f4e8f21">void</a> *user_data)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Hotplug callback function type. When requesting hotplug event notifications, you pass a pointer to a callback function of this type.</p>
<p>This callback may be called by an internal event thread and as such it is recommended the callback do minimal processing before returning.</p>
<p>libusb will call this function later, when a matching event had happened on a matching device. See <a class="el" href="libusb_hotplug.html">Device hotplug event notification</a> for more information.</p>
<p>It is safe to call either <a class="el" href="group__libusb__hotplug.html#ga99561f74bde8a5abe4c165a84422706c">libusb_hotplug_register_callback()</a> or <a class="el" href="group__libusb__hotplug.html#ga19be9965224155cbc6ab5493f55e9ef1">libusb_hotplug_deregister_callback()</a> from within a callback function.</p>
<p>Since version 1.0.16, <a class="el" href="group__libusb__misc.html#gaabe4bc36a83358685d36a6c853cbb4de">LIBUSB_API_VERSION</a> >= 0x01000102</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">ctx</td><td>context of this notification </td></tr>
<tr><td class="paramname">device</td><td><a class="el" href="structlibusb__device.html">libusb_device</a> this event occurred on </td></tr>
<tr><td class="paramname">event</td><td>event that occurred </td></tr>
<tr><td class="paramname">user_data</td><td>user data provided when this callback was registered </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>bool whether this callback is finished processing events. returning 1 will cause this callback to be deregistered </dd></dl>
</div>
</div>
<a id="ga4868157346bbf2c70b6af0cb0a6c0094"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4868157346bbf2c70b6af0cb0a6c0094">◆ </a></span>libusb_hotplug_callback_handle</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef int <a class="el" href="group__libusb__hotplug.html#ga4868157346bbf2c70b6af0cb0a6c0094">libusb_hotplug_callback_handle</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>Callback handle.</p>
<p>Callbacks handles are generated by <a class="el" href="group__libusb__hotplug.html#ga99561f74bde8a5abe4c165a84422706c">libusb_hotplug_register_callback()</a> and can be used to deregister callbacks. Callback handles are unique per <a class="el" href="structlibusb__context.html">libusb_context</a> and it is safe to call <a class="el" href="group__libusb__hotplug.html#ga19be9965224155cbc6ab5493f55e9ef1">libusb_hotplug_deregister_callback()</a> on an already deregistered callback.</p>
<p>Since version 1.0.16, <a class="el" href="group__libusb__misc.html#gaabe4bc36a83358685d36a6c853cbb4de">LIBUSB_API_VERSION</a> >= 0x01000102</p>
<p>For more information, see <a class="el" href="libusb_hotplug.html">Device hotplug event notification</a>. </p>
</div>
</div>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a id="ga556d598ca379618a41bbec3597f55dcf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga556d598ca379618a41bbec3597f55dcf">◆ </a></span>libusb_hotplug_event</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="group__libusb__hotplug.html#ga556d598ca379618a41bbec3597f55dcf">libusb_hotplug_event</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>Since version 1.0.16, <a class="el" href="group__libusb__misc.html#gaabe4bc36a83358685d36a6c853cbb4de">LIBUSB_API_VERSION</a> >= 0x01000102</p>
<p>Hotplug events </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="gga556d598ca379618a41bbec3597f55dcfac012270cba6e08dafe7e3bec204dffd6"></a>LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED </td><td class="fielddoc"><p>A device has been plugged in and is ready to use </p>
</td></tr>
<tr><td class="fieldname"><a id="gga556d598ca379618a41bbec3597f55dcfac8234e02b673893ed549329ef3180a27"></a>LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT </td><td class="fielddoc"><p>A device has left and is no longer available. It is the user's responsibility to call libusb_close on any handle associated with a disconnected device. It is safe to call libusb_get_device_descriptor on a device that has left </p>
</td></tr>
</table>
</div>
</div>
<a id="ga95ce2ec85dec177854c423cea2853c52"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga95ce2ec85dec177854c423cea2853c52">◆ </a></span>libusb_hotplug_flag</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="group__libusb__hotplug.html#ga95ce2ec85dec177854c423cea2853c52">libusb_hotplug_flag</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>Since version 1.0.16, <a class="el" href="group__libusb__misc.html#gaabe4bc36a83358685d36a6c853cbb4de">LIBUSB_API_VERSION</a> >= 0x01000102</p>
<p>Hotplug flags </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="gga95ce2ec85dec177854c423cea2853c52a01a1c0c9f4e6852cb6df713f2e8a7f6b"></a>LIBUSB_HOTPLUG_ENUMERATE </td><td class="fielddoc"><p>Arm the callback and fire it for all matching currently attached devices. </p>
</td></tr>
</table>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga19be9965224155cbc6ab5493f55e9ef1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga19be9965224155cbc6ab5493f55e9ef1">◆ </a></span>libusb_hotplug_deregister_callback()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__libusb__asyncio.html#ga8ca3594d1761da8da91be2851f4e8f21">void</a> <a class="el" href="group__libusb__misc.html#gaa7d6035eb2692d455d27144560a0f68d">LIBUSB_CALL</a> libusb_hotplug_deregister_callback </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structlibusb__context.html">libusb_context</a> * </td>
<td class="paramname"><em>ctx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__libusb__hotplug.html#ga4868157346bbf2c70b6af0cb0a6c0094">libusb_hotplug_callback_handle</a> </td>
<td class="paramname"><em>callback_handle</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Deregisters a hotplug callback.</p>
<p>Deregister a callback from a <a class="el" href="structlibusb__context.html">libusb_context</a>. This function is safe to call from within a hotplug callback.</p>
<p>Since version 1.0.16, <a class="el" href="group__libusb__misc.html#gaabe4bc36a83358685d36a6c853cbb4de">LIBUSB_API_VERSION</a> >= 0x01000102</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">ctx</td><td>context this callback is registered with </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback_handle</td><td>the handle of the callback to deregister </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="ga1a7b163cfc5abc1b5f8a4056f544649a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1a7b163cfc5abc1b5f8a4056f544649a">◆ </a></span>libusb_hotplug_get_user_data()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__libusb__asyncio.html#ga8ca3594d1761da8da91be2851f4e8f21">void</a>* <a class="el" href="group__libusb__misc.html#gaa7d6035eb2692d455d27144560a0f68d">LIBUSB_CALL</a> libusb_hotplug_get_user_data </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structlibusb__context.html">libusb_context</a> * </td>
<td class="paramname"><em>ctx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__libusb__hotplug.html#ga4868157346bbf2c70b6af0cb0a6c0094">libusb_hotplug_callback_handle</a> </td>
<td class="paramname"><em>callback_handle</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Gets the user_data associated with a hotplug callback.</p>
<p>Since version v1.0.24 <a class="el" href="group__libusb__misc.html#gaabe4bc36a83358685d36a6c853cbb4de">LIBUSB_API_VERSION</a> >= 0x01000108</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">ctx</td><td>context this callback is registered with </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback_handle</td><td>the handle of the callback to get the user_data of </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="ga99561f74bde8a5abe4c165a84422706c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga99561f74bde8a5abe4c165a84422706c">◆ </a></span>libusb_hotplug_register_callback()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="group__libusb__misc.html#gaa7d6035eb2692d455d27144560a0f68d">LIBUSB_CALL</a> libusb_hotplug_register_callback </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structlibusb__context.html">libusb_context</a> * </td>
<td class="paramname"><em>ctx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>events</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>flags</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>vendor_id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>product_id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>dev_class</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__libusb__hotplug.html#ga34e9904eb8e5124057a866f777cc99a8">libusb_hotplug_callback_fn</a> </td>
<td class="paramname"><em>cb_fn</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__libusb__asyncio.html#ga8ca3594d1761da8da91be2851f4e8f21">void</a> * </td>
<td class="paramname"><em>user_data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="group__libusb__hotplug.html#ga4868157346bbf2c70b6af0cb0a6c0094">libusb_hotplug_callback_handle</a> * </td>
<td class="paramname"><em>callback_handle</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Register a hotplug callback function</p>
<p>Register a callback with the <a class="el" href="structlibusb__context.html">libusb_context</a>. The callback will fire when a matching event occurs on a matching device. The callback is armed until either it is deregistered with <a class="el" href="group__libusb__hotplug.html#ga19be9965224155cbc6ab5493f55e9ef1">libusb_hotplug_deregister_callback()</a> or the supplied callback returns 1 to indicate it is finished processing events.</p>
<p>If the <a class="el" href="group__libusb__hotplug.html#gga95ce2ec85dec177854c423cea2853c52a01a1c0c9f4e6852cb6df713f2e8a7f6b">LIBUSB_HOTPLUG_ENUMERATE</a> is passed the callback will be called with a <a class="el" href="group__libusb__hotplug.html#gga556d598ca379618a41bbec3597f55dcfac012270cba6e08dafe7e3bec204dffd6">LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED</a> for all devices already plugged into the machine. Note that libusb modifies its internal device list from a separate thread, while calling hotplug callbacks from <a class="el" href="group__libusb__poll.html#gae51897021354eae052a382e814a587ba">libusb_handle_events()</a>, so it is possible for a device to already be present on, or removed from, its internal device list, while the hotplug callbacks still need to be dispatched. This means that when using <a class="el" href="group__libusb__hotplug.html#gga95ce2ec85dec177854c423cea2853c52a01a1c0c9f4e6852cb6df713f2e8a7f6b">LIBUSB_HOTPLUG_ENUMERATE</a>, your callback may be called twice for the arrival of the same device, once from <a class="el" href="group__libusb__hotplug.html#ga99561f74bde8a5abe4c165a84422706c">libusb_hotplug_register_callback()</a> and once from <a class="el" href="group__libusb__poll.html#gae51897021354eae052a382e814a587ba">libusb_handle_events()</a>; and/or your callback may be called for the removal of a device for which an arrived call was never made.</p>
<p>Since version 1.0.16, <a class="el" href="group__libusb__misc.html#gaabe4bc36a83358685d36a6c853cbb4de">LIBUSB_API_VERSION</a> >= 0x01000102</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">ctx</td><td>context to register this callback with </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">events</td><td>bitwise or of hotplug events that will trigger this callback. See <a class="el" href="group__libusb__hotplug.html#ga556d598ca379618a41bbec3597f55dcf">libusb_hotplug_event</a> </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">flags</td><td>bitwise or of hotplug flags that affect registration. See <a class="el" href="group__libusb__hotplug.html#ga95ce2ec85dec177854c423cea2853c52">libusb_hotplug_flag</a> </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">vendor_id</td><td>the vendor id to match or <a class="el" href="group__libusb__hotplug.html#ga6d4f5e524a3b7ab4a25b751073335d4c">LIBUSB_HOTPLUG_MATCH_ANY</a> </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">product_id</td><td>the product id to match or <a class="el" href="group__libusb__hotplug.html#ga6d4f5e524a3b7ab4a25b751073335d4c">LIBUSB_HOTPLUG_MATCH_ANY</a> </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dev_class</td><td>the device class to match or <a class="el" href="group__libusb__hotplug.html#ga6d4f5e524a3b7ab4a25b751073335d4c">LIBUSB_HOTPLUG_MATCH_ANY</a> </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">cb_fn</td><td>the function to be invoked on a matching event/device </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">user_data</td><td>user data to pass to the callback function </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">callback_handle</td><td>pointer to store the handle of the allocated callback (can be NULL) </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>LIBUSB_SUCCESS on success LIBUSB_ERROR code on failure </dd></dl>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>