2 * Copyright 2016 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
25 #include <ddk/hidclass.h>
28 typedef int(*enum_func
)(DEVICE_OBJECT
*device
, void *context
);
31 NTSTATUS
udev_driver_init(void) DECLSPEC_HIDDEN
;
32 NTSTATUS
iohid_driver_init(void) DECLSPEC_HIDDEN
;
33 NTSTATUS
sdl_driver_init(void) DECLSPEC_HIDDEN
;
34 void udev_driver_unload( void ) DECLSPEC_HIDDEN
;
35 void iohid_driver_unload( void ) DECLSPEC_HIDDEN
;
36 void sdl_driver_unload( void ) DECLSPEC_HIDDEN
;
38 /* Native device function table */
41 void (*free_device
)(DEVICE_OBJECT
*device
);
42 int (*compare_platform_device
)(DEVICE_OBJECT
*device
, void *platform_dev
);
43 NTSTATUS (*start_device
)(DEVICE_OBJECT
*device
);
44 NTSTATUS (*get_reportdescriptor
)(DEVICE_OBJECT
*device
, BYTE
*buffer
, DWORD length
, DWORD
*out_length
);
45 NTSTATUS (*get_string
)(DEVICE_OBJECT
*device
, DWORD index
, WCHAR
*buffer
, DWORD length
);
46 void (*set_output_report
)(DEVICE_OBJECT
*device
, HID_XFER_PACKET
*packet
, IO_STATUS_BLOCK
*io
);
47 void (*get_feature_report
)(DEVICE_OBJECT
*device
, HID_XFER_PACKET
*packet
, IO_STATUS_BLOCK
*io
);
48 void (*set_feature_report
)(DEVICE_OBJECT
*device
, HID_XFER_PACKET
*packet
, IO_STATUS_BLOCK
*io
);
51 void *get_platform_private(DEVICE_OBJECT
*device
) DECLSPEC_HIDDEN
;
53 /* HID Plug and Play Bus */
54 DEVICE_OBJECT
*bus_create_hid_device(const WCHAR
*busidW
, WORD vid
, WORD pid
,
55 WORD input
, DWORD version
, DWORD uid
, const WCHAR
*serialW
, BOOL is_gamepad
,
56 const platform_vtbl
*vtbl
, DWORD platform_data_size
) DECLSPEC_HIDDEN
;
57 DEVICE_OBJECT
*bus_find_hid_device(const WCHAR
*bus_id
, void *platform_dev
) DECLSPEC_HIDDEN
;
58 void bus_unlink_hid_device(DEVICE_OBJECT
*device
) DECLSPEC_HIDDEN
;
59 void process_hid_report(DEVICE_OBJECT
*device
, BYTE
*report
, DWORD length
) DECLSPEC_HIDDEN
;
60 DEVICE_OBJECT
*bus_enumerate_hid_devices(const WCHAR
*bus_id
, enum_func function
, void *context
) DECLSPEC_HIDDEN
;
62 /* General Bus Functions */
63 DWORD
check_bus_option(const UNICODE_STRING
*option
, DWORD default_value
) DECLSPEC_HIDDEN
;
64 BOOL
is_xbox_gamepad(WORD vid
, WORD pid
) DECLSPEC_HIDDEN
;
66 extern HANDLE driver_key DECLSPEC_HIDDEN
;
67 extern DEVICE_OBJECT
*bus_pdo DECLSPEC_HIDDEN
;
76 extern BOOL
hid_descriptor_append(struct hid_descriptor
*desc
, const BYTE
*buffer
, SIZE_T size
) DECLSPEC_HIDDEN
;
77 extern BOOL
hid_descriptor_begin(struct hid_descriptor
*desc
, USAGE usage_page
, USAGE usage
) DECLSPEC_HIDDEN
;
78 extern BOOL
hid_descriptor_end(struct hid_descriptor
*desc
) DECLSPEC_HIDDEN
;
79 extern void hid_descriptor_free(struct hid_descriptor
*desc
) DECLSPEC_HIDDEN
;
81 extern BOOL
hid_descriptor_add_buttons(struct hid_descriptor
*desc
, USAGE usage_page
,
82 USAGE usage_min
, USAGE usage_max
) DECLSPEC_HIDDEN
;
83 extern BOOL
hid_descriptor_add_padding(struct hid_descriptor
*desc
, BYTE bitcount
) DECLSPEC_HIDDEN
;
84 extern BOOL
hid_descriptor_add_hatswitch(struct hid_descriptor
*desc
, INT count
) DECLSPEC_HIDDEN
;
85 extern BOOL
hid_descriptor_add_axes(struct hid_descriptor
*desc
, BYTE count
, USAGE usage_page
,
86 const USAGE
*usages
, BOOL rel
, INT size
, LONG min
, LONG max
) DECLSPEC_HIDDEN
;
88 extern BOOL
hid_descriptor_add_haptics(struct hid_descriptor
*desc
) DECLSPEC_HIDDEN
;