Search the Community
Showing results for tags 'hid'.
-
Edit: If you already read this post, I updated it to better fit the scope of what I want to do. My goal is to be able to read the raw output from a usb type controller (or mouse or keyboard, don't want it to be controller-only) so i can see how / what changes when i hit buttons. I've gotten as far as finding HID page documentation and documentation for the device Struct, but I don't know where to go from here How do I tell what and Useage to use for any given controller / Keyboard / Mouse? How do I get a list of all HID devices connected and their UsagePage / Usage? How do I register multiple devices / get raw input from multiple devices at once? Here is the modified example script i am using: #include <APISysConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WinAPIGdi.au3> #include <WinAPIMisc.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> Opt('TrayAutoPause', 0) Global $iFlagsOld = 0, $iDataOld = 0 ; Create GUI Global $g_hForm = GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 160, 212, @DesktopWidth - 179, @DesktopHeight - 283, BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU), $WS_EX_TOPMOST) ; To obtain the values of "UsagePage" and "Usage" members of this structure read HID Usage Tables documentation ; http://www.usb.org/developers/devclass_docs/HID1_11.pdf ; Disregaurd that, official USB documention = useless. Here is a human/normal-person friendly list ; http://www.freebsddiary.org/APC/usb_hid_usages.php ; Information on the Struct (eg what Flags and hTarget do) can be found here ; https://msdn.microsoft.com/en-us/library/ms645565(v=vs.85).aspx Local $tRID = DllStructCreate($tagRAWINPUTDEVICE) DllStructSetData($tRID, 'UsagePage', 0x01) ; Generic Desktop Controls DllStructSetData($tRID, 'Usage', 0x06) ; Mouse DllStructSetData($tRID, 'Flags', $RIDEV_INPUTSINK) ; This flag makes window hTarget accept input even when it's not active. MUST define hTarget DllStructSetData($tRID, 'hTarget', $g_hForm) ; The target window that will be sent events, used with some Flags ; Register HID input to obtain row input _WinAPI_RegisterRawInputDevices($tRID) ; Register WM_INPUT message GUIRegisterMsg($WM_INPUT, 'WM_INPUT') ;~ GUISetState(@SW_SHOW) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func WM_INPUT($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam Switch $hWnd Case $g_hForm Local $tRIM = DllStructCreate($tagRAWINPUTMOUSE) If _WinAPI_GetRawInputData($lParam, $tRIM, DllStructGetSize($tRIM), $RID_INPUT) Then Local $iFlags = DllStructGetData($tRIM, 'Flags') Local $sFlag = "", $sData = "" $iFlags = DllStructGetData($tRIM, 'ButtonFlags') If $iFlags <> $iFlagsOld Then $sFlag = $iFlags $iFlagsOld = $iFlags EndIf $iData = DllStructGetData($tRIM, 'ButtonData') If $iData <> $iDataOld Then $sData = $iData $iDataOld = $iData EndIf If $sFlag&$sData <> "" Then ConsoleWrite($sFlag&" "&$sData&@CRLF) EndIf EndIf EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_INPUT Old post:
-
Hi, Does anyone knows why this command doesn't work? Run(@ComSpec & " /c " & "devcon.exe hwids * | findstr /R ""1050&PID_0114&REV_0340&MI_01"" || (rundll32.exe user32.dll, LockWorkStation)", "", "") This is the command in commandline: devcon.exe hwids * | findstr /R "1050&PID_0114&REV_0340&MI_01" && (echo USB Device is connected) || (rundll32.exe user32.dll, LockWorkStation) This works, but i want to convert this to AutoIT, but it doesn't work. In short what i am trying to accomplish is that a script checks every 1 sec. if there is an USB device plugged in and if not ( so it is removed ) it will lock Windows OS. Can someone help me with this?
-
I know that this theme was discussed several times but I read all These threats with no helping result. I have two pieces of TEMPer1F USB Thermometer. It is a Standard Windows HID device with no add. Driver needed. With the device I got an App reading from it and showing Graphs and much more and which can handle several devices. With the Software came also a RDingUSB.dll file handling the communication with the device. I can call the dll without any error. But the Problem is how to Access the device using the DLL and Access more than one of same VID/PID by Serial or anything else useful. I have also sources in c# doing the Job, but no experience in C# to successfuly port it to AutoIT. So my question: Can anyone help me to realize the simple pull of the temperature value from the devices based on C# source? The rest to write it to MySQL DB and repeat it etc. is no Problem for me. *************************************** The C# part with the DLL functions class: *************************************** using System; using System.Runtime.InteropServices; namespace TEMPer { internal class RDing { [DllImport("RDingUSB.dll")] public static extern IntPtr OpenUSBDevice(int VID, int PID); [DllImport("RDingUSB.dll")] public static extern IntPtr CloseUSBDevice(IntPtr hDevice); [DllImport("RDingUSB.dll")] public static extern bool WriteUSB(IntPtr hDevice, byte[] pBuffer, uint dwBytesToWrite, ref ulong lpNumberOfBytesWritten); [DllImport("RDingUSB.dll")] public static extern bool ReadUSB(IntPtr hDevice, byte[] pBuffer, uint dwBytesToRead, ref ulong lpNumberOfBytesRead); [DllImport("RDingUSB.dll")] public static extern ushort GetInputLength(IntPtr hDevice); [DllImport("RDingUSB.dll")] public static extern ushort GetOutputLength(IntPtr hDevice); [DllImport("RDingUSB.dll")] public static extern uint GetErrorMsg(ref string[] lpErrorMsg, uint dwErrorMsgSize); } } ********************************* The C# code snippet working with the functions of the class above is in the attachment this is the interesting part where the data is sent and pulled which I do not understand to transcode to AutoIT Important my devices are the type2 (TEMPer1F) : ********************************* So in the end I Need: Call DLL, read all devices in array Loop the Array until ubound(Array) and for each device in Array read the temperature value and prepare the data to decimal 6,1 (SQL Format) and °C So how to pull the value from the devices? Maybe somwbody finds the important part in the C# (the code above is for different models, mine is TEMPer1F Or maybe someone has solved this and has maybe a uDF for this MainForm.cs
-
I have a Windows XP based ultrasound machine that besides the keyboard has a console with custom controls such as zoom, pause, measure, caliper, etc. As far as I understand, these custom keys "don't send key combinations; instead, they have their own usage IDs in the HID". So is there a way to simulate pressing these keys in AutoIt?
-
For a model railway project only. Using multiple rfid readers. These readers have no PID or VID or serial numbers. Only difference is the hub/port number allocated. Using Win7 32 bit. The only information I need to obtain from the HID devices is: hub/port number last string transmitted. (14 character string of the rfid tag number) timestamp of the latest reading. The tag data will be moved to excel immediately after received by usb ready for the next read. Timestamp and data would be overwritten by next set of data. the GUI would have single line for each reader (by hub/port #) with 3 headings. Timestamp, 14 character data, and hub/port # . Is it possible for Autoitscript to have a GUI to do this ? Thankyou Charles Harris