-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_Example.au3
More file actions
68 lines (54 loc) · 2.97 KB
/
_Example.au3
File metadata and controls
68 lines (54 loc) · 2.97 KB
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
#include "LibUSB_UDF.au3"
Global $SAM_VID = 1256, $SAM_PID = 26720
$USB = USB()
$List = $USB.get_device_list
$i = 6
#Region Example 1
For $i = 0 To UBound($List) -1
$device_descriptor = $USB.get_device_descriptor($List[$i])
ConsoleWrite(@CRLF&'------------------------- Device ['&$i&']----------------------------'&@CRLF)
ConsoleWrite('----------> bLength :'&$device_descriptor.bLength & _
@CRLF&'----------> bDescriptorType : '&$device_descriptor.bDescriptorType & _
@CRLF&'----------> bcdUSB : '&$device_descriptor.bcdUSB & _
@CRLF&'----------> bDeviceClass : '&$device_descriptor.bDeviceClass & _
@CRLF&'----------> bDeviceSubClass : '&$device_descriptor.bDeviceSubClass & _
@CRLF&'----------> bDeviceProtocol : '&$device_descriptor.bDeviceProtocol & _
@CRLF&'----------> bMaxPacketSize : '&$device_descriptor.bMaxPacketSize & _
@CRLF&'----------> idVendor : '&$device_descriptor.idVendor & _
@CRLF&'----------> idProduct : '&$device_descriptor.idProduct & _
@CRLF&'----------> bcdDevice : '&$device_descriptor.bcdDevice & _
@CRLF&'----------> iManufacturer : '&$device_descriptor.iManufacturer & _
@CRLF&'----------> iProduct : '&$device_descriptor.iProduct & _
@CRLF&'----------> iSerialNumber : '&$device_descriptor.iSerialNumber & _
@CRLF&'----------> bNumConfigurations : '&$device_descriptor.bNumConfigurations & _
@CRLF&'----------> busNumber : '&$USB.get_bus_number($List[$i]))
ConsoleWrite(@CRLF&'-----------------------------------------------------'&@CRLF)
Next
#EndRegion
#Region Example 2
For $i = 0 To UBound($List) -1
$device_descriptor = $USB.get_device_descriptor($List[$i])
If $SAM_VID = $device_descriptor.idVendor And $SAM_PID = $device_descriptor.idProduct Then
ConsoleWrite('bLength :'&@CRLF&$device_descriptor.bLength & _
@CRLF&'bDescriptorType : '&$device_descriptor.bDescriptorType & _
@CRLF&'bcdUSB : '&$device_descriptor.bcdUSB & _
@CRLF&'bDeviceClass : '&$device_descriptor.bDeviceClass & _
@CRLF&'bDeviceSubClass : '&$device_descriptor.bDeviceSubClass & _
@CRLF&'bDeviceProtocol : '&$device_descriptor.bDeviceProtocol & _
@CRLF&'bMaxPacketSize : '&$device_descriptor.bMaxPacketSize & _
@CRLF&'idVendor : '&$device_descriptor.idVendor & _
@CRLF&'idProduct : '&$device_descriptor.idProduct & _
@CRLF&'bcdDevice : '&$device_descriptor.bcdDevice & _
@CRLF&'iManufacturer : '&$device_descriptor.iManufacturer & _
@CRLF&'iProduct : '&$device_descriptor.iProduct & _
@CRLF&'iSerialNumber : '&$device_descriptor.iSerialNumber & _
@CRLF&'bNumConfigurations : '&$device_descriptor.bNumConfigurations & _
@CRLF&'busNumber : '&$USB.get_bus_number($List[$i]))
$dev_handle = $USB.open($List[$i])
$Test = $dev_handle.kernel_driver_active(1)
$Result = $dev_handle.claim_interface(1) ; <==== There is a problem here
MsgBox(0,$Result,VarGetType($Result))
ExitLoop
EndIf
Next
#EndRegion