2 * Copyright 2015 Aric Stewart
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.
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.
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
20 #define WIN32_NO_STATUS
27 #include "ddk/hidport.h"
28 #include "ddk/hidclass.h"
29 #include "ddk/hidpi.h"
30 #include "wine/list.h"
33 #define DEFAULT_POLL_INTERVAL 200
34 #define MAX_POLL_INTERVAL_MSEC 10000
36 typedef NTSTATUS (WINAPI
*pAddDevice
)(DRIVER_OBJECT
*DriverObject
, DEVICE_OBJECT
*PhysicalDeviceObject
);
38 /* Ring buffer functions */
39 struct ReportRingBuffer
;
41 typedef struct _BASE_DEVICE_EXTENSTION
{
42 HID_DEVICE_EXTENSION deviceExtension
;
44 HID_COLLECTION_INFORMATION information
;
45 WINE_HIDP_PREPARSED_DATA
*preparseData
;
50 struct ReportRingBuffer
*ring_buffer
;
56 /* Minidriver Specific stuff will end up here */
57 } BASE_DEVICE_EXTENSION
;
59 UINT
RingBuffer_AddPointer(struct ReportRingBuffer
*buffer
) DECLSPEC_HIDDEN
;
60 void RingBuffer_RemovePointer(struct ReportRingBuffer
*ring
, UINT index
) DECLSPEC_HIDDEN
;
61 void RingBuffer_Destroy(struct ReportRingBuffer
*buffer
) DECLSPEC_HIDDEN
;
62 struct ReportRingBuffer
* RingBuffer_Create(UINT buffer_size
) DECLSPEC_HIDDEN
;
64 typedef struct _minidriver
68 HID_MINIDRIVER_REGISTRATION minidriver
;
70 PDRIVER_UNLOAD DriverUnload
;
75 NTSTATUS
call_minidriver(ULONG code
, DEVICE_OBJECT
*device
, void *in_buff
, ULONG in_size
, void *out_buff
, ULONG out_size
) DECLSPEC_HIDDEN
;
76 minidriver
* find_minidriver(DRIVER_OBJECT
* driver
) DECLSPEC_HIDDEN
;
78 /* Internal device functions */
79 NTSTATUS
HID_CreateDevice(DEVICE_OBJECT
*native_device
, HID_MINIDRIVER_REGISTRATION
*driver
, DEVICE_OBJECT
**device
) DECLSPEC_HIDDEN
;
80 NTSTATUS
HID_LinkDevice(DEVICE_OBJECT
*device
, LPCWSTR serial
, LPCWSTR index
) DECLSPEC_HIDDEN
;
81 void HID_DeleteDevice(HID_MINIDRIVER_REGISTRATION
*driver
, DEVICE_OBJECT
*device
) DECLSPEC_HIDDEN
;
83 NTSTATUS WINAPI
HID_Device_ioctl(DEVICE_OBJECT
*device
, IRP
*irp
) DECLSPEC_HIDDEN
;
84 NTSTATUS WINAPI
HID_Device_create(DEVICE_OBJECT
*device
, IRP
*irp
) DECLSPEC_HIDDEN
;
85 NTSTATUS WINAPI
HID_Device_close(DEVICE_OBJECT
*device
, IRP
*irp
) DECLSPEC_HIDDEN
;
87 /* Pseudo-Plug and Play support*/
88 NTSTATUS WINAPI
PNP_AddDevice(DRIVER_OBJECT
*driver
, DEVICE_OBJECT
* PDO
) DECLSPEC_HIDDEN
;
89 void PNP_CleanupPNP(DRIVER_OBJECT
*driver
) DECLSPEC_HIDDEN
;
91 /* Parsing HID Report Descriptors into preparsed data */
92 WINE_HIDP_PREPARSED_DATA
* ParseDescriptor(BYTE
*descriptor
, unsigned int length
) DECLSPEC_HIDDEN
;