Hallo,
ich versuche schon seit einigen Wochen die Tasten meines USB-Infinity Pedals per AutoIt zu erkennen.
die hidtrace.exe erkennt das Gerät wie folgt:
VEC USB Footpedal // VID=05f3|PID=00ff(120)|Size=2/-1VID=05f3|PID=00ff(120)|Size=2/-1
Spoiler anzeigen
ich habe auch diesen code ausprobiert: (Gerät wird gefunden)
Spoiler anzeigen
#include <APISysConstants.au3>
#include <Array.au3>
#include <WinAPISys.au3>
Local $tText, $aData = _WinAPI_EnumRawInputDevices()
If IsArray($aData) Then
ReDim $aData[$aData[0][0] + 1][3]
$tText = DllStructCreate('wchar[256]')
For $i = 1 To $aData[0][0]
If _WinAPI_GetRawInputDeviceInfo($aData[$i][0], $tText, 256, $RIDI_DEVICENAME) Then
$aData[$i][2] = DllStructGetData($tText, 1)
Else
$aData[$i][2] = ''
EndIf
Next
EndIf
_ArrayDisplay($aData, '_WinAPI_EnumRawInputDevices')
Alles anzeigen
Ergebnis:
6||
0x000904A5|1|\\?\HID#VID_046D&PID_C232#2&33093b6e&0&0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}
0x00090431|0|\\?\HID#VID_046D&PID_C231#2&af07c4&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}
0x00020047|2|\\?\HID#ATK4001#3&37c1d7c8&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
0x00020043|2|\\?\HID#VID_05F3&PID_00FF#6&2171edfb&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
0x0001003D|1|\\?\ACPI#ATK3001#4&24270aea&0#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}
0x00010035|0|\\?\ACPI#ETD0108#4&24270aea&0#{378de44c-56ef-11d1-bc8c-00a0c91405dd}
Einige andere Geräte wie das keyboard auf meinem laptop (0x01,0x06) und das mousepad (0x01,0x02) empfange ich mit diesem code:
Spoiler anzeigen
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <RawInput.au3>
#include <WinAPI.au3>
HotKeySet('{ESC}', '_EXIT')
Global $tRID_KD, $pRID_KD, $iRID_KD
Global $tRIH, $iRIH
Global $iNumDevices
Global $hGUI
$hGUI = GUICreate('Test', 100, 100)
GUIRegisterMsg($WM_INPUT, 'OnInput')
$tRID_KD = DllStructCreate($tagRAWINPUTDEVICE)
$pRID_KD = DllStructGetPtr($tRID_KD)
$iRID_KD = DllStructGetSize($tRID_KD)
$tRIH = DllStructCreate($tagRAWINPUTHEADER)
$iRIH = DllStructGetSize($tRIH)
$iNumDevices = 1
DllStructSetData($tRID_KD, 'usUsagePage', 0x01)
DllStructSetData($tRID_KD, 'usUsage', 0x06)
DllStructSetData($tRID_KD, 'dwFlags', BitOR($RIDEV_NOLEGACY, $RIDEV_INPUTSINK))
DllStructSetData($tRID_KD, 'hwndTarget', $hGUI)
_RegisterRawInputDevices($pRID_KD, $iNumDevices, $iRID_KD)
While 1
Sleep(20)
WEnd
GUIDelete()
Func OnInput($hwnd, $iMsg, $iwParam, $ilParam)
Local $tRI_KD, $pRI_KD, $iRI_KB
Local $iSize
$tRI_KD = DllStructCreate($tagRAWINPUT_KEYBOARD)
$pRI_KD = DllStructGetPtr($tRI_KD)
$iRI_KB = DllStructGetSize($tRI_KD)
_GetRawInputData($ilParam, $RID_INPUT, $pRI_KD, $iRI_KB, $iRIH)
If Not @error Then
ConsoleWrite(DllStructGetData($tRI_KD, 'Message') & @LF)
ConsoleWrite(DllStructGetData($tRI_KD, 'VKey') & @LF)
EndIf
$tRI_KD = 0
Return 'GUI_RUNDEFMSG'
EndFunc
Func _EXIT()
GUIDelete()
Exit
EndFunc
Alles anzeigen
Beim letzten code hab ich schon stundenlang kombinationen von page und usage versucht,
aber ich finde nicht / kapiere nicht wie ich die werte für page und usage bestimme.
super wäre natürlich ein autoit-script wie hidtrace.exe, damit ich nachvollziehen kann wie man soetwas ausliest.
wäre dankbar für jeden tipp!!
--
EDIT: ich habe gerade page und usage mit usblyzer (free-demo) auslesen können.
Dennoch würde ich gerne wissen, ob/wie man diese Werte per autoit auslesen kann,
und damit auch andere geräte unterstützen kann.
Spoiler anzeigen
Connection Status Device connected
Current Configuration 1
Speed Low (1.5 Mbit/s)
Device Address 4
Number Of Open Pipes 1
Device Descriptor VEC USB Footpedal
Offset Field Size Value Description
0 bLength 1 12h
1 bDescriptorType 1 01h Device
2 bcdUSB 2 0110h USB Spec 1.1
4 bDeviceClass 1 00h Class info in Ifc Descriptors
5 bDeviceSubClass 1 00h
6 bDeviceProtocol 1 00h
7 bMaxPacketSize0 1 08h 8 bytes
8 idVendor 2 05F3h PI Engineering, Inc.
10 idProduct 2 00FFh
12 bcdDevice 2 0120h 1.20
14 iManufacturer 1 01h "VEC "
15 iProduct 1 02h "VEC USB Footpedal"
16 iSerialNumber 1 00h
17 bNumConfigurations 1 01h
Configuration Descriptor 1 Bus Powered, 100 mA
Offset Field Size Value Description
0 bLength 1 09h
1 bDescriptorType 1 02h Configuration
2 wTotalLength 2 0022h
4 bNumInterfaces 1 01h
5 bConfigurationValue 1 01h
6 iConfiguration 1 00h
7 bmAttributes 1 A0h Bus Powered, Remote Wakeup
4..0: Reserved ...00000
5: Remote Wakeup ..1..... Yes
6: Self Powered .0...... No, Bus Powered
7: Reserved (set to one)
(bus-powered for 1.0) 1.......
8 bMaxPower 1 32h 100 mA
Interface Descriptor 0/0 HID, 1 Endpoint
Offset Field Size Value Description
0 bLength 1 09h
1 bDescriptorType 1 04h Interface
2 bInterfaceNumber 1 00h
3 bAlternateSetting 1 00h
4 bNumEndpoints 1 01h
5 bInterfaceClass 1 03h HID
6 bInterfaceSubClass 1 00h
7 bInterfaceProtocol 1 00h
8 iInterface 1 00h
HID Descriptor
Offset Field Size Value Description
0 bLength 1 09h
1 bDescriptorType 1 21h HID
2 bcdHID 2 0100h 1.00
4 bCountryCode 1 00h
5 bNumDescriptors 1 01h
6 bDescriptorType 1 22h Report
7 wDescriptorLength 2 0023h 35 bytes
Endpoint Descriptor 81 1 In, Interrupt, 10 ms
Offset Field Size Value Description
0 bLength 1 07h
1 bDescriptorType 1 05h Endpoint
2 bEndpointAddress 1 81h 1 In
3 bmAttributes 1 03h Interrupt
1..0: Transfer Type ......11 Interrupt
7..2: Reserved 000000..
4 wMaxPacketSize 2 0002h 2 bytes
6 bInterval 1 0Ah 10 ms
Interface 0 HID Report Descriptor Programmable Buttons
Item Tag (Value) Raw Data
Usage Page (Consumer Devices) 05 0C
Usage (Programmable Buttons) 09 03
Collection (Application) A1 01
Usage Page (Button) 05 09
Usage Minimum (Button 1) 19 01
Usage Maximum (Button 3) 29 03
Logical Minimum (0) 15 00
Logical Maximum (1) 25 01
Report Count (3) 95 03
Report Size (1) 75 01
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02
Report Count (1) 95 01
Report Size (5) 75 05
Input (Cnst,Ary,Abs) 81 01
Report Count (1) 95 01
Report Size (8) 75 08
Input (Cnst,Ary,Abs) 81 01
End Collection C0
Alles anzeigen
=> usagepage = 0x0c, usage = 0x03