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"
31 #include "wine/list.h"
34 #define DEFAULT_POLL_INTERVAL 200
35 #define MAX_POLL_INTERVAL_MSEC 10000
37 /* Ring buffer functions */
38 struct ReportRingBuffer
;
40 typedef struct _BASE_DEVICE_EXTENSION
46 /* this must be the first member */
47 HID_DEVICE_EXTENSION hid_ext
;
49 DEVICE_OBJECT
*child_pdo
;
54 DEVICE_OBJECT
*parent_fdo
;
56 HID_COLLECTION_INFORMATION information
;
57 struct hid_preparsed_data
*preparsed_data
;
62 UINT32 rawinput_handle
;
64 KSPIN_LOCK report_queues_lock
;
65 struct list report_queues
;
67 UNICODE_STRING link_name
;
69 KSPIN_LOCK irp_queue_lock
;
76 UNICODE_STRING mouse_link_name
;
78 UNICODE_STRING keyboard_link_name
;
82 /* These are unique to the parent FDO, but stored in the children as well
84 WCHAR device_id
[MAX_DEVICE_ID_LEN
];
85 WCHAR instance_id
[MAX_DEVICE_ID_LEN
];
88 } BASE_DEVICE_EXTENSION
;
97 struct hid_report_queue
104 struct hid_report
*reports
[512];
107 typedef struct _minidriver
111 HID_MINIDRIVER_REGISTRATION minidriver
;
113 PDRIVER_UNLOAD DriverUnload
;
115 PDRIVER_ADD_DEVICE AddDevice
;
116 PDRIVER_DISPATCH PNPDispatch
;
119 void call_minidriver( ULONG code
, DEVICE_OBJECT
*device
, void *in_buff
, ULONG in_size
,
120 void *out_buff
, ULONG out_size
, IO_STATUS_BLOCK
*io
) DECLSPEC_HIDDEN
;
122 /* Internal device functions */
123 void HID_StartDeviceThread(DEVICE_OBJECT
*device
) DECLSPEC_HIDDEN
;
125 IRP
*pop_irp_from_queue(BASE_DEVICE_EXTENSION
*ext
) DECLSPEC_HIDDEN
;
127 NTSTATUS WINAPI
pdo_ioctl(DEVICE_OBJECT
*device
, IRP
*irp
) DECLSPEC_HIDDEN
;
128 NTSTATUS WINAPI
pdo_read(DEVICE_OBJECT
*device
, IRP
*irp
) DECLSPEC_HIDDEN
;
129 NTSTATUS WINAPI
pdo_write(DEVICE_OBJECT
*device
, IRP
*irp
) DECLSPEC_HIDDEN
;
130 NTSTATUS WINAPI
pdo_create(DEVICE_OBJECT
*device
, IRP
*irp
) DECLSPEC_HIDDEN
;
131 NTSTATUS WINAPI
pdo_close(DEVICE_OBJECT
*device
, IRP
*irp
) DECLSPEC_HIDDEN
;
133 /* Parsing HID Report Descriptors into preparsed data */
134 struct hid_preparsed_data
*parse_descriptor( BYTE
*descriptor
, unsigned int length
) DECLSPEC_HIDDEN
;