ReactOS  0.4.14-dev-323-g6fe6a88
device.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Aric Stewart
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 
19 #include <stdio.h>
20 #include "ntstatus.h"
21 #define WIN32_NO_STATUS
22 #include "windows.h"
23 #include "setupapi.h"
24 #include "hidusage.h"
25 #include "ddk/hidsdi.h"
26 
27 #include "wine/test.h"
28 
29 #define READ_MAX_TIME 5000
30 
32 
34 {
36  HIDP_CAPS Caps;
37  HIDD_ATTRIBUTES attributes;
39  BOOL rc;
40  WCHAR device_name[128];
41 
42  rc = HidD_GetPreparsedData(device, &ppd);
43  ok(rc, "Failed to get preparsed data(0x%x)\n", GetLastError());
44  status = HidP_GetCaps(ppd, &Caps);
45  ok(status == HIDP_STATUS_SUCCESS, "Failed to get Caps(0x%x)\n", status);
47  ok(rc, "Failed to get product string(0x%x)\n", GetLastError());
48  trace("Found device %s (%02x, %02x)\n", wine_dbgstr_w(device_name), Caps.UsagePage, Caps.Usage);
49  rc = HidD_FreePreparsedData(ppd);
50  ok(rc, "Failed to free preparsed data(0x%x)\n", GetLastError());
51  rc = HidD_GetAttributes(device, &attributes);
52  ok(rc, "Failed to get device attributes (0x%x)\n", GetLastError());
53  ok(attributes.Size == sizeof(attributes), "Unexpected HIDD_ATTRIBUTES size: %d\n", attributes.Size);
54  trace("Device attributes: vid:%04x pid:%04x ver:%04x\n", attributes.VendorID, attributes.ProductID, attributes.VersionNumber);
55 }
56 
58 {
59  GUID hid_guid;
60  HDEVINFO info_set;
61  DWORD index = 0;
62  SP_DEVICE_INTERFACE_DATA interface_data;
63  DWORD detail_size = MAX_PATH * sizeof(WCHAR);
65 
66  HidD_GetHidGuid(&hid_guid);
67 
68  ZeroMemory(&interface_data, sizeof(interface_data));
69  interface_data.cbSize = sizeof(interface_data);
70 
71  data = HeapAlloc(GetProcessHeap(), 0, sizeof(*data) + detail_size);
72  data->cbSize = sizeof(*data);
73 
75  while (SetupDiEnumDeviceInterfaces(info_set, NULL, &hid_guid, index, &interface_data))
76  {
77  index ++;
78 
79  if (SetupDiGetDeviceInterfaceDetailW(info_set, &interface_data, data, sizeof(*data) + detail_size, NULL, NULL))
80  {
83  {
84  trace("Not enough permissions to read device %s.\n", wine_dbgstr_w(data->DevicePath));
85  continue;
86  }
88  {
89  trace("Device is busy: %s.\n", wine_dbgstr_w(data->DevicePath));
90  continue;
91  }
92 
93  ok(file != INVALID_HANDLE_VALUE, "Failed to open %s, error %u.\n",
94  wine_dbgstr_w(data->DevicePath), GetLastError());
95 
97  test(file);
98 
100  }
101  }
104 }
105 
107 {
108  GUID hid_guid;
109  HDEVINFO info_set;
110  DWORD index = 0;
111  SP_DEVICE_INTERFACE_DATA interface_data;
112  DWORD detail_size = MAX_PATH * sizeof(WCHAR);
115  BOOL rc;
116 
117  HidD_GetHidGuid(&hid_guid);
118 
119  ZeroMemory(&interface_data, sizeof(interface_data));
120  interface_data.cbSize = sizeof(interface_data);
121 
122  data = HeapAlloc(GetProcessHeap(), 0 , sizeof(*data) + detail_size);
123  data->cbSize = sizeof(*data);
124 
126  while (SetupDiEnumDeviceInterfaces(info_set, NULL, &hid_guid, index, &interface_data))
127  {
128  index ++;
129 
130  if (SetupDiGetDeviceInterfaceDetailW(info_set, &interface_data, data, sizeof(*data) + detail_size, NULL, NULL))
131  {
133  HIDP_CAPS Caps;
136  {
137  trace("Not enough permissions to read device %s.\n", wine_dbgstr_w(data->DevicePath));
138  continue;
139  }
140  ok(file != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError());
141 
142  rc = HidD_GetPreparsedData(file, &ppd);
143  ok(rc, "Failed to get preparsed data(0x%x)\n", GetLastError());
144  status = HidP_GetCaps(ppd, &Caps);
145  ok(status == HIDP_STATUS_SUCCESS, "Failed to get Caps(0x%x)\n", status);
146  rc = HidD_FreePreparsedData(ppd);
147  ok(rc, "Failed to free preparsed data(0x%x)\n", GetLastError());
148  if (!page || page == Caps.UsagePage)
149  {
150  int j;
151  if (!usage_count)
152  {
155  return file;
156  }
157  for (j = 0; j < usage_count; j++)
158  if (!usages[j] || usages[j] == Caps.Usage)
159  {
162  return file;
163  }
164  }
165  CloseHandle(file);
166  }
167  }
170  return NULL;
171 }
172 
173 static void process_data(HIDP_CAPS Caps, PHIDP_PREPARSED_DATA ppd, CHAR *data, DWORD data_length)
174 {
175  INT i;
177 
178  if (Caps.NumberInputButtonCaps)
179  {
180  USAGE button_pages[100];
181 
182  for (i = 1; i < 0xff; i++)
183  {
184  ULONG usage_length = 100;
185  status = HidP_GetUsages(HidP_Input, i, 0, button_pages, &usage_length, ppd, data, data_length);
186  ok (status == HIDP_STATUS_SUCCESS || usage_length == 0,
187  "HidP_GetUsages failed (%x) but usage length still %i\n", status, usage_length);
188  if (usage_length)
189  {
190  CHAR report[50];
191  int count;
192  int j;
193 
194  count = usage_length;
195  j = 0;
196  report[0] = 0;
197  trace("\tButtons [0x%x: %i buttons]:\n", i, usage_length);
198  for (count = 0; count < usage_length; count += 15)
199  {
200  for (j=count; j < count+15 && j < usage_length; j++)
201  {
202  CHAR btn[7];
203  sprintf(btn, "%i ", button_pages[j]);
204  strcat(report, btn);
205  }
206  trace("\t\t%s\n", report);
207  }
208  }
209  }
210  }
211 
212  if (Caps.NumberInputValueCaps)
213  {
214  ULONG value;
215  USHORT length;
217 
221  ok(status == HIDP_STATUS_SUCCESS, "Failed to get value caps (%x)\n",status);
222 
223  trace("\tValues:\n");
224  for (i = 0; i < length; i++)
225  {
227  values[i].Range.UsageMin, &value, ppd, data, data_length);
228  ok(status == HIDP_STATUS_SUCCESS, "Failed to get value [%i,%i] (%x)\n",
229  values[i].UsagePage, values[i].Range.UsageMin, status);
230  trace("[%02x, %02x]: %u\n",values[i].UsagePage, values[i].Range.UsageMin, value);
231  }
232 
234  }
235 }
236 
237 static void test_read_device(void)
238 {
240  HIDP_CAPS Caps;
242  WCHAR device_name[128];
243  CHAR *data = NULL;
244  DWORD read;
245  BOOL rc;
247  DWORD timeout, tick, spent, max_time;
248  char *report;
249 
252 
253  if (!device)
255 
256  if (!device)
257  {
258  trace("No device found for reading\n");
259  return;
260  }
262  ok(rc, "Failed to get product string(0x%x)\n", GetLastError());
263  trace("Read tests on device :%s\n",wine_dbgstr_w(device_name));
264 
265  rc = HidD_GetPreparsedData(device, &ppd);
266  ok(rc, "Failed to get preparsed data(0x%x)\n", GetLastError());
267  status = HidP_GetCaps(ppd, &Caps);
268  ok(status == HIDP_STATUS_SUCCESS, "Failed to get Caps(0x%x)\n", status);
270 
271  memset(&overlapped, 0, sizeof(overlapped));
274  {
275  max_time = READ_MAX_TIME;
276  timeout = 1000;
277  }
278  else
279  max_time = timeout = 100;
281  trace("Test your device for the next %i seconds\n", max_time/1000);
283  tick = GetTickCount();
284  spent = 0;
285  do
286  {
289  {
290  ResetEvent(overlapped.hEvent);
291  spent = GetTickCount() - tick;
292  trace("REMAINING: %d ms\n", max_time - spent);
293  continue;
294  }
295  ResetEvent(overlapped.hEvent);
296  spent = GetTickCount() - tick;
298  if (read)
299  {
300  int i;
301 
302  report[0] = 0;
303  for (i = 0; i < read && i < Caps.InputReportByteLength; i++)
304  {
305  char bytestr[5];
306  sprintf(bytestr, "%x ", (BYTE)data[i]);
307  strcat(report, bytestr);
308  }
309  trace("Input report (%i): %s\n", read, report);
310 
311  process_data(Caps, ppd, data, read);
312  }
313  trace("REMAINING: %d ms\n", max_time - spent);
314  } while(spent < max_time);
315 
316  CloseHandle(overlapped.hEvent);
317  rc = HidD_FreePreparsedData(ppd);
318  ok(rc, "Failed to free preparsed data(0x%x)\n", GetLastError());
322 }
323 
324 static void test_get_input_report(void)
325 {
327  HIDP_CAPS Caps;
328  WCHAR device_name[128];
329  CHAR *data = NULL;
330  DWORD tick, spent, max_time;
331  char *report;
332  BOOL rc;
334 
337 
338  if (!device)
340 
341  if (!device)
342  {
343  trace("No device found for testing\n");
344  return;
345  }
347  ok(rc, "Failed to get product string(0x%x)\n", GetLastError());
348  trace("HidD_GetInputRpeort tests on device :%s\n",wine_dbgstr_w(device_name));
349 
350  rc = HidD_GetPreparsedData(device, &ppd);
351  ok(rc, "Failed to get preparsed data(0x%x)\n", GetLastError());
352  status = HidP_GetCaps(ppd, &Caps);
353  ok(status == HIDP_STATUS_SUCCESS, "Failed to get Caps(0x%x)\n", status);
355 
357  max_time = READ_MAX_TIME;
358  else
359  max_time = 100;
361  trace("Test your device for the next %i seconds\n", max_time/1000);
363  tick = GetTickCount();
364  spent = 0;
365  do
366  {
367  int i;
368 
369  data[0] = 0; /* Just testing report ID 0 for now, That will catch most devices */
371  spent = GetTickCount() - tick;
372 
373  if (rc)
374  {
375  ok(data[0] == 0, "Report ID (0) is not the first byte of the data\n");
376  report[0] = 0;
377  for (i = 0; i < Caps.InputReportByteLength; i++)
378  {
379  char bytestr[5];
380  sprintf(bytestr, "%x ", (BYTE)data[i]);
381  strcat(report, bytestr);
382  }
383  trace("Input report (%i): %s\n", Caps.InputReportByteLength, report);
384 
385  process_data(Caps, ppd, data, Caps.InputReportByteLength);
386  }
387  else
388  trace("Failed to get Input Report, (%x)\n", rc);
389  trace("REMAINING: %d ms\n", max_time - spent);
390  Sleep(500);
391  } while(spent < max_time);
392 
393  rc = HidD_FreePreparsedData(ppd);
394  ok(rc, "Failed to free preparsed data(0x%x)\n", GetLastError());
398 }
399 
401 {
405 }
USHORT NumberInputButtonCaps
Definition: hidpi.h:157
USHORT NumberInputValueCaps
Definition: hidpi.h:158
#define CloseHandle
Definition: compat.h:398
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
GLint x0
Definition: linetemp.h:95
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
HDEVINFO WINAPI SetupDiGetClassDevsW(CONST GUID *class, LPCWSTR enumstr, HWND parent, DWORD flags)
Definition: devinst.c:2297
BOOL WINAPI GetOverlappedResult(IN HANDLE hFile, IN LPOVERLAPPED lpOverlapped, OUT LPDWORD lpNumberOfBytesTransferred, IN BOOL bWait)
Definition: iocompl.c:204
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
GLuint GLuint GLsizei count
Definition: gl.h:1545
BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, PSP_DEVICE_INTERFACE_DETAIL_DATA_W DeviceInterfaceDetailData, DWORD DeviceInterfaceDetailDataSize, PDWORD RequiredSize, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:3016
char CHAR
Definition: xmlstorage.h:175
_Must_inspect_result_ HIDAPI NTSTATUS NTAPI HidP_GetUsageValue(_In_ HIDP_REPORT_TYPE ReportType, _In_ USAGE UsagePage, _In_ USHORT LinkCollection, _In_ USAGE Usage, _Out_ PULONG UsageValue, _In_ PHIDP_PREPARSED_DATA PreparsedData, _In_reads_bytes_(ReportLength) PCHAR Report, _In_ ULONG ReportLength)
LONG NTSTATUS
Definition: precomp.h:26
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
static const WCHAR device_name[]
Definition: btrfs.c:61
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
HIDAPI BOOLEAN WINAPI HidD_GetPreparsedData(IN HANDLE HidDeviceObject, OUT PHIDP_PREPARSED_DATA *PreparsedData)
Definition: hid.c:290
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1642
ULONG Size
Definition: hidpi.h:84
USHORT VersionNumber
Definition: hidpi.h:87
Definition: dhcpd.h:245
#define test
Definition: rosglue.h:37
int winetest_interactive
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
int32_t INT
Definition: typedefs.h:56
GLbitfield GLuint64 timeout
Definition: glext.h:7164
#define FILE_SHARE_READ
Definition: compat.h:125
HIDAPI BOOLEAN WINAPI HidD_GetInputReport(IN HANDLE HidDeviceObject, IN OUT PVOID ReportBuffer, IN ULONG ReportBufferLength)
Definition: hid.c:215
HIDAPI BOOLEAN WINAPI HidD_GetAttributes(IN HANDLE HidDeviceObject, OUT PHIDD_ATTRIBUTES Attributes)
Definition: hid.c:152
#define sprintf(buf, format,...)
Definition: sprintf.c:55
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
USHORT VendorID
Definition: hidpi.h:85
START_TEST(device)
Definition: device.c:262
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
Definition: module.h:566
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:637
static void report(const DATA_BLOB *pDataIn, const DATA_BLOB *pOptionalEntropy, CRYPTPROTECT_PROMPTSTRUCT *pPromptStruct, DWORD dwFlags)
Definition: protectdata.c:769
GLuint index
Definition: glext.h:6031
#define OPEN_EXISTING
Definition: compat.h:426
HIDAPI NTSTATUS NTAPI HidP_GetCaps(IN PHIDP_PREPARSED_DATA PreparsedData, OUT PHIDP_CAPS Capabilities)
Definition: hidp.c:33
_Must_inspect_result_ _In_ USAGE UsagePage
Definition: hidpi.h:382
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
HIDAPI BOOLEAN WINAPI HidD_FreePreparsedData(IN PHIDP_PREPARSED_DATA PreparsedData)
Definition: hid.c:139
#define HID_USAGE_PAGE_GENERIC
Definition: hidusage.h:176
USHORT ProductID
Definition: hidpi.h:86
#define WAIT_OBJECT_0
Definition: winbase.h:387
#define GetProcessHeap()
Definition: compat.h:395
static HANDLE get_device(USHORT page, USHORT usages[], UINT usage_count, DWORD access)
Definition: device.c:106
#define trace
Definition: atltest.h:70
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
USAGE UsagePage
Definition: hidpi.h:151
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
static void test_device_info(HANDLE device)
Definition: device.c:33
struct _HIDP_PREPARSED_DATA * PHIDP_PREPARSED_DATA
Definition: hidpi.h:39
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2898
#define MAX_PATH
Definition: compat.h:26
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
HIDAPI VOID WINAPI HidD_GetHidGuid(OUT LPGUID HidGuid)
Definition: hid.c:202
HIDAPI BOOLEAN WINAPI HidD_GetProductString(IN HANDLE HidDeviceObject, OUT PVOID Buffer, IN ULONG BufferLength)
Definition: hid.c:345
USHORT USAGE
Definition: hidusage.h:30
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
_Must_inspect_result_ HIDAPI NTSTATUS NTAPI HidP_GetUsages(_In_ HIDP_REPORT_TYPE ReportType, _In_ USAGE UsagePage, _In_ USHORT LinkCollection, _Out_writes_to_(*UsageLength, *UsageLength) USAGE *UsageList, _Inout_ ULONG *UsageLength, _In_ PHIDP_PREPARSED_DATA PreparsedData, _Out_writes_bytes_(ReportLength) PCHAR Report, _In_ ULONG ReportLength)
static void test_get_input_report(void)
Definition: device.c:324
#define HID_USAGE_GENERIC_JOYSTICK
Definition: hidusage.h:34
#define READ_MAX_TIME
Definition: device.c:29
unsigned char BYTE
Definition: mem.h:68
static void process_data(HIDP_CAPS Caps, PHIDP_PREPARSED_DATA ppd, CHAR *data, DWORD data_length)
Definition: device.c:173
#define GENERIC_READ
Definition: compat.h:124
#define ERROR_SHARING_VIOLATION
Definition: winerror.h:135
Definition: range.c:39
GLsizei const GLfloat * value
Definition: glext.h:6069
HIDAPI NTSTATUS NTAPI HidP_GetValueCaps(HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS ValueCaps, PUSHORT ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData)
Definition: hidp.c:587
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED * overlapped
Definition: sock.c:82
USAGE Usage
Definition: hidpi.h:150
unsigned short USHORT
Definition: pedump.c:61
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI SetupDiEnumDeviceInterfaces(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, CONST GUID *InterfaceClassGuid, DWORD MemberIndex, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
Definition: devinst.c:2785
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:714
static void run_for_each_device(device_test *test)
Definition: device.c:57
void() device_test(HANDLE device)
Definition: device.c:31
#define CreateFileW
Definition: compat.h:400
#define DIGCF_DEVICEINTERFACE
Definition: setupapi.h:174
unsigned int ULONG
Definition: retypes.h:1
#define HIDP_STATUS_SUCCESS
Definition: hidpi.h:248
static PCCRYPT_OID_INFO ** usages
Definition: softpub.c:81
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123
#define memset(x, y, z)
Definition: compat.h:39
static SERVICE_STATUS status
Definition: service.c:31
#define HeapFree(x, y, z)
Definition: compat.h:394
USHORT InputReportByteLength
Definition: hidpi.h:152
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
static void test_read_device(void)
Definition: device.c:237
#define DIGCF_PRESENT
Definition: setupapi.h:171
#define HID_USAGE_GENERIC_GAMEPAD
Definition: hidusage.h:35
Definition: fci.c:126
Definition: ps.c:97