-
Notifications
You must be signed in to change notification settings - Fork 0
/
group__libusb__dev.html
1405 lines (1339 loc) · 87 KB
/
group__libusb__dev.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
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!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 handling and enumeration</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="#typedef-members">Typedefs</a> |
<a href="#enum-members">Enumerations</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">Device handling and enumeration</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:ga77eedd00d01eb7569b880e861a971c2b"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structlibusb__device.html">libusb_device</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#ga77eedd00d01eb7569b880e861a971c2b">libusb_device</a></td></tr>
<tr class="separator:ga77eedd00d01eb7569b880e861a971c2b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga7df95821d20d27b5597f1d783749d6a4"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#ga7df95821d20d27b5597f1d783749d6a4">libusb_device_handle</a></td></tr>
<tr class="separator:ga7df95821d20d27b5597f1d783749d6a4"><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:ga2959abf1184f87b2ce06fe90db6ce614"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#ga2959abf1184f87b2ce06fe90db6ce614">libusb_speed</a> { <br />
  <a class="el" href="group__libusb__dev.html#gga2959abf1184f87b2ce06fe90db6ce614ace31df1e97e9a66146ac83dcab1e6cfb">LIBUSB_SPEED_UNKNOWN</a> = 0,
<a class="el" href="group__libusb__dev.html#gga2959abf1184f87b2ce06fe90db6ce614a6017f9ac2509cd523b51c1b72ad6991b">LIBUSB_SPEED_LOW</a> = 1,
<a class="el" href="group__libusb__dev.html#gga2959abf1184f87b2ce06fe90db6ce614a0011bead7a48b873808795d8495b4d9e">LIBUSB_SPEED_FULL</a> = 2,
<a class="el" href="group__libusb__dev.html#gga2959abf1184f87b2ce06fe90db6ce614a27bc0b9fe76f8ddf524f3d2ece0eefac">LIBUSB_SPEED_HIGH</a> = 3,
<br />
  <a class="el" href="group__libusb__dev.html#gga2959abf1184f87b2ce06fe90db6ce614ab8c71e1409cd555ae05937b4db9946a2">LIBUSB_SPEED_SUPER</a> = 4,
<a class="el" href="group__libusb__dev.html#gga2959abf1184f87b2ce06fe90db6ce614aa65f23e14e68162a142f26dac5fcfc4a">LIBUSB_SPEED_SUPER_PLUS</a> = 5
<br />
}</td></tr>
<tr class="separator:ga2959abf1184f87b2ce06fe90db6ce614"><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:ga7e0bf3322950434e4612f78b37e59381"><td class="memItemLeft" align="right" valign="top">ssize_t API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#ga7e0bf3322950434e4612f78b37e59381">libusb_get_device_list</a> (<a class="el" href="structlibusb__context.html">libusb_context</a> *ctx, <a class="el" href="structlibusb__device.html">libusb_device</a> ***list)</td></tr>
<tr class="separator:ga7e0bf3322950434e4612f78b37e59381"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gad92aa2b46657b9813c6bd416f195610c"><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__dev.html#gad92aa2b46657b9813c6bd416f195610c">libusb_free_device_list</a> (<a class="el" href="structlibusb__device.html">libusb_device</a> **list, int unref_devices)</td></tr>
<tr class="separator:gad92aa2b46657b9813c6bd416f195610c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaffc119fe8dd355534427304445a8a0d2"><td class="memItemLeft" align="right" valign="top">uint8_t API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#gaffc119fe8dd355534427304445a8a0d2">libusb_get_bus_number</a> (<a class="el" href="structlibusb__device.html">libusb_device</a> *dev)</td></tr>
<tr class="separator:gaffc119fe8dd355534427304445a8a0d2"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga3347e64b2a7f8d99267e7e8dd567c6b8"><td class="memItemLeft" align="right" valign="top">uint8_t API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#ga3347e64b2a7f8d99267e7e8dd567c6b8">libusb_get_port_number</a> (<a class="el" href="structlibusb__device.html">libusb_device</a> *dev)</td></tr>
<tr class="separator:ga3347e64b2a7f8d99267e7e8dd567c6b8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga5b625824223cf919995ba33f614e769f"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#ga5b625824223cf919995ba33f614e769f">libusb_get_port_numbers</a> (<a class="el" href="structlibusb__device.html">libusb_device</a> *dev, uint8_t *port_numbers, int port_numbers_len)</td></tr>
<tr class="separator:ga5b625824223cf919995ba33f614e769f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga1cf9dcaff2d0c48484db66e44e270d9e"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#ga1cf9dcaff2d0c48484db66e44e270d9e">libusb_get_port_path</a> (<a class="el" href="structlibusb__context.html">libusb_context</a> *ctx, <a class="el" href="structlibusb__device.html">libusb_device</a> *dev, uint8_t *port_numbers, uint8_t port_numbers_len)</td></tr>
<tr class="separator:ga1cf9dcaff2d0c48484db66e44e270d9e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga631bedc4170442dd0e9fb8df35fc118d"><td class="memItemLeft" align="right" valign="top">DEFAULT_VISIBILITY <a class="el" href="structlibusb__device.html">libusb_device</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__dev.html#ga631bedc4170442dd0e9fb8df35fc118d">libusb_get_parent</a> (<a class="el" href="structlibusb__device.html">libusb_device</a> *dev)</td></tr>
<tr class="separator:ga631bedc4170442dd0e9fb8df35fc118d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gadcfdb5e8a8564caade4db1f1e5982d8f"><td class="memItemLeft" align="right" valign="top">uint8_t API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#gadcfdb5e8a8564caade4db1f1e5982d8f">libusb_get_device_address</a> (<a class="el" href="structlibusb__device.html">libusb_device</a> *dev)</td></tr>
<tr class="separator:gadcfdb5e8a8564caade4db1f1e5982d8f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gab31ba9e3de44e4c01bb18ac91d413757"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#gab31ba9e3de44e4c01bb18ac91d413757">libusb_get_device_speed</a> (<a class="el" href="structlibusb__device.html">libusb_device</a> *dev)</td></tr>
<tr class="separator:gab31ba9e3de44e4c01bb18ac91d413757"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gacc7c3532a85725c261f1ee2327fe6b66"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#gacc7c3532a85725c261f1ee2327fe6b66">libusb_get_max_packet_size</a> (<a class="el" href="structlibusb__device.html">libusb_device</a> *dev, unsigned char <a class="el" href="structendpoint.html">endpoint</a>)</td></tr>
<tr class="separator:gacc7c3532a85725c261f1ee2327fe6b66"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga1fa14fbac99af872f5b075775d1a7382"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#ga1fa14fbac99af872f5b075775d1a7382">libusb_get_max_iso_packet_size</a> (<a class="el" href="structlibusb__device.html">libusb_device</a> *dev, unsigned char <a class="el" href="structendpoint.html">endpoint</a>)</td></tr>
<tr class="separator:ga1fa14fbac99af872f5b075775d1a7382"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gab0299fcb6411338c14e7ba54bb19df4a"><td class="memItemLeft" align="right" valign="top">DEFAULT_VISIBILITY <a class="el" href="structlibusb__device.html">libusb_device</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__dev.html#gab0299fcb6411338c14e7ba54bb19df4a">libusb_ref_device</a> (<a class="el" href="structlibusb__device.html">libusb_device</a> *dev)</td></tr>
<tr class="separator:gab0299fcb6411338c14e7ba54bb19df4a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gafdd72322d044e4848bd9540a747d6f4e"><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__dev.html#gafdd72322d044e4848bd9540a747d6f4e">libusb_unref_device</a> (<a class="el" href="structlibusb__device.html">libusb_device</a> *dev)</td></tr>
<tr class="separator:gafdd72322d044e4848bd9540a747d6f4e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga1f09cad51ee5735bd4bb822581adc387"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#ga1f09cad51ee5735bd4bb822581adc387">libusb_wrap_sys_device</a> (<a class="el" href="structlibusb__context.html">libusb_context</a> *ctx, intptr_t sys_dev, <a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> **dev_handle)</td></tr>
<tr class="separator:ga1f09cad51ee5735bd4bb822581adc387"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaae48f83e4b9652964ce501d914dd505e"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#gaae48f83e4b9652964ce501d914dd505e">libusb_open</a> (<a class="el" href="structlibusb__device.html">libusb_device</a> *dev, <a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> **dev_handle)</td></tr>
<tr class="separator:gaae48f83e4b9652964ce501d914dd505e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga9f020f818689ef837f8db37077efafe9"><td class="memItemLeft" align="right" valign="top">DEFAULT_VISIBILITY <a class="el" href="structlibusb__device__handle.html">libusb_device_handle</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__dev.html#ga9f020f818689ef837f8db37077efafe9">libusb_open_device_with_vid_pid</a> (<a class="el" href="structlibusb__context.html">libusb_context</a> *ctx, uint16_t vendor_id, uint16_t product_id)</td></tr>
<tr class="separator:ga9f020f818689ef837f8db37077efafe9"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga6c0534023632fdc669c1dde47f259f2f"><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__dev.html#ga6c0534023632fdc669c1dde47f259f2f">libusb_close</a> (<a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> *dev_handle)</td></tr>
<tr class="separator:ga6c0534023632fdc669c1dde47f259f2f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga0a22ab61ce433c743fde47118d548653"><td class="memItemLeft" align="right" valign="top">DEFAULT_VISIBILITY <a class="el" href="structlibusb__device.html">libusb_device</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__dev.html#ga0a22ab61ce433c743fde47118d548653">libusb_get_device</a> (<a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> *dev_handle)</td></tr>
<tr class="separator:ga0a22ab61ce433c743fde47118d548653"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga216e52f5782f5f76c488e4b3ab1b7574"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#ga216e52f5782f5f76c488e4b3ab1b7574">libusb_get_configuration</a> (<a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> *dev_handle, int *config)</td></tr>
<tr class="separator:ga216e52f5782f5f76c488e4b3ab1b7574"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga41327fe1d1ef58eaf9397d8c266bca6e"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#ga41327fe1d1ef58eaf9397d8c266bca6e">libusb_set_configuration</a> (<a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> *dev_handle, int configuration)</td></tr>
<tr class="separator:ga41327fe1d1ef58eaf9397d8c266bca6e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga020e3e6e14968203b4d2e65717129520"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#ga020e3e6e14968203b4d2e65717129520">libusb_claim_interface</a> (<a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> *dev_handle, int interface_number)</td></tr>
<tr class="separator:ga020e3e6e14968203b4d2e65717129520"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga0bb9dcd625f2d2d038a652b9977ab2e7"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#ga0bb9dcd625f2d2d038a652b9977ab2e7">libusb_release_interface</a> (<a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> *dev_handle, int interface_number)</td></tr>
<tr class="separator:ga0bb9dcd625f2d2d038a652b9977ab2e7"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga59233a8f761ed4553d8d727fe655cc58"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#ga59233a8f761ed4553d8d727fe655cc58">libusb_set_interface_alt_setting</a> (<a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> *dev_handle, int interface_number, int alternate_setting)</td></tr>
<tr class="separator:ga59233a8f761ed4553d8d727fe655cc58"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga1c76fa0f6dd9b23438ce58a34f34cb14"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#ga1c76fa0f6dd9b23438ce58a34f34cb14">libusb_clear_halt</a> (<a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> *dev_handle, unsigned char <a class="el" href="structendpoint.html">endpoint</a>)</td></tr>
<tr class="separator:ga1c76fa0f6dd9b23438ce58a34f34cb14"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaf8036d8a13dcc727893f6279a2f6d4cb"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#gaf8036d8a13dcc727893f6279a2f6d4cb">libusb_reset_device</a> (<a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> *dev_handle)</td></tr>
<tr class="separator:gaf8036d8a13dcc727893f6279a2f6d4cb"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga546ba4bf5f01f62d6308191c9845711b"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#ga546ba4bf5f01f62d6308191c9845711b">libusb_kernel_driver_active</a> (<a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> *dev_handle, int interface_number)</td></tr>
<tr class="separator:ga546ba4bf5f01f62d6308191c9845711b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga514103328b9278600a59a1d9a911b3c9"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#ga514103328b9278600a59a1d9a911b3c9">libusb_detach_kernel_driver</a> (<a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> *dev_handle, int interface_number)</td></tr>
<tr class="separator:ga514103328b9278600a59a1d9a911b3c9"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga11b9bcf84abfa04572c5293bec67a582"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#ga11b9bcf84abfa04572c5293bec67a582">libusb_attach_kernel_driver</a> (<a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> *dev_handle, int interface_number)</td></tr>
<tr class="separator:ga11b9bcf84abfa04572c5293bec67a582"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga505a78391b821511a457d5dc95fe13c5"><td class="memItemLeft" align="right" valign="top">int API_EXPORTED </td><td class="memItemRight" valign="bottom"><a class="el" href="group__libusb__dev.html#ga505a78391b821511a457d5dc95fe13c5">libusb_set_auto_detach_kernel_driver</a> (<a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> *dev_handle, int enable)</td></tr>
<tr class="separator:ga505a78391b821511a457d5dc95fe13c5"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>The functionality documented below is designed to help with the following operations:</p><ul>
<li>Enumerating the USB devices currently attached to the system</li>
<li>Choosing a device to operate from your software</li>
<li>Opening and closing the chosen device</li>
</ul>
<h1><a class="anchor" id="nutshell"></a>
In a nutshell...</h1>
<p>The description below really makes things sound more complicated than they actually are. The following sequence of function calls will be suitable for almost all scenarios and does not require you to have such a deep understanding of the resource management issues: </p><div class="fragment"><div class="line"><span class="comment">// discover devices</span></div><div class="line"><a class="code" href="structlibusb__device.html">libusb_device</a> **list;</div><div class="line"><a class="code" href="structlibusb__device.html">libusb_device</a> *found = NULL;</div><div class="line">ssize_t cnt = <a class="code" href="group__libusb__dev.html#ga7e0bf3322950434e4612f78b37e59381">libusb_get_device_list</a>(NULL, &list);</div><div class="line">ssize_t i = 0;</div><div class="line"><span class="keywordtype">int</span> err = 0;</div><div class="line"><span class="keywordflow">if</span> (cnt < 0)</div><div class="line"> error();</div><div class="line"></div><div class="line"><span class="keywordflow">for</span> (i = 0; i < cnt; i++) {</div><div class="line"> <a class="code" href="structlibusb__device.html">libusb_device</a> *device = list[i];</div><div class="line"> <span class="keywordflow">if</span> (is_interesting(device)) {</div><div class="line"> found = device;</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> }</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordflow">if</span> (found) {</div><div class="line"> <a class="code" href="structlibusb__device__handle.html">libusb_device_handle</a> *handle;</div><div class="line"></div><div class="line"> err = <a class="code" href="group__libusb__dev.html#gaae48f83e4b9652964ce501d914dd505e">libusb_open</a>(found, &handle);</div><div class="line"> <span class="keywordflow">if</span> (err)</div><div class="line"> error();</div><div class="line"> <span class="comment">// etc</span></div><div class="line">}</div><div class="line"></div><div class="line"><a class="code" href="group__libusb__dev.html#gad92aa2b46657b9813c6bd416f195610c">libusb_free_device_list</a>(list, 1);</div></div><!-- fragment --><p>The two important points:</p><ul>
<li>You asked <a class="el" href="group__libusb__dev.html#gad92aa2b46657b9813c6bd416f195610c">libusb_free_device_list()</a> to unreference the devices (2nd parameter)</li>
<li>You opened the device before freeing the list and unreferencing the devices</li>
</ul>
<p>If you ended up with a handle, you can now proceed to perform I/O on the device.</p>
<h1><a class="anchor" id="devshandles"></a>
Devices and device handles</h1>
<p>libusb has a concept of a USB device, represented by the <a class="el" href="structlibusb__device.html">libusb_device</a> opaque type. A device represents a USB device that is currently or was previously connected to the system. Using a reference to a device, you can determine certain information about the device (e.g. you can read the descriptor data).</p>
<p>The <a class="el" href="group__libusb__dev.html#ga7e0bf3322950434e4612f78b37e59381">libusb_get_device_list()</a> function can be used to obtain a list of devices currently connected to the system. This is known as device discovery.</p>
<p>Just because you have a reference to a device does not mean it is necessarily usable. The device may have been unplugged, you may not have permission to operate such device, or another program or driver may be using the device.</p>
<p>When you've found a device that you'd like to operate, you must ask libusb to open the device using the <a class="el" href="group__libusb__dev.html#gaae48f83e4b9652964ce501d914dd505e">libusb_open()</a> function. Assuming success, libusb then returns you a <em>device handle</em> (a <a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> pointer). All "real" I/O operations then operate on the handle rather than the original device pointer.</p>
<h1><a class="anchor" id="devref"></a>
Device discovery and reference counting</h1>
<p>Device discovery (i.e. calling <a class="el" href="group__libusb__dev.html#ga7e0bf3322950434e4612f78b37e59381">libusb_get_device_list()</a>) returns a freshly-allocated list of devices. The list itself must be freed when you are done with it. libusb also needs to know when it is OK to free the contents of the list - the devices themselves.</p>
<p>To handle these issues, libusb provides you with two separate items:</p><ul>
<li>A function to free the list itself</li>
<li>A reference counting system for the devices inside</li>
</ul>
<p>New devices presented by the <a class="el" href="group__libusb__dev.html#ga7e0bf3322950434e4612f78b37e59381">libusb_get_device_list()</a> function all have a reference count of 1. You can increase and decrease reference count using <a class="el" href="group__libusb__dev.html#gab0299fcb6411338c14e7ba54bb19df4a">libusb_ref_device()</a> and <a class="el" href="group__libusb__dev.html#gafdd72322d044e4848bd9540a747d6f4e">libusb_unref_device()</a>. A device is destroyed when its reference count reaches 0.</p>
<p>With the above information in mind, the process of opening a device can be viewed as follows:</p><ol type="1">
<li>Discover devices using <a class="el" href="group__libusb__dev.html#ga7e0bf3322950434e4612f78b37e59381">libusb_get_device_list()</a>.</li>
<li>Choose the device that you want to operate, and call <a class="el" href="group__libusb__dev.html#gaae48f83e4b9652964ce501d914dd505e">libusb_open()</a>.</li>
<li>Unref all devices in the discovered device list.</li>
<li>Free the discovered device list.</li>
</ol>
<p>The order is important - you must not unreference the device before attempting to open it, because unreferencing it may destroy the device.</p>
<p>For convenience, the <a class="el" href="group__libusb__dev.html#gad92aa2b46657b9813c6bd416f195610c">libusb_free_device_list()</a> function includes a parameter to optionally unreference all the devices in the list before freeing the list itself. This combines steps 3 and 4 above.</p>
<p>As an implementation detail, <a class="el" href="group__libusb__dev.html#gaae48f83e4b9652964ce501d914dd505e">libusb_open()</a> actually adds a reference to the device in question. This is because the device remains available through the handle via <a class="el" href="group__libusb__dev.html#ga0a22ab61ce433c743fde47118d548653">libusb_get_device()</a>. The reference is deleted during <a class="el" href="group__libusb__dev.html#ga6c0534023632fdc669c1dde47f259f2f">libusb_close()</a>. </p>
<h2 class="groupheader">Typedef Documentation</h2>
<a id="ga77eedd00d01eb7569b880e861a971c2b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga77eedd00d01eb7569b880e861a971c2b">◆ </a></span>libusb_device</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef struct <a class="el" href="structlibusb__device.html">libusb_device</a> <a class="el" href="structlibusb__device.html">libusb_device</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>Structure representing a USB device detected on the system. This is an opaque type for which you are only ever provided with a pointer, usually originating from <a class="el" href="group__libusb__dev.html#ga7e0bf3322950434e4612f78b37e59381">libusb_get_device_list()</a>.</p>
<p>Certain operations can be performed on a device, but in order to do any I/O you will have to first obtain a device handle using <a class="el" href="group__libusb__dev.html#gaae48f83e4b9652964ce501d914dd505e">libusb_open()</a>.</p>
<p>Devices are reference counted with <a class="el" href="group__libusb__dev.html#gab0299fcb6411338c14e7ba54bb19df4a">libusb_ref_device()</a> and <a class="el" href="group__libusb__dev.html#gafdd72322d044e4848bd9540a747d6f4e">libusb_unref_device()</a>, and are freed when the reference count reaches 0. New devices presented by <a class="el" href="group__libusb__dev.html#ga7e0bf3322950434e4612f78b37e59381">libusb_get_device_list()</a> have a reference count of 1, and <a class="el" href="group__libusb__dev.html#gad92aa2b46657b9813c6bd416f195610c">libusb_free_device_list()</a> can optionally decrease the reference count on all devices in the list. <a class="el" href="group__libusb__dev.html#gaae48f83e4b9652964ce501d914dd505e">libusb_open()</a> adds another reference which is later destroyed by <a class="el" href="group__libusb__dev.html#ga6c0534023632fdc669c1dde47f259f2f">libusb_close()</a>. </p>
</div>
</div>
<a id="ga7df95821d20d27b5597f1d783749d6a4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7df95821d20d27b5597f1d783749d6a4">◆ </a></span>libusb_device_handle</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef struct <a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a> <a class="el" href="structlibusb__device__handle.html">libusb_device_handle</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>Structure representing a handle on a USB device. This is an opaque type for which you are only ever provided with a pointer, usually originating from <a class="el" href="group__libusb__dev.html#gaae48f83e4b9652964ce501d914dd505e">libusb_open()</a>.</p>
<p>A device handle is used to perform I/O and other operations. When finished with a device handle, you should call <a class="el" href="group__libusb__dev.html#ga6c0534023632fdc669c1dde47f259f2f">libusb_close()</a>. </p>
</div>
</div>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a id="ga2959abf1184f87b2ce06fe90db6ce614"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2959abf1184f87b2ce06fe90db6ce614">◆ </a></span>libusb_speed</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="group__libusb__dev.html#ga2959abf1184f87b2ce06fe90db6ce614">libusb_speed</a></td>
</tr>
</table>
</div><div class="memdoc">
<p>Speed codes. Indicates the speed at which the device is operating. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="gga2959abf1184f87b2ce06fe90db6ce614ace31df1e97e9a66146ac83dcab1e6cfb"></a>LIBUSB_SPEED_UNKNOWN </td><td class="fielddoc"><p>The OS doesn't report or know the device speed. </p>
</td></tr>
<tr><td class="fieldname"><a id="gga2959abf1184f87b2ce06fe90db6ce614a6017f9ac2509cd523b51c1b72ad6991b"></a>LIBUSB_SPEED_LOW </td><td class="fielddoc"><p>The device is operating at low speed (1.5MBit/s). </p>
</td></tr>
<tr><td class="fieldname"><a id="gga2959abf1184f87b2ce06fe90db6ce614a0011bead7a48b873808795d8495b4d9e"></a>LIBUSB_SPEED_FULL </td><td class="fielddoc"><p>The device is operating at full speed (12MBit/s). </p>
</td></tr>
<tr><td class="fieldname"><a id="gga2959abf1184f87b2ce06fe90db6ce614a27bc0b9fe76f8ddf524f3d2ece0eefac"></a>LIBUSB_SPEED_HIGH </td><td class="fielddoc"><p>The device is operating at high speed (480MBit/s). </p>
</td></tr>
<tr><td class="fieldname"><a id="gga2959abf1184f87b2ce06fe90db6ce614ab8c71e1409cd555ae05937b4db9946a2"></a>LIBUSB_SPEED_SUPER </td><td class="fielddoc"><p>The device is operating at super speed (5000MBit/s). </p>
</td></tr>
<tr><td class="fieldname"><a id="gga2959abf1184f87b2ce06fe90db6ce614aa65f23e14e68162a142f26dac5fcfc4a"></a>LIBUSB_SPEED_SUPER_PLUS </td><td class="fielddoc"><p>The device is operating at super speed plus (10000MBit/s). </p>
</td></tr>
</table>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga11b9bcf84abfa04572c5293bec67a582"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga11b9bcf84abfa04572c5293bec67a582">◆ </a></span>libusb_attach_kernel_driver()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int API_EXPORTED libusb_attach_kernel_driver </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">int </td>
<td class="paramname"><em>interface_number</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Re-attach an interface's kernel driver, which was previously detached using <a class="el" href="group__libusb__dev.html#ga514103328b9278600a59a1d9a911b3c9">libusb_detach_kernel_driver()</a>. This call is only effective on Linux and returns LIBUSB_ERROR_NOT_SUPPORTED on all other platforms.</p>
<p>This functionality is not available on Darwin or Windows.</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">interface_number</td><td>the interface to attach the driver from </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success </dd>
<dd>
LIBUSB_ERROR_NOT_FOUND if no kernel driver was active </dd>
<dd>
LIBUSB_ERROR_INVALID_PARAM if the interface does not exist </dd>
<dd>
LIBUSB_ERROR_NO_DEVICE if the device has been disconnected </dd>
<dd>
LIBUSB_ERROR_NOT_SUPPORTED on platforms where the functionality is not available </dd>
<dd>
LIBUSB_ERROR_BUSY if the driver cannot be attached because the interface is claimed by a program or driver </dd>
<dd>
another LIBUSB_ERROR code on other failure </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__libusb__dev.html#ga546ba4bf5f01f62d6308191c9845711b">libusb_kernel_driver_active()</a> </dd></dl>
</div>
</div>
<a id="ga020e3e6e14968203b4d2e65717129520"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga020e3e6e14968203b4d2e65717129520">◆ </a></span>libusb_claim_interface()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int API_EXPORTED libusb_claim_interface </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">int </td>
<td class="paramname"><em>interface_number</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Claim an interface on a given device handle. You must claim the interface you wish to use before you can perform I/O on any of its endpoints.</p>
<p>It is legal to attempt to claim an already-claimed interface, in which case libusb just returns 0 without doing anything.</p>
<p>If auto_detach_kernel_driver is set to 1 for <code>dev</code>, the kernel driver will be detached if necessary, on failure the detach error is returned.</p>
<p>Claiming of interfaces is a purely logical operation; it does not cause any requests to be sent over the bus. Interface claiming is used to instruct the underlying operating system that your application wishes to take ownership of the interface.</p>
<p>This is a non-blocking function.</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">interface_number</td><td>the <code>bInterfaceNumber</code> of the interface you wish to claim </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success </dd>
<dd>
LIBUSB_ERROR_NOT_FOUND if the requested interface does not exist </dd>
<dd>
LIBUSB_ERROR_BUSY if another program or driver has claimed the interface </dd>
<dd>
LIBUSB_ERROR_NO_DEVICE if the device has been disconnected </dd>
<dd>
a LIBUSB_ERROR code on other failure </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__libusb__dev.html#ga505a78391b821511a457d5dc95fe13c5">libusb_set_auto_detach_kernel_driver()</a> </dd></dl>
</div>
</div>
<a id="ga1c76fa0f6dd9b23438ce58a34f34cb14"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1c76fa0f6dd9b23438ce58a34f34cb14">◆ </a></span>libusb_clear_halt()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int API_EXPORTED libusb_clear_halt </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>endpoint</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Clear the halt/stall condition for an endpoint. Endpoints with halt status are unable to receive or transmit data until the halt condition is stalled.</p>
<p>You should cancel all pending transfers before attempting to clear the halt condition.</p>
<p>This is a blocking function.</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">endpoint</td><td>the endpoint to clear halt status </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success </dd>
<dd>
LIBUSB_ERROR_NOT_FOUND if the endpoint does not exist </dd>
<dd>
LIBUSB_ERROR_NO_DEVICE if the device has been disconnected </dd>
<dd>
another LIBUSB_ERROR code on other failure </dd></dl>
</div>
</div>
<a id="ga6c0534023632fdc669c1dde47f259f2f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga6c0534023632fdc669c1dde47f259f2f">◆ </a></span>libusb_close()</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_close </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><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Close a device handle. Should be called on all open handles before your application exits.</p>
<p>Internally, this function destroys the reference that was added by <a class="el" href="group__libusb__dev.html#gaae48f83e4b9652964ce501d914dd505e">libusb_open()</a> on the given device.</p>
<p>This is a non-blocking function; no requests are sent over the bus.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">dev_handle</td><td>the device handle to close </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="ga514103328b9278600a59a1d9a911b3c9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga514103328b9278600a59a1d9a911b3c9">◆ </a></span>libusb_detach_kernel_driver()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int API_EXPORTED libusb_detach_kernel_driver </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">int </td>
<td class="paramname"><em>interface_number</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Detach a kernel driver from an interface. If successful, you will then be able to claim the interface and perform I/O.</p>
<p>This functionality is not available on Darwin or Windows.</p>
<p>Note that libusb itself also talks to the device through a special kernel driver, if this driver is already attached to the device, this call will not detach it and return LIBUSB_ERROR_NOT_FOUND.</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">interface_number</td><td>the interface to detach the driver from </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success </dd>
<dd>
LIBUSB_ERROR_NOT_FOUND if no kernel driver was active </dd>
<dd>
LIBUSB_ERROR_INVALID_PARAM if the interface does not exist </dd>
<dd>
LIBUSB_ERROR_NO_DEVICE if the device has been disconnected </dd>
<dd>
LIBUSB_ERROR_NOT_SUPPORTED on platforms where the functionality is not available </dd>
<dd>
another LIBUSB_ERROR code on other failure </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__libusb__dev.html#ga546ba4bf5f01f62d6308191c9845711b">libusb_kernel_driver_active()</a> </dd></dl>
</div>
</div>
<a id="gad92aa2b46657b9813c6bd416f195610c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad92aa2b46657b9813c6bd416f195610c">◆ </a></span>libusb_free_device_list()</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_device_list </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structlibusb__device.html">libusb_device</a> ** </td>
<td class="paramname"><em>list</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>unref_devices</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Frees a list of devices previously discovered using <a class="el" href="group__libusb__dev.html#ga7e0bf3322950434e4612f78b37e59381">libusb_get_device_list()</a>. If the unref_devices parameter is set, the reference count of each device in the list is decremented by 1. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">list</td><td>the list to free </td></tr>
<tr><td class="paramname">unref_devices</td><td>whether to unref the devices in the list </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="gaffc119fe8dd355534427304445a8a0d2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaffc119fe8dd355534427304445a8a0d2">◆ </a></span>libusb_get_bus_number()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint8_t API_EXPORTED libusb_get_bus_number </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structlibusb__device.html">libusb_device</a> * </td>
<td class="paramname"><em>dev</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the number of the bus that a device is connected to. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">dev</td><td>a device </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the bus number </dd></dl>
</div>
</div>
<a id="ga216e52f5782f5f76c488e4b3ab1b7574"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga216e52f5782f5f76c488e4b3ab1b7574">◆ </a></span>libusb_get_configuration()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int API_EXPORTED libusb_get_configuration </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">int * </td>
<td class="paramname"><em>config</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Determine the bConfigurationValue of the currently active configuration.</p>
<p>You could formulate your own control request to obtain this information, but this function has the advantage that it may be able to retrieve the information from operating system caches (no I/O involved).</p>
<p>If the OS does not cache this information, then this function will block while a control transfer is submitted to retrieve the information.</p>
<p>This function will return a value of 0 in the <code>config</code> output parameter if the device is in unconfigured state.</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">config</td><td>output location for the bConfigurationValue of the active configuration (only valid for return code 0) </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>
another LIBUSB_ERROR code on other failure </dd></dl>
</div>
</div>
<a id="ga0a22ab61ce433c743fde47118d548653"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga0a22ab61ce433c743fde47118d548653">◆ </a></span>libusb_get_device()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">DEFAULT_VISIBILITY <a class="el" href="structlibusb__device.html">libusb_device</a>* <a class="el" href="group__libusb__misc.html#gaa7d6035eb2692d455d27144560a0f68d">LIBUSB_CALL</a> libusb_get_device </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><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the underlying device for a device handle. This function does not modify the reference count of the returned device, so do not feel compelled to unreference it when you are done. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">dev_handle</td><td>a device handle </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the underlying device </dd></dl>
</div>
</div>
<a id="gadcfdb5e8a8564caade4db1f1e5982d8f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gadcfdb5e8a8564caade4db1f1e5982d8f">◆ </a></span>libusb_get_device_address()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint8_t API_EXPORTED libusb_get_device_address </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structlibusb__device.html">libusb_device</a> * </td>
<td class="paramname"><em>dev</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the address of the device on the bus it is connected to. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">dev</td><td>a device </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the device address </dd></dl>
</div>
</div>
<a id="ga7e0bf3322950434e4612f78b37e59381"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7e0bf3322950434e4612f78b37e59381">◆ </a></span>libusb_get_device_list()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">ssize_t API_EXPORTED libusb_get_device_list </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="structlibusb__device.html">libusb_device</a> *** </td>
<td class="paramname"><em>list</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns a list of USB devices currently attached to the system. This is your entry point into finding a USB device to operate.</p>
<p>You are expected to unreference all the devices when you are done with them, and then free the list with <a class="el" href="group__libusb__dev.html#gad92aa2b46657b9813c6bd416f195610c">libusb_free_device_list()</a>. Note that <a class="el" href="group__libusb__dev.html#gad92aa2b46657b9813c6bd416f195610c">libusb_free_device_list()</a> can unref all the devices for you. Be careful not to unreference a device you are about to open until after you have opened it.</p>
<p>This return value of this function indicates the number of devices in the resultant list. The list is actually one element larger, as it is NULL-terminated.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">ctx</td><td>the context to operate on, or NULL for the default context </td></tr>
<tr><td class="paramname">list</td><td>output location for a list of devices. Must be later freed with <a class="el" href="group__libusb__dev.html#gad92aa2b46657b9813c6bd416f195610c">libusb_free_device_list()</a>. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the number of devices in the outputted list, or any <a class="el" href="group__libusb__misc.html#gab2323aa0f04bc22038e7e1740b2f29ef">libusb_error</a> according to errors encountered by the backend. </dd></dl>
</div>
</div>
<a id="gab31ba9e3de44e4c01bb18ac91d413757"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab31ba9e3de44e4c01bb18ac91d413757">◆ </a></span>libusb_get_device_speed()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int API_EXPORTED libusb_get_device_speed </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structlibusb__device.html">libusb_device</a> * </td>
<td class="paramname"><em>dev</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the negotiated connection speed for a device. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">dev</td><td>a device </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>a <a class="el" href="group__libusb__dev.html#ga2959abf1184f87b2ce06fe90db6ce614">libusb_speed</a> code, where LIBUSB_SPEED_UNKNOWN means that the OS doesn't know or doesn't support returning the negotiated speed. </dd></dl>
</div>
</div>
<a id="ga1fa14fbac99af872f5b075775d1a7382"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1fa14fbac99af872f5b075775d1a7382">◆ </a></span>libusb_get_max_iso_packet_size()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int API_EXPORTED libusb_get_max_iso_packet_size </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structlibusb__device.html">libusb_device</a> * </td>
<td class="paramname"><em>dev</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned char </td>
<td class="paramname"><em>endpoint</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Calculate the maximum packet size which a specific endpoint is capable is sending or receiving in the duration of 1 microframe</p>
<p>Only the active configuration is examined. The calculation is based on the wMaxPacketSize field in the endpoint descriptor as described in section 9.6.6 in the USB 2.0 specifications.</p>
<p>If acting on an isochronous or interrupt endpoint, this function will multiply the value found in bits 0:10 by the number of transactions per microframe (determined by bits 11:12). Otherwise, this function just returns the numeric value found in bits 0:10. For USB 3.0 device, it will attempts to retrieve the Endpoint Companion Descriptor to return wBytesPerInterval.</p>
<p>This function is useful for setting up isochronous transfers, for example you might pass the return value from this function to libusb_set_iso_packet_lengths() in order to set the length field of every isochronous packet in a transfer.</p>
<p>Since v1.0.3.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">dev</td><td>a device </td></tr>
<tr><td class="paramname">endpoint</td><td>address of the endpoint in question </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the maximum packet size which can be sent/received on this endpoint </dd>
<dd>
LIBUSB_ERROR_NOT_FOUND if the endpoint does not exist </dd>
<dd>
LIBUSB_ERROR_OTHER on other failure </dd></dl>
</div>
</div>
<a id="gacc7c3532a85725c261f1ee2327fe6b66"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gacc7c3532a85725c261f1ee2327fe6b66">◆ </a></span>libusb_get_max_packet_size()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int API_EXPORTED libusb_get_max_packet_size </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structlibusb__device.html">libusb_device</a> * </td>
<td class="paramname"><em>dev</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned char </td>
<td class="paramname"><em>endpoint</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Convenience function to retrieve the wMaxPacketSize value for a particular endpoint in the active device configuration.</p>
<p>This function was originally intended to be of assistance when setting up isochronous transfers, but a design mistake resulted in this function instead. It simply returns the wMaxPacketSize value without considering its contents. If you're dealing with isochronous transfers, you probably want <a class="el" href="group__libusb__dev.html#ga1fa14fbac99af872f5b075775d1a7382">libusb_get_max_iso_packet_size()</a> instead.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">dev</td><td>a device </td></tr>
<tr><td class="paramname">endpoint</td><td>address of the endpoint in question </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the wMaxPacketSize value </dd>
<dd>
LIBUSB_ERROR_NOT_FOUND if the endpoint does not exist </dd>
<dd>
LIBUSB_ERROR_OTHER on other failure </dd></dl>
</div>
</div>
<a id="ga631bedc4170442dd0e9fb8df35fc118d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga631bedc4170442dd0e9fb8df35fc118d">◆ </a></span>libusb_get_parent()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">DEFAULT_VISIBILITY <a class="el" href="structlibusb__device.html">libusb_device</a>* <a class="el" href="group__libusb__misc.html#gaa7d6035eb2692d455d27144560a0f68d">LIBUSB_CALL</a> libusb_get_parent </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structlibusb__device.html">libusb_device</a> * </td>
<td class="paramname"><em>dev</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the the parent from the specified device. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">dev</td><td>a device </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the device parent or NULL if not available You should issue a <a class="el" href="group__libusb__dev.html#ga7e0bf3322950434e4612f78b37e59381">libusb_get_device_list()</a> before calling this function and make sure that you only access the parent before issuing <a class="el" href="group__libusb__dev.html#gad92aa2b46657b9813c6bd416f195610c">libusb_free_device_list()</a>. The reason is that libusb currently does not maintain a permanent list of device instances, and therefore can only guarantee that parents are fully instantiated within a <a class="el" href="group__libusb__dev.html#ga7e0bf3322950434e4612f78b37e59381">libusb_get_device_list()</a> - <a class="el" href="group__libusb__dev.html#gad92aa2b46657b9813c6bd416f195610c">libusb_free_device_list()</a> block. </dd></dl>
</div>
</div>
<a id="ga3347e64b2a7f8d99267e7e8dd567c6b8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3347e64b2a7f8d99267e7e8dd567c6b8">◆ </a></span>libusb_get_port_number()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint8_t API_EXPORTED libusb_get_port_number </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structlibusb__device.html">libusb_device</a> * </td>
<td class="paramname"><em>dev</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the number of the port that a device is connected to. Unless the OS does something funky, or you are hot-plugging USB extension cards, the port number returned by this call is usually guaranteed to be uniquely tied to a physical port, meaning that different devices plugged on the same physical port should return the same port number.</p>
<p>But outside of this, there is no guarantee that the port number returned by this call will remain the same, or even match the order in which ports have been numbered by the HUB/HCD manufacturer.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">dev</td><td>a device </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the port number (0 if not available) </dd></dl>
</div>
</div>
<a id="ga5b625824223cf919995ba33f614e769f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5b625824223cf919995ba33f614e769f">◆ </a></span>libusb_get_port_numbers()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int API_EXPORTED libusb_get_port_numbers </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structlibusb__device.html">libusb_device</a> * </td>
<td class="paramname"><em>dev</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t * </td>
<td class="paramname"><em>port_numbers</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>port_numbers_len</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the list of all port numbers from root for the specified device</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">dev</td><td>a device </td></tr>
<tr><td class="paramname">port_numbers</td><td>the array that should contain the port numbers </td></tr>
<tr><td class="paramname">port_numbers_len</td><td>the maximum length of the array. As per the USB 3.0 specs, the current maximum limit for the depth is 7. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the number of elements filled </dd>
<dd>
LIBUSB_ERROR_OVERFLOW if the array is too small </dd></dl>
</div>
</div>
<a id="ga1cf9dcaff2d0c48484db66e44e270d9e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1cf9dcaff2d0c48484db66e44e270d9e">◆ </a></span>libusb_get_port_path()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int API_EXPORTED libusb_get_port_path </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="structlibusb__device.html">libusb_device</a> * </td>
<td class="paramname"><em>dev</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t * </td>
<td class="paramname"><em>port_numbers</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t </td>
<td class="paramname"><em>port_numbers_len</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000001">Deprecated:</a></b></dt><dd>Please use <a class="el" href="group__libusb__dev.html#ga5b625824223cf919995ba33f614e769f">libusb_get_port_numbers()</a> instead. </dd></dl>
</div>
</div>
<a id="ga546ba4bf5f01f62d6308191c9845711b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga546ba4bf5f01f62d6308191c9845711b">◆ </a></span>libusb_kernel_driver_active()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int API_EXPORTED libusb_kernel_driver_active </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">int </td>
<td class="paramname"><em>interface_number</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Determine if a kernel driver is active on an interface. If a kernel driver is active, you cannot claim the interface, and libusb will be unable to perform I/O.</p>
<p>This functionality is not available on Windows.</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">interface_number</td><td>the interface to check </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 if no kernel driver is active </dd>
<dd>
1 if a kernel driver is active </dd>
<dd>
LIBUSB_ERROR_NO_DEVICE if the device has been disconnected </dd>
<dd>
LIBUSB_ERROR_NOT_SUPPORTED on platforms where the functionality is not available </dd>
<dd>
another LIBUSB_ERROR code on other failure </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__libusb__dev.html#ga514103328b9278600a59a1d9a911b3c9">libusb_detach_kernel_driver()</a> </dd></dl>
</div>
</div>
<a id="gaae48f83e4b9652964ce501d914dd505e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaae48f83e4b9652964ce501d914dd505e">◆ </a></span>libusb_open()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int API_EXPORTED libusb_open </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structlibusb__device.html">libusb_device</a> * </td>
<td class="paramname"><em>dev</em>, </td>
</tr>
<tr>
<td class="paramkey"></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></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Open a device and obtain a device handle. A handle allows you to perform I/O on the device in question.</p>
<p>Internally, this function adds a reference to the device and makes it available to you through <a class="el" href="group__libusb__dev.html#ga0a22ab61ce433c743fde47118d548653">libusb_get_device()</a>. This reference is removed during <a class="el" href="group__libusb__dev.html#ga6c0534023632fdc669c1dde47f259f2f">libusb_close()</a>.</p>
<p>This is a non-blocking function; no requests are sent over the bus.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">dev</td><td>the device to open </td></tr>
<tr><td class="paramname">dev_handle</td><td>output location for the returned device handle pointer. Only populated when the return code is 0. </td></tr>
</table>
</dd>