-
Notifications
You must be signed in to change notification settings - Fork 0
/
group__libusb__asyncio.html
780 lines (750 loc) · 66.6 KB
/
group__libusb__asyncio.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
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
<!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: Asynchronous device I/O</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="#nested-classes">Classes</a> |
<a href="#enum-members">Enumerations</a> |
<a href="#func-members">Functions</a> |
<a href="#var-members">Variables</a> </div>
<div class="headertitle">
<div class="title">Asynchronous device I/O</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structlibusb__control__setup.html">libusb_control_setup</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structlibusb__iso__packet__descriptor.html">libusb_iso_packet_descriptor</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structlibusb__transfer.html">libusb_transfer</a></td></tr>
<tr class="separator:"><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:gacb52027036a07de6ecc6c2bf07d07c71"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__asyncio.html#gacb52027036a07de6ecc6c2bf07d07c71">libusb_transfer_type</a> { <br />
  <a class="el" href="group__libusb__asyncio.html#ggacb52027036a07de6ecc6c2bf07d07c71a4c89624658c783ef9b2a2f08091bc7d7">LIBUSB_TRANSFER_TYPE_CONTROL</a> = 0U,
<a class="el" href="group__libusb__asyncio.html#ggacb52027036a07de6ecc6c2bf07d07c71a40de9889554fc1785d784b3c31333300">LIBUSB_TRANSFER_TYPE_ISOCHRONOUS</a> = 1U,
<a class="el" href="group__libusb__asyncio.html#ggacb52027036a07de6ecc6c2bf07d07c71a7bdfa2fc5dadbaaa0e9262e1b4a228e2">LIBUSB_TRANSFER_TYPE_BULK</a> = 2U,
<a class="el" href="group__libusb__asyncio.html#ggacb52027036a07de6ecc6c2bf07d07c71aefb0e07862c0eed894ec9c2f957a7e3c">LIBUSB_TRANSFER_TYPE_INTERRUPT</a> = 3U,
<br />
  <a class="el" href="group__libusb__asyncio.html#ggacb52027036a07de6ecc6c2bf07d07c71a3b26ee40f9c586ece75f8de822d974e3">LIBUSB_TRANSFER_TYPE_BULK_STREAM</a> = 4U
<br />
}</td></tr>
<tr class="separator:gacb52027036a07de6ecc6c2bf07d07c71"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga9fcb2aa23d342060ebda1d0cf7478856"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__asyncio.html#ga9fcb2aa23d342060ebda1d0cf7478856">libusb_transfer_status</a> { <br />
  <a class="el" href="group__libusb__asyncio.html#gga9fcb2aa23d342060ebda1d0cf7478856a4595f6532aab12352a58a0fd4ce48363">LIBUSB_TRANSFER_COMPLETED</a>,
<a class="el" href="group__libusb__asyncio.html#gga9fcb2aa23d342060ebda1d0cf7478856aa8852ed719d03c2a3cc6f0312d919398">LIBUSB_TRANSFER_ERROR</a>,
<a class="el" href="group__libusb__asyncio.html#gga9fcb2aa23d342060ebda1d0cf7478856ac2b7626d7b51cb980f83933b6ada1ddf">LIBUSB_TRANSFER_TIMED_OUT</a>,
<a class="el" href="group__libusb__asyncio.html#gga9fcb2aa23d342060ebda1d0cf7478856a8af1f19e46cccafdcf3feadce47e880b">LIBUSB_TRANSFER_CANCELLED</a>,
<br />
  <a class="el" href="group__libusb__asyncio.html#gga9fcb2aa23d342060ebda1d0cf7478856a23cdfd929f5fe82cca9654f8075eeebb">LIBUSB_TRANSFER_STALL</a>,
<a class="el" href="group__libusb__asyncio.html#gga9fcb2aa23d342060ebda1d0cf7478856ab7dcb24f313ace407e0c070d6b2c5f13">LIBUSB_TRANSFER_NO_DEVICE</a>,
<a class="el" href="group__libusb__asyncio.html#gga9fcb2aa23d342060ebda1d0cf7478856ab1b9cbcb1de27a8fbeceb3427fb2fb14">LIBUSB_TRANSFER_OVERFLOW</a>
<br />
}</td></tr>
<tr class="separator:ga9fcb2aa23d342060ebda1d0cf7478856"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga1fb47dd0f7c209b60a3609ff0c03d56d"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__asyncio.html#ga1fb47dd0f7c209b60a3609ff0c03d56d">libusb_transfer_flags</a> { <a class="el" href="group__libusb__asyncio.html#gga1fb47dd0f7c209b60a3609ff0c03d56dae4c0697c266819c51c1734b3456e7276">LIBUSB_TRANSFER_SHORT_NOT_OK</a> = (1U << 0),
<a class="el" href="group__libusb__asyncio.html#gga1fb47dd0f7c209b60a3609ff0c03d56dae993a26f495ac9949118e23eafa19e86">LIBUSB_TRANSFER_FREE_BUFFER</a> = (1U << 1),
<a class="el" href="group__libusb__asyncio.html#gga1fb47dd0f7c209b60a3609ff0c03d56dacf3f064997b283a14097c9f4d6f8ccc1">LIBUSB_TRANSFER_FREE_TRANSFER</a> = (1U << 2),
<a class="el" href="group__libusb__asyncio.html#gga1fb47dd0f7c209b60a3609ff0c03d56da26b66334b6ec0537c49841ca623d901f">LIBUSB_TRANSFER_ADD_ZERO_PACKET</a> = (1U << 3)
}</td></tr>
<tr class="separator:ga1fb47dd0f7c209b60a3609ff0c03d56d"><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:ga972b60e72123e4a3bf4b212058efd192"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__asyncio.html#ga972b60e72123e4a3bf4b212058efd192">libusb_alloc_streams</a> (<a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> *dev_handle, uint32_t num_streams, unsigned char *endpoints, int num_endpoints)</td></tr>
<tr class="separator:ga972b60e72123e4a3bf4b212058efd192"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gac785f5d9684b73563feed4be4996e3bb"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__asyncio.html#gac785f5d9684b73563feed4be4996e3bb">libusb_free_streams</a> (<a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> *dev_handle, unsigned char *endpoints, int num_endpoints)</td></tr>
<tr class="separator:gac785f5d9684b73563feed4be4996e3bb"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga5697b9a374c2787a7536fc686f565949"><td class="memItemLeft" align="right" valign="top">DEFAULT_VISIBILITY unsigned char *<a class="el" href="group__libusb__misc.html#gaa7d6035eb2692d455d27144560a0f68d">LIBUSB_CALL</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__asyncio.html#ga5697b9a374c2787a7536fc686f565949">libusb_dev_mem_alloc</a> (<a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> *dev_handle, size_t length)</td></tr>
<tr class="separator:ga5697b9a374c2787a7536fc686f565949"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga4c8a68ef4a8b17987a9659563f65978a"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__asyncio.html#ga4c8a68ef4a8b17987a9659563f65978a">libusb_dev_mem_free</a> (<a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> *dev_handle, unsigned char *buffer, size_t length)</td></tr>
<tr class="separator:ga4c8a68ef4a8b17987a9659563f65978a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gabb0740dc2039c67133ddb2d120607b8f"><td class="memItemLeft" align="right" valign="top">DEFAULT_VISIBILITY struct <a class="el" href="structlibusb__transfer.html">libusb_transfer</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__asyncio.html#gabb0740dc2039c67133ddb2d120607b8f">libusb_alloc_transfer</a> (int iso_packets)</td></tr>
<tr class="separator:gabb0740dc2039c67133ddb2d120607b8f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gad7075ddcf5eb9ec2626e7e1856d093e8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__libusb__asyncio.html#ga8ca3594d1761da8da91be2851f4e8f21">void</a> API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__asyncio.html#gad7075ddcf5eb9ec2626e7e1856d093e8">libusb_free_transfer</a> (struct <a class="el" href="structlibusb__transfer.html">libusb_transfer</a> *transfer)</td></tr>
<tr class="separator:gad7075ddcf5eb9ec2626e7e1856d093e8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga01cdfe1a27027a5f438b17cf2dcede2b"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__asyncio.html#ga01cdfe1a27027a5f438b17cf2dcede2b">libusb_submit_transfer</a> (struct <a class="el" href="structlibusb__transfer.html">libusb_transfer</a> *transfer)</td></tr>
<tr class="separator:ga01cdfe1a27027a5f438b17cf2dcede2b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga80bcab68de0dbc6daf6bf63e12c4807b"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__asyncio.html#ga80bcab68de0dbc6daf6bf63e12c4807b">libusb_cancel_transfer</a> (struct <a class="el" href="structlibusb__transfer.html">libusb_transfer</a> *transfer)</td></tr>
<tr class="separator:ga80bcab68de0dbc6daf6bf63e12c4807b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga4a6a87e75c3741d300e61efd202b171d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__libusb__asyncio.html#ga8ca3594d1761da8da91be2851f4e8f21">void</a> API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__asyncio.html#ga4a6a87e75c3741d300e61efd202b171d">libusb_transfer_set_stream_id</a> (struct <a class="el" href="structlibusb__transfer.html">libusb_transfer</a> *transfer, uint32_t stream_id)</td></tr>
<tr class="separator:ga4a6a87e75c3741d300e61efd202b171d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga906bc4f8e239db8dcdb8ea0cdfa1c579"><td class="memItemLeft" align="right" valign="top">uint32_t API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__asyncio.html#ga906bc4f8e239db8dcdb8ea0cdfa1c579">libusb_transfer_get_stream_id</a> (struct <a class="el" href="structlibusb__transfer.html">libusb_transfer</a> *transfer)</td></tr>
<tr class="separator:ga906bc4f8e239db8dcdb8ea0cdfa1c579"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga8ca3594d1761da8da91be2851f4e8f21"><td class="memItemLeft" align="right" valign="top">typedef </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__asyncio.html#ga8ca3594d1761da8da91be2851f4e8f21">void</a> (<a class="el" href="group__libusb__misc.html#gaa7d6035eb2692d455d27144560a0f68d">LIBUSB_CALL</a> *libusb_transfer_cb_fn)(struct <a class="el" href="structlibusb__transfer.html">libusb_transfer</a> *transfer)</td></tr>
<tr class="separator:ga8ca3594d1761da8da91be2851f4e8f21"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:ga87b7511425c8a008b26dfed94043984a"><td class="memItemLeft" align="right" valign="top"><a id="ga87b7511425c8a008b26dfed94043984a"></a>
struct <a class="el" href="structlibusb__control__setup.html">libusb_control_setup</a> </td><td class="memItemRight" valign="bottom"><b>LIBUSB_PACKED</b></td></tr>
<tr class="separator:ga87b7511425c8a008b26dfed94043984a"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>This page details libusb's asynchronous (non-blocking) API for USB device I/O. This interface is very powerful but is also quite complex - you will need to read this page carefully to understand the necessary considerations and issues surrounding use of this interface. Simplistic applications may wish to consider the <a class="el" href="group__libusb__syncio.html">synchronous I/O API</a> instead.</p>
<p>The asynchronous interface is built around the idea of separating transfer submission and handling of transfer completion (the synchronous model combines both of these into one). There may be a long delay between submission and completion, however the asynchronous submission function is non-blocking so will return control to your application during that potentially long delay.</p>
<h1><a class="anchor" id="asyncabstraction"></a>
Transfer abstraction</h1>
<p>For the asynchronous I/O, libusb implements the concept of a generic transfer entity for all types of I/O (control, bulk, interrupt, isochronous). The generic transfer object must be treated slightly differently depending on which type of I/O you are performing with it.</p>
<p>This is represented by the public <a class="el" href="structlibusb__transfer.html">libusb_transfer</a> structure type.</p>
<h1><a class="anchor" id="asynctrf"></a>
Asynchronous transfers</h1>
<p>We can view asynchronous I/O as a 5 step process:</p><ol type="1">
<li><b>Allocation</b>: allocate a <a class="el" href="structlibusb__transfer.html">libusb_transfer</a></li>
<li><b>Filling</b>: populate the <a class="el" href="structlibusb__transfer.html">libusb_transfer</a> instance with information about the transfer you wish to perform</li>
<li><b>Submission</b>: ask libusb to submit the transfer</li>
<li><b>Completion handling</b>: examine transfer results in the <a class="el" href="structlibusb__transfer.html">libusb_transfer</a> structure</li>
<li><b>Deallocation</b>: clean up resources</li>
</ol>
<h2><a class="anchor" id="asyncalloc"></a>
Allocation</h2>
<p>This step involves allocating memory for a USB transfer. This is the generic transfer object mentioned above. At this stage, the transfer is "blank" with no details about what type of I/O it will be used for.</p>
<p>Allocation is done with the <a class="el" href="group__libusb__asyncio.html#gabb0740dc2039c67133ddb2d120607b8f">libusb_alloc_transfer()</a> function. You must use this function rather than allocating your own transfers.</p>
<h2><a class="anchor" id="asyncfill"></a>
Filling</h2>
<p>This step is where you take a previously allocated transfer and fill it with information to determine the message type and direction, data buffer, callback function, etc.</p>
<p>You can either fill the required fields yourself or you can use the helper functions: libusb_fill_control_transfer(), libusb_fill_bulk_transfer() and libusb_fill_interrupt_transfer().</p>
<h2><a class="anchor" id="asyncsubmit"></a>
Submission</h2>
<p>When you have allocated a transfer and filled it, you can submit it using <a class="el" href="group__libusb__asyncio.html#ga01cdfe1a27027a5f438b17cf2dcede2b">libusb_submit_transfer()</a>. This function returns immediately but can be regarded as firing off the I/O request in the background.</p>
<h2><a class="anchor" id="asynccomplete"></a>
Completion handling</h2>
<p>After a transfer has been submitted, one of four things can happen to it:</p>
<ul>
<li>The transfer completes (i.e. some data was transferred)</li>
<li>The transfer has a timeout and the timeout expires before all data is transferred</li>
<li>The transfer fails due to an error</li>
<li>The transfer is cancelled</li>
</ul>
<p>Each of these will cause the user-specified transfer callback function to be invoked. It is up to the callback function to determine which of the above actually happened and to act accordingly.</p>
<p>The user-specified callback is passed a pointer to the <a class="el" href="structlibusb__transfer.html">libusb_transfer</a> structure which was used to setup and submit the transfer. At completion time, libusb has populated this structure with results of the transfer: success or failure reason, number of bytes of data transferred, etc. See the <a class="el" href="structlibusb__transfer.html">libusb_transfer</a> structure documentation for more information.</p>
<p><b>Important Note</b>: The user-specified callback is called from an event handling context. It is therefore important that no calls are made into libusb that will attempt to perform any event handling. Examples of such functions are any listed in the <a class="el" href="group__libusb__syncio.html">synchronous API</a> and any of the blocking functions that retrieve <a class="el" href="group__libusb__desc.html">USB descriptors</a>.</p>
<h2><a class="anchor" id="Deallocation"></a>
Deallocation</h2>
<p>When a transfer has completed (i.e. the callback function has been invoked), you are advised to free the transfer (unless you wish to resubmit it, see below). Transfers are deallocated with <a class="el" href="group__libusb__asyncio.html#gad7075ddcf5eb9ec2626e7e1856d093e8">libusb_free_transfer()</a>.</p>
<p>It is undefined behaviour to free a transfer which has not completed.</p>
<h1><a class="anchor" id="asyncresubmit"></a>
Resubmission</h1>
<p>You may be wondering why allocation, filling, and submission are all separated above where they could reasonably be combined into a single operation.</p>
<p>The reason for separation is to allow you to resubmit transfers without having to allocate new ones every time. This is especially useful for common situations dealing with interrupt endpoints - you allocate one transfer, fill and submit it, and when it returns with results you just resubmit it for the next interrupt.</p>
<h1><a class="anchor" id="asynccancel"></a>
Cancellation</h1>
<p>Another advantage of using the asynchronous interface is that you have the ability to cancel transfers which have not yet completed. This is done by calling the <a class="el" href="group__libusb__asyncio.html#ga80bcab68de0dbc6daf6bf63e12c4807b">libusb_cancel_transfer()</a> function.</p>
<p><a class="el" href="group__libusb__asyncio.html#ga80bcab68de0dbc6daf6bf63e12c4807b">libusb_cancel_transfer()</a> is asynchronous/non-blocking in itself. When the cancellation actually completes, the transfer's callback function will be invoked, and the callback function should check the transfer status to determine that it was cancelled.</p>
<p>Freeing the transfer after it has been cancelled but before cancellation has completed will result in undefined behaviour.</p>
<dl class="section attention"><dt>Attention</dt><dd>When a transfer is cancelled, some of the data may have been transferred. libusb will communicate this to you in the transfer callback. <b>Do not assume that no data was transferred.</b></dd></dl>
<h1><a class="anchor" id="asyncpartial"></a>
Partial data transfer resulting from cancellation</h1>
<p>As noted above, some of the data may have been transferred at the time a transfer is cancelled. It is helpful to see how this is possible if you consider a bulk transfer to an endpoint with a packet size of 64 bytes. Supposing you submit a 512-byte transfer to this endpoint, the operating system will divide this transfer up into 8 separate 64-byte frames that the host controller will schedule for the device to transfer data. If this transfer is cancelled while the device is transferring data, a subset of these frames may be descheduled from the host controller before the device has the opportunity to finish transferring data to the host.</p>
<p>What your application should do with a partial data transfer is a policy decision; there is no single answer that satisfies the needs of every application. The data that was successfully transferred should be considered entirely valid, but your application must decide what to do with the remaining data that was not transferred. Some possible actions to take are:</p><ul>
<li>Resubmit another transfer for the remaining data, possibly with a shorter timeout</li>
<li>Discard the partially transferred data and report an error</li>
</ul>
<h1><a class="anchor" id="asynctimeout"></a>
Timeouts</h1>
<p>When a transfer times out, libusb internally notes this and attempts to cancel the transfer. As noted in <a class="el" href="group__libusb__asyncio.html#asyncpartial">above</a>, it is possible that some of the data may actually have been transferred. Your application should <b>always</b> check how much data was actually transferred once the transfer completes and act accordingly.</p>
<h1><a class="anchor" id="bulk_overflows"></a>
Overflows on device-to-host bulk/interrupt endpoints</h1>
<p>If your device does not have predictable transfer sizes (or it misbehaves), your application may submit a request for data on an IN endpoint which is smaller than the data that the device wishes to send. In some circumstances this will cause an overflow, which is a nasty condition to deal with. See the <a class="el" href="libusb_packetoverflow.html">Packets and overflows</a> page for discussion.</p>
<h1><a class="anchor" id="asyncctrl"></a>
Considerations for control transfers</h1>
<p>The <code><a class="el" href="structlibusb__transfer.html">libusb_transfer</a></code> structure is generic and hence does not include specific fields for the control-specific setup packet structure.</p>
<p>In order to perform a control transfer, you must place the 8-byte setup packet at the start of the data buffer. To simplify this, you could cast the buffer pointer to type struct <a class="el" href="structlibusb__control__setup.html">libusb_control_setup</a>, or you can use the helper function libusb_fill_control_setup().</p>
<p>The wLength field placed in the setup packet must be the length you would expect to be sent in the setup packet: the length of the payload that follows (or the expected maximum number of bytes to receive). However, the length field of the <a class="el" href="structlibusb__transfer.html">libusb_transfer</a> object must be the length of the data buffer - i.e. it should be wLength <em>plus</em> the size of the setup packet (LIBUSB_CONTROL_SETUP_SIZE).</p>
<p>If you use the helper functions, this is simplified for you:</p><ol type="1">
<li>Allocate a buffer of size LIBUSB_CONTROL_SETUP_SIZE plus the size of the data you are sending/requesting.</li>
<li>Call libusb_fill_control_setup() on the data buffer, using the transfer request size as the wLength value (i.e. do not include the extra space you allocated for the control setup).</li>
<li>If this is a host-to-device transfer, place the data to be transferred in the data buffer, starting at offset LIBUSB_CONTROL_SETUP_SIZE.</li>
<li>Call libusb_fill_control_transfer() to associate the data buffer with the transfer (and to set the remaining details such as callback and timeout).<ul>
<li>Note that there is no parameter to set the length field of the transfer. The length is automatically inferred from the wLength field of the setup packet.</li>
</ul>
</li>
<li>Submit the transfer.</li>
</ol>
<p>The multi-byte control setup fields (wValue, wIndex and wLength) must be given in little-endian byte order (the endianness of the USB bus). Endianness conversion is transparently handled by libusb_fill_control_setup() which is documented to accept host-endian values.</p>
<p>Further considerations are needed when handling transfer completion in your callback function:</p><ul>
<li>As you might expect, the setup packet will still be sitting at the start of the data buffer.</li>
<li>If this was a device-to-host transfer, the received data will be sitting at offset LIBUSB_CONTROL_SETUP_SIZE into the buffer.</li>
<li>The actual_length field of the transfer structure is relative to the wLength of the setup packet, rather than the size of the data buffer. So, if your wLength was 4, your transfer's <code>length</code> was 12, then you should expect an <code>actual_length</code> of 4 to indicate that the data was transferred in entirety.</li>
</ul>
<p>To simplify parsing of setup packets and obtaining the data from the correct offset, you may wish to use the libusb_control_transfer_get_data() and libusb_control_transfer_get_setup() functions within your transfer callback.</p>
<p>Even though control endpoints do not halt, a completed control transfer may have a LIBUSB_TRANSFER_STALL status code. This indicates the control request was not supported.</p>
<h1><a class="anchor" id="asyncintr"></a>
Considerations for interrupt transfers</h1>
<p>All interrupt transfers are performed using the polling interval presented by the bInterval value of the endpoint descriptor.</p>
<h1><a class="anchor" id="asynciso"></a>
Considerations for isochronous transfers</h1>
<p>Isochronous transfers are more complicated than transfers to non-isochronous endpoints.</p>
<p>To perform I/O to an isochronous endpoint, allocate the transfer by calling <a class="el" href="group__libusb__asyncio.html#gabb0740dc2039c67133ddb2d120607b8f">libusb_alloc_transfer()</a> with an appropriate number of isochronous packets.</p>
<p>During filling, set <a class="el" href="structlibusb__transfer.html#a7c9fa575986fe9f23bbecb26b766dff1">type</a> to <a class="el" href="group__libusb__asyncio.html#ggacb52027036a07de6ecc6c2bf07d07c71a40de9889554fc1785d784b3c31333300">LIBUSB_TRANSFER_TYPE_ISOCHRONOUS</a>, and set <a class="el" href="structlibusb__transfer.html#a87d725a5521c26832fdc13611220014d">num_iso_packets</a> to a value less than or equal to the number of packets you requested during allocation. <a class="el" href="group__libusb__asyncio.html#gabb0740dc2039c67133ddb2d120607b8f">libusb_alloc_transfer()</a> does not set either of these fields for you, given that you might not even use the transfer on an isochronous endpoint.</p>
<p>Next, populate the length field for the first num_iso_packets entries in the <a class="el" href="structlibusb__transfer.html#a3b72ef736d32b94a7097798612741644">iso_packet_desc</a> array. Section 5.6.3 of the USB2 specifications describe how the maximum isochronous packet length is determined by the wMaxPacketSize field in the endpoint descriptor. Two functions can help you here:</p>
<ul>
<li><a class="el" href="group__libusb__dev.html#ga1fa14fbac99af872f5b075775d1a7382">libusb_get_max_iso_packet_size()</a> is an easy way to determine the max packet size for an isochronous endpoint. Note that the maximum packet size is actually the maximum number of bytes that can be transmitted in a single microframe, therefore this function multiplies the maximum number of bytes per transaction by the number of transaction opportunities per microframe.</li>
<li>libusb_set_iso_packet_lengths() assigns the same length to all packets within a transfer, which is usually what you want.</li>
</ul>
<p>For outgoing transfers, you'll obviously fill the buffer and populate the packet descriptors in hope that all the data gets transferred. For incoming transfers, you must ensure the buffer has sufficient capacity for the situation where all packets transfer the full amount of requested data.</p>
<p>Completion handling requires some extra consideration. The <a class="el" href="structlibusb__transfer.html#a7e858f07c48a271a62209d11376ae607">actual_length</a> field of the transfer is meaningless and should not be examined; instead you must refer to the <a class="el" href="structlibusb__iso__packet__descriptor.html#a03fa4f4eaf8a8b4e5c05931809581a32">actual_length</a> field of each individual packet.</p>
<p>The <a class="el" href="structlibusb__transfer.html#a64b2e70e76d52a7cd23daa3cd4fb397e">status</a> field of the transfer is also a little misleading:</p><ul>
<li>If the packets were submitted and the isochronous data microframes completed normally, status will have value <a class="el" href="group__libusb__asyncio.html#gga9fcb2aa23d342060ebda1d0cf7478856a4595f6532aab12352a58a0fd4ce48363">LIBUSB_TRANSFER_COMPLETED</a>. Note that bus errors and software-incurred delays are not counted as transfer errors; the transfer.status field may indicate COMPLETED even if some or all of the packets failed. Refer to the <a class="el" href="structlibusb__iso__packet__descriptor.html#aab21ee2a5835a0e53d7ac5844ee34371">status</a> field of each individual packet to determine packet failures.</li>
<li>The status field will have value <a class="el" href="group__libusb__asyncio.html#gga9fcb2aa23d342060ebda1d0cf7478856aa8852ed719d03c2a3cc6f0312d919398">LIBUSB_TRANSFER_ERROR</a> only when serious errors were encountered.</li>
<li>Other transfer status codes occur with normal behaviour.</li>
</ul>
<p>The data for each packet will be found at an offset into the buffer that can be calculated as if each prior packet completed in full. The libusb_get_iso_packet_buffer() and libusb_get_iso_packet_buffer_simple() functions may help you here.</p>
<h1><a class="anchor" id="asynclimits"></a>
Transfer length limitations</h1>
<p>Some operating systems may impose limits on the length of the transfer data buffer or, in the case of isochronous transfers, the length of individual isochronous packets. Such limits can be difficult for libusb to detect, so in most cases the library will simply try and submit the transfer as set up by you. If the transfer fails to submit because it is too large, <a class="el" href="group__libusb__asyncio.html#ga01cdfe1a27027a5f438b17cf2dcede2b">libusb_submit_transfer()</a> will return <a class="el" href="group__libusb__misc.html#ggab2323aa0f04bc22038e7e1740b2f29efa680e4bf39b66a36be3182be3ebf58062">LIBUSB_ERROR_INVALID_PARAM</a>.</p>
<p>The following are known limits for control transfer lengths. Note that this length includes the 8-byte setup packet.</p><ul>
<li>Linux (4,096 bytes)</li>
<li>Windows (4,096 bytes)</li>
</ul>
<h1><a class="anchor" id="asyncmem"></a>
Memory caveats</h1>
<p>In most circumstances, it is not safe to use stack memory for transfer buffers. This is because the function that fired off the asynchronous transfer may return before libusb has finished using the buffer, and when the function returns it's stack gets destroyed. This is true for both host-to-device and device-to-host transfers.</p>
<p>The only case in which it is safe to use stack memory is where you can guarantee that the function owning the stack space for the buffer does not return until after the transfer's callback function has completed. In every other case, you need to use heap memory instead.</p>
<h1><a class="anchor" id="asyncflags"></a>
Fine control</h1>
<p>Through using this asynchronous interface, you may find yourself repeating a few simple operations many times. You can apply a bitwise OR of certain flags to a transfer to simplify certain things:</p><ul>
<li><a class="el" href="group__libusb__asyncio.html#gga1fb47dd0f7c209b60a3609ff0c03d56dae4c0697c266819c51c1734b3456e7276">LIBUSB_TRANSFER_SHORT_NOT_OK</a> results in transfers which transferred less than the requested amount of data being marked with status <a class="el" href="group__libusb__asyncio.html#gga9fcb2aa23d342060ebda1d0cf7478856aa8852ed719d03c2a3cc6f0312d919398">LIBUSB_TRANSFER_ERROR</a> (they would normally be regarded as COMPLETED)</li>
<li><a class="el" href="group__libusb__asyncio.html#gga1fb47dd0f7c209b60a3609ff0c03d56dae993a26f495ac9949118e23eafa19e86">LIBUSB_TRANSFER_FREE_BUFFER</a> allows you to ask libusb to free the transfer buffer when freeing the transfer.</li>
<li><a class="el" href="group__libusb__asyncio.html#gga1fb47dd0f7c209b60a3609ff0c03d56dacf3f064997b283a14097c9f4d6f8ccc1">LIBUSB_TRANSFER_FREE_TRANSFER</a> causes libusb to automatically free the transfer after the transfer callback returns.</li>
</ul>
<h1><a class="anchor" id="asyncevent"></a>
Event handling</h1>
<p>An asynchronous model requires that libusb perform work at various points in time - namely processing the results of previously-submitted transfers and invoking the user-supplied callback function.</p>
<p>This gives rise to the <a class="el" href="group__libusb__poll.html#gae51897021354eae052a382e814a587ba">libusb_handle_events()</a> function which your application must call into when libusb has work do to. This gives libusb the opportunity to reap pending transfers, invoke callbacks, etc.</p>
<dl class="section note"><dt>Note</dt><dd>All event handling is performed by whichever thread calls the <a class="el" href="group__libusb__poll.html#gae51897021354eae052a382e814a587ba">libusb_handle_events()</a> function. libusb does not invoke any callbacks outside of this context. Consequently, any callbacks will be run on the thread that calls the <a class="el" href="group__libusb__poll.html#gae51897021354eae052a382e814a587ba">libusb_handle_events()</a> function.</dd></dl>
<p>When to call the <a class="el" href="group__libusb__poll.html#gae51897021354eae052a382e814a587ba">libusb_handle_events()</a> function depends on which model your application decides to use. The 2 different approaches:</p>
<ol type="1">
<li>Repeatedly call <a class="el" href="group__libusb__poll.html#gae51897021354eae052a382e814a587ba">libusb_handle_events()</a> in blocking mode from a dedicated thread.</li>
<li>Integrate libusb with your application's main event loop. libusb exposes a set of file descriptors which allow you to do this.</li>
</ol>
<p>The first approach has the big advantage that it will also work on Windows were libusb' poll API for select / poll integration is not available. So if you want to support Windows and use the async API, you must use this approach, see the <a class="el" href="group__libusb__asyncio.html#eventthread">Using an event handling thread</a> section below for details.</p>
<p>If you prefer a single threaded approach with a single central event loop, see the <a class="el" href="group__libusb__poll.html">polling and timing</a> section for how to integrate libusb into your application's main event loop.</p>
<h1><a class="anchor" id="eventthread"></a>
Using an event handling thread</h1>
<p>Lets begin with stating the obvious: If you're going to use a separate thread for libusb event handling, your callback functions MUST be thread-safe.</p>
<p>Other then that doing event handling from a separate thread, is mostly simple. You can use an event thread function as follows: </p><div class="fragment"><div class="line"><span class="keywordtype">void</span> *event_thread_func(<span class="keywordtype">void</span> *ctx)</div><div class="line">{</div><div class="line"> <span class="keywordflow">while</span> (event_thread_run)</div><div class="line"> <a class="code" href="group__libusb__poll.html#gae51897021354eae052a382e814a587ba">libusb_handle_events</a>(ctx);</div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> NULL;</div><div class="line">}</div></div><!-- fragment --><p>There is one caveat though, stopping this thread requires setting the event_thread_run variable to 0, and after that <a class="el" href="group__libusb__poll.html#gae51897021354eae052a382e814a587ba">libusb_handle_events()</a> needs to return control to event_thread_func. But unless some event happens, <a class="el" href="group__libusb__poll.html#gae51897021354eae052a382e814a587ba">libusb_handle_events()</a> will not return.</p>
<p>There are 2 different ways of dealing with this, depending on if your application uses libusb' <a class="el" href="libusb_hotplug.html">hotplug</a> support or not.</p>
<p>Applications which do not use hotplug support, should not start the event thread until after their first call to <a class="el" href="group__libusb__dev.html#gaae48f83e4b9652964ce501d914dd505e">libusb_open()</a>, and should stop the thread when closing the last open device as follows: </p><div class="fragment"><div class="line"><span class="keywordtype">void</span> my_close_handle(<a class="code" href="structlibusb__device__handle.html">libusb_device_handle</a> *dev_handle)</div><div class="line">{</div><div class="line"> <span class="keywordflow">if</span> (open_devs == 1)</div><div class="line"> event_thread_run = 0;</div><div class="line"></div><div class="line"> <a class="code" href="group__libusb__dev.html#ga6c0534023632fdc669c1dde47f259f2f">libusb_close</a>(dev_handle); <span class="comment">// This wakes up libusb_handle_events()</span></div><div class="line"></div><div class="line"> <span class="keywordflow">if</span> (open_devs == 1)</div><div class="line"> pthread_join(event_thread);</div><div class="line"></div><div class="line"> open_devs--;</div><div class="line">}</div></div><!-- fragment --><p>Applications using hotplug support should start the thread at program init, after having successfully called <a class="el" href="group__libusb__hotplug.html#ga99561f74bde8a5abe4c165a84422706c">libusb_hotplug_register_callback()</a>, and should stop the thread at program exit as follows: </p><div class="fragment"><div class="line"><span class="keywordtype">void</span> my_libusb_exit(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line"> event_thread_run = 0;</div><div class="line"> <a class="code" href="group__libusb__hotplug.html#ga19be9965224155cbc6ab5493f55e9ef1">libusb_hotplug_deregister_callback</a>(ctx, hotplug_cb_handle); <span class="comment">// This wakes up libusb_handle_events()</span></div><div class="line"> pthread_join(event_thread);</div><div class="line"> <a class="code" href="group__libusb__lib.html#gab57b6d0abf8349a24792f12b53d20220">libusb_exit</a>(ctx);</div><div class="line">}</div></div><!-- fragment --> <h2 class="groupheader">Enumeration Type Documentation</h2>
<a id="ga1fb47dd0f7c209b60a3609ff0c03d56d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1fb47dd0f7c209b60a3609ff0c03d56d">◆ </a></span>libusb_transfer_flags</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="group__libusb__asyncio.html#ga1fb47dd0f7c209b60a3609ff0c03d56d">libusb_transfer_flags</a></td>
</tr>
</table>
</div><div class="memdoc">
<p><a class="el" href="structlibusb__transfer.html#ae26c063df30c2e29835212aad98c6e06">libusb_transfer.flags</a> values </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="gga1fb47dd0f7c209b60a3609ff0c03d56dae4c0697c266819c51c1734b3456e7276"></a>LIBUSB_TRANSFER_SHORT_NOT_OK </td><td class="fielddoc"><p>Report short frames as errors </p>
</td></tr>
<tr><td class="fieldname"><a id="gga1fb47dd0f7c209b60a3609ff0c03d56dae993a26f495ac9949118e23eafa19e86"></a>LIBUSB_TRANSFER_FREE_BUFFER </td><td class="fielddoc"><p>Automatically free() transfer buffer during <a class="el" href="group__libusb__asyncio.html#gad7075ddcf5eb9ec2626e7e1856d093e8">libusb_free_transfer()</a>. Note that buffers allocated with <a class="el" href="group__libusb__asyncio.html#ga5697b9a374c2787a7536fc686f565949">libusb_dev_mem_alloc()</a> should not be attempted freed in this way, since free() is not an appropriate way to release such memory. </p>
</td></tr>
<tr><td class="fieldname"><a id="gga1fb47dd0f7c209b60a3609ff0c03d56dacf3f064997b283a14097c9f4d6f8ccc1"></a>LIBUSB_TRANSFER_FREE_TRANSFER </td><td class="fielddoc"><p>Automatically call <a class="el" href="group__libusb__asyncio.html#gad7075ddcf5eb9ec2626e7e1856d093e8">libusb_free_transfer()</a> after callback returns. If this flag is set, it is illegal to call <a class="el" href="group__libusb__asyncio.html#gad7075ddcf5eb9ec2626e7e1856d093e8">libusb_free_transfer()</a> from your transfer callback, as this will result in a double-free when this flag is acted upon. </p>
</td></tr>
<tr><td class="fieldname"><a id="gga1fb47dd0f7c209b60a3609ff0c03d56da26b66334b6ec0537c49841ca623d901f"></a>LIBUSB_TRANSFER_ADD_ZERO_PACKET </td><td class="fielddoc"><p>Terminate transfers that are a multiple of the endpoint's wMaxPacketSize with an extra zero length packet. This is useful when a device protocol mandates that each logical request is terminated by an incomplete packet (i.e. the logical requests are not separated by other means).</p>
<p>This flag only affects host-to-device transfers to bulk and interrupt endpoints. In other situations, it is ignored.</p>
<p>This flag only affects transfers with a length that is a multiple of the endpoint's wMaxPacketSize. On transfers of other lengths, this flag has no effect. Therefore, if you are working with a device that needs a ZLP whenever the end of the logical request falls on a packet boundary, then it is sensible to set this flag on <em>every</em> transfer (you do not have to worry about only setting it on transfers that end on the boundary).</p>
<p>This flag is currently only supported on Linux. On other systems, <a class="el" href="group__libusb__asyncio.html#ga01cdfe1a27027a5f438b17cf2dcede2b">libusb_submit_transfer()</a> will return LIBUSB_ERROR_NOT_SUPPORTED for every transfer where this flag is set.</p>
<p>Available since libusb-1.0.9. </p>
</td></tr>
</table>
</div>
</div>
<a id="ga9fcb2aa23d342060ebda1d0cf7478856"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9fcb2aa23d342060ebda1d0cf7478856">◆ </a></span>libusb_transfer_status</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="group__libusb__asyncio.html#ga9fcb2aa23d342060ebda1d0cf7478856">libusb_transfer_status</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>Transfer status codes </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="gga9fcb2aa23d342060ebda1d0cf7478856a4595f6532aab12352a58a0fd4ce48363"></a>LIBUSB_TRANSFER_COMPLETED </td><td class="fielddoc"><p>Transfer completed without error. Note that this does not indicate that the entire amount of requested data was transferred. </p>
</td></tr>
<tr><td class="fieldname"><a id="gga9fcb2aa23d342060ebda1d0cf7478856aa8852ed719d03c2a3cc6f0312d919398"></a>LIBUSB_TRANSFER_ERROR </td><td class="fielddoc"><p>Transfer failed </p>
</td></tr>
<tr><td class="fieldname"><a id="gga9fcb2aa23d342060ebda1d0cf7478856ac2b7626d7b51cb980f83933b6ada1ddf"></a>LIBUSB_TRANSFER_TIMED_OUT </td><td class="fielddoc"><p>Transfer timed out </p>
</td></tr>
<tr><td class="fieldname"><a id="gga9fcb2aa23d342060ebda1d0cf7478856a8af1f19e46cccafdcf3feadce47e880b"></a>LIBUSB_TRANSFER_CANCELLED </td><td class="fielddoc"><p>Transfer was cancelled </p>
</td></tr>
<tr><td class="fieldname"><a id="gga9fcb2aa23d342060ebda1d0cf7478856a23cdfd929f5fe82cca9654f8075eeebb"></a>LIBUSB_TRANSFER_STALL </td><td class="fielddoc"><p>For bulk/interrupt endpoints: halt condition detected (endpoint stalled). For control endpoints: control request not supported. </p>
</td></tr>
<tr><td class="fieldname"><a id="gga9fcb2aa23d342060ebda1d0cf7478856ab7dcb24f313ace407e0c070d6b2c5f13"></a>LIBUSB_TRANSFER_NO_DEVICE </td><td class="fielddoc"><p>Device was disconnected </p>
</td></tr>
<tr><td class="fieldname"><a id="gga9fcb2aa23d342060ebda1d0cf7478856ab1b9cbcb1de27a8fbeceb3427fb2fb14"></a>LIBUSB_TRANSFER_OVERFLOW </td><td class="fielddoc"><p>Device sent more data than requested </p>
</td></tr>
</table>
</div>
</div>
<a id="gacb52027036a07de6ecc6c2bf07d07c71"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gacb52027036a07de6ecc6c2bf07d07c71">◆ </a></span>libusb_transfer_type</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="group__libusb__asyncio.html#gacb52027036a07de6ecc6c2bf07d07c71">libusb_transfer_type</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>Transfer type </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="ggacb52027036a07de6ecc6c2bf07d07c71a4c89624658c783ef9b2a2f08091bc7d7"></a>LIBUSB_TRANSFER_TYPE_CONTROL </td><td class="fielddoc"><p>Control transfer </p>
</td></tr>
<tr><td class="fieldname"><a id="ggacb52027036a07de6ecc6c2bf07d07c71a40de9889554fc1785d784b3c31333300"></a>LIBUSB_TRANSFER_TYPE_ISOCHRONOUS </td><td class="fielddoc"><p>Isochronous transfer </p>
</td></tr>
<tr><td class="fieldname"><a id="ggacb52027036a07de6ecc6c2bf07d07c71a7bdfa2fc5dadbaaa0e9262e1b4a228e2"></a>LIBUSB_TRANSFER_TYPE_BULK </td><td class="fielddoc"><p>Bulk transfer </p>
</td></tr>
<tr><td class="fieldname"><a id="ggacb52027036a07de6ecc6c2bf07d07c71aefb0e07862c0eed894ec9c2f957a7e3c"></a>LIBUSB_TRANSFER_TYPE_INTERRUPT </td><td class="fielddoc"><p>Interrupt transfer </p>
</td></tr>
<tr><td class="fieldname"><a id="ggacb52027036a07de6ecc6c2bf07d07c71a3b26ee40f9c586ece75f8de822d974e3"></a>LIBUSB_TRANSFER_TYPE_BULK_STREAM </td><td class="fielddoc"><p>Bulk stream transfer </p>
</td></tr>
</table>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga972b60e72123e4a3bf4b212058efd192"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga972b60e72123e4a3bf4b212058efd192">◆ </a></span>libusb_alloc_streams()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int API_EXPORTED libusb_alloc_streams </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> * </td>
<td class="paramname"><em>dev_handle</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>num_streams</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned char * </td>
<td class="paramname"><em>endpoints</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>num_endpoints</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Allocate up to num_streams usb bulk streams on the specified endpoints. This function takes an array of endpoints rather then a single endpoint because some protocols require that endpoints are setup with similar stream ids. All endpoints passed in must belong to the same interface.</p>
<p>Note this function may return less streams then requested. Also note that the same number of streams are allocated for each endpoint in the endpoint array.</p>
<p>Stream id 0 is reserved, and should not be used to communicate with devices. If <a class="el" href="group__libusb__asyncio.html#ga972b60e72123e4a3bf4b212058efd192">libusb_alloc_streams()</a> returns with a value of N, you may use stream ids 1 to N.</p>
<p>Since version 1.0.19, <a class="el" href="group__libusb__misc.html#gaabe4bc36a83358685d36a6c853cbb4de">LIBUSB_API_VERSION</a> >= 0x01000103</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">dev_handle</td><td>a device handle </td></tr>
<tr><td class="paramname">num_streams</td><td>number of streams to try to allocate </td></tr>
<tr><td class="paramname">endpoints</td><td>array of endpoints to allocate streams on </td></tr>
<tr><td class="paramname">num_endpoints</td><td>length of the endpoints array </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>number of streams allocated, or a LIBUSB_ERROR code on failure </dd></dl>
</div>
</div>
<a id="gabb0740dc2039c67133ddb2d120607b8f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gabb0740dc2039c67133ddb2d120607b8f">◆ </a></span>libusb_alloc_transfer()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">DEFAULT_VISIBILITY struct <a class="el" href="structlibusb__transfer.html">libusb_transfer</a>* <a class="el" href="group__libusb__misc.html#gaa7d6035eb2692d455d27144560a0f68d">LIBUSB_CALL</a> libusb_alloc_transfer </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>iso_packets</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Allocate a libusb transfer with a specified number of isochronous packet descriptors. The returned transfer is pre-initialized for you. When the new transfer is no longer needed, it should be freed with <a class="el" href="group__libusb__asyncio.html#gad7075ddcf5eb9ec2626e7e1856d093e8">libusb_free_transfer()</a>.</p>
<p>Transfers intended for non-isochronous endpoints (e.g. control, bulk, interrupt) should specify an iso_packets count of zero.</p>
<p>For transfers intended for isochronous endpoints, specify an appropriate number of packet descriptors to be allocated as part of the transfer. The returned transfer is not specially initialized for isochronous I/O; you are still required to set the <a class="el" href="structlibusb__transfer.html#a87d725a5521c26832fdc13611220014d">num_iso_packets</a> and <a class="el" href="structlibusb__transfer.html#a7c9fa575986fe9f23bbecb26b766dff1">type</a> fields accordingly.</p>
<p>It is safe to allocate a transfer with some isochronous packets and then use it on a non-isochronous endpoint. If you do this, ensure that at time of submission, num_iso_packets is 0 and that type is set appropriately.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">iso_packets</td><td>number of isochronous packet descriptors to allocate. Must be non-negative. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a newly allocated transfer, or NULL on error </dd></dl>
</div>
</div>
<a id="ga80bcab68de0dbc6daf6bf63e12c4807b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga80bcab68de0dbc6daf6bf63e12c4807b">◆ </a></span>libusb_cancel_transfer()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int API_EXPORTED libusb_cancel_transfer </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structlibusb__transfer.html">libusb_transfer</a> * </td>
<td class="paramname"><em>transfer</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Asynchronously cancel a previously submitted transfer. This function returns immediately, but this does not indicate cancellation is complete. Your callback function will be invoked at some later time with a transfer status of <a class="el" href="group__libusb__asyncio.html#gga9fcb2aa23d342060ebda1d0cf7478856a8af1f19e46cccafdcf3feadce47e880b">LIBUSB_TRANSFER_CANCELLED.</a></p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">transfer</td><td>the transfer to cancel </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success </dd>
<dd>
LIBUSB_ERROR_NOT_FOUND if the transfer is not in progress, already complete, or already cancelled. </dd>
<dd>
a LIBUSB_ERROR code on failure </dd></dl>
</div>
</div>
<a id="ga5697b9a374c2787a7536fc686f565949"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5697b9a374c2787a7536fc686f565949">◆ </a></span>libusb_dev_mem_alloc()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">DEFAULT_VISIBILITY unsigned char* <a class="el" href="group__libusb__misc.html#gaa7d6035eb2692d455d27144560a0f68d">LIBUSB_CALL</a> libusb_dev_mem_alloc </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> * </td>
<td class="paramname"><em>dev_handle</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>length</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Attempts to allocate a block of persistent DMA memory suitable for transfers against the given device. If successful, will return a block of memory that is suitable for use as "buffer" in <a class="el" href="structlibusb__transfer.html">libusb_transfer</a> against this device. Using this memory instead of regular memory means that the host controller can use DMA directly into the buffer to increase performance, and also that transfers can no longer fail due to kernel memory fragmentation.</p>
<p>Note that this means you should not modify this memory (or even data on the same cache lines) when a transfer is in progress, although it is legal to have several transfers going on within the same memory block.</p>
<p>Will return NULL on failure. Many systems do not support such zero-copy and will always return NULL. Memory allocated with this function must be freed with <a class="el" href="group__libusb__asyncio.html#ga4c8a68ef4a8b17987a9659563f65978a">libusb_dev_mem_free</a>. Specifically, this means that the flag <a class="el" href="group__libusb__asyncio.html#gga1fb47dd0f7c209b60a3609ff0c03d56dae993a26f495ac9949118e23eafa19e86">LIBUSB_TRANSFER_FREE_BUFFER</a> cannot be used to free memory allocated with this function.</p>
<p>Since version 1.0.21, <a class="el" href="group__libusb__misc.html#gaabe4bc36a83358685d36a6c853cbb4de">LIBUSB_API_VERSION</a> >= 0x01000105</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">dev_handle</td><td>a device handle </td></tr>
<tr><td class="paramname">length</td><td>size of desired data buffer </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a pointer to the newly allocated memory, or NULL on failure </dd></dl>
</div>
</div>
<a id="ga4c8a68ef4a8b17987a9659563f65978a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4c8a68ef4a8b17987a9659563f65978a">◆ </a></span>libusb_dev_mem_free()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int API_EXPORTED libusb_dev_mem_free </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> * </td>
<td class="paramname"><em>dev_handle</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned char * </td>
<td class="paramname"><em>buffer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>length</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Free device memory allocated with <a class="el" href="group__libusb__asyncio.html#ga5697b9a374c2787a7536fc686f565949">libusb_dev_mem_alloc()</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">dev_handle</td><td>a device handle </td></tr>
<tr><td class="paramname">buffer</td><td>pointer to the previously allocated memory </td></tr>
<tr><td class="paramname">length</td><td>size of previously allocated memory </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>LIBUSB_SUCCESS, or a LIBUSB_ERROR code on failure </dd></dl>
</div>
</div>
<a id="gac785f5d9684b73563feed4be4996e3bb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac785f5d9684b73563feed4be4996e3bb">◆ </a></span>libusb_free_streams()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int API_EXPORTED libusb_free_streams </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> * </td>
<td class="paramname"><em>dev_handle</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned char * </td>
<td class="paramname"><em>endpoints</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>num_endpoints</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Free usb bulk streams allocated with <a class="el" href="group__libusb__asyncio.html#ga972b60e72123e4a3bf4b212058efd192">libusb_alloc_streams()</a>.</p>
<p>Note streams are automatically free-ed when releasing an interface.</p>
<p>Since version 1.0.19, <a class="el" href="group__libusb__misc.html#gaabe4bc36a83358685d36a6c853cbb4de">LIBUSB_API_VERSION</a> >= 0x01000103</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">dev_handle</td><td>a device handle </td></tr>
<tr><td class="paramname">endpoints</td><td>array of endpoints to free streams on </td></tr>
<tr><td class="paramname">num_endpoints</td><td>length of the endpoints array </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>LIBUSB_SUCCESS, or a LIBUSB_ERROR code on failure </dd></dl>
</div>
</div>
<a id="gad7075ddcf5eb9ec2626e7e1856d093e8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad7075ddcf5eb9ec2626e7e1856d093e8">◆ </a></span>libusb_free_transfer()</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> API_EXPORTED libusb_free_transfer </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structlibusb__transfer.html">libusb_transfer</a> * </td>
<td class="paramname"><em>transfer</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Free a transfer structure. This should be called for all transfers allocated with <a class="el" href="group__libusb__asyncio.html#gabb0740dc2039c67133ddb2d120607b8f">libusb_alloc_transfer()</a>.</p>
<p>If the <a class="el" href="group__libusb__asyncio.html#gga1fb47dd0f7c209b60a3609ff0c03d56dae993a26f495ac9949118e23eafa19e86">LIBUSB_TRANSFER_FREE_BUFFER</a> flag is set and the transfer buffer is non-NULL, this function will also free the transfer buffer using the standard system memory allocator (e.g. free()).</p>
<p>It is legal to call this function with a NULL transfer. In this case, the function will simply return safely.</p>
<p>It is not legal to free an active transfer (one which has been submitted and has not yet completed).</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">transfer</td><td>the transfer to free </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="ga01cdfe1a27027a5f438b17cf2dcede2b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga01cdfe1a27027a5f438b17cf2dcede2b">◆ </a></span>libusb_submit_transfer()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int API_EXPORTED libusb_submit_transfer </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structlibusb__transfer.html">libusb_transfer</a> * </td>
<td class="paramname"><em>transfer</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Submit a transfer. This function will fire off the USB transfer and then return immediately.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">transfer</td><td>the transfer to submit </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success </dd>
<dd>
LIBUSB_ERROR_NO_DEVICE if the device has been disconnected </dd>
<dd>
LIBUSB_ERROR_BUSY if the transfer has already been submitted. </dd>
<dd>
LIBUSB_ERROR_NOT_SUPPORTED if the transfer flags are not supported by the operating system. </dd>
<dd>
LIBUSB_ERROR_INVALID_PARAM if the transfer size is larger than the operating system and/or hardware can support (see <a class="el" href="group__libusb__asyncio.html#asynclimits">Transfer length limitations</a>) </dd>
<dd>
another LIBUSB_ERROR code on other failure </dd></dl>
</div>
</div>
<a id="ga906bc4f8e239db8dcdb8ea0cdfa1c579"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga906bc4f8e239db8dcdb8ea0cdfa1c579">◆ </a></span>libusb_transfer_get_stream_id()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t API_EXPORTED libusb_transfer_get_stream_id </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structlibusb__transfer.html">libusb_transfer</a> * </td>
<td class="paramname"><em>transfer</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get a transfers bulk stream id.</p>
<p>Since version 1.0.19, <a class="el" href="group__libusb__misc.html#gaabe4bc36a83358685d36a6c853cbb4de">LIBUSB_API_VERSION</a> >= 0x01000103</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">transfer</td><td>the transfer to get the stream id for </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the stream id for the transfer </dd></dl>
</div>
</div>
<a id="ga4a6a87e75c3741d300e61efd202b171d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4a6a87e75c3741d300e61efd202b171d">◆ </a></span>libusb_transfer_set_stream_id()</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> API_EXPORTED libusb_transfer_set_stream_id </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structlibusb__transfer.html">libusb_transfer</a> * </td>
<td class="paramname"><em>transfer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>stream_id</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set a transfers bulk stream id. Note users are advised to use libusb_fill_bulk_stream_transfer() instead of calling this function directly.</p>
<p>Since version 1.0.19, <a class="el" href="group__libusb__misc.html#gaabe4bc36a83358685d36a6c853cbb4de">LIBUSB_API_VERSION</a> >= 0x01000103</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">transfer</td><td>the transfer to set the stream id for </td></tr>
<tr><td class="paramname">stream_id</td><td>the stream id to set </td></tr>
</table>
</dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__libusb__asyncio.html#ga972b60e72123e4a3bf4b212058efd192">libusb_alloc_streams()</a> </dd></dl>
</div>
</div>
<a id="ga8ca3594d1761da8da91be2851f4e8f21"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga8ca3594d1761da8da91be2851f4e8f21">◆ </a></span>void()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef void </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__libusb__misc.html#gaa7d6035eb2692d455d27144560a0f68d">LIBUSB_CALL</a> * </td>
<td class="paramname"><em>libusb_transfer_cb_fn</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Asynchronous transfer callback function type. When submitting asynchronous transfers, you pass a pointer to a callback function of this type via the <a class="el" href="structlibusb__transfer.html#a69c6df011ec23ff3e481cc98bfff0623">callback</a> member of the <a class="el" href="structlibusb__transfer.html">libusb_transfer</a> structure. libusb will call this function later, when the transfer has completed or failed. See <a class="el" href="group__libusb__asyncio.html">Asynchronous device I/O</a> for more information. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">transfer</td><td>The <a class="el" href="structlibusb__transfer.html">libusb_transfer</a> struct the callback function is being notified about. </td></tr>
</table>
</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>