2 * Copyright 2021 RĂ©mi Bernon for CodeWeavers
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
19 #ifndef __WINEBUS_UNIXLIB_H
20 #define __WINEBUS_UNIXLIB_H
27 #include <ddk/hidclass.h>
28 #include <ddk/hidpi.h>
31 #include "wine/debug.h"
32 #include "wine/list.h"
41 USAGE_AND_PAGE usages
;
45 WCHAR manufacturer
[MAX_PATH
];
46 WCHAR product
[MAX_PATH
];
47 WCHAR serialnumber
[MAX_PATH
];
50 struct sdl_bus_options
52 BOOL split_controllers
;
54 /* freed after bus_init */
59 struct udev_bus_options
66 struct iohid_bus_options
73 BUS_EVENT_TYPE_DEVICE_REMOVED
,
74 BUS_EVENT_TYPE_DEVICE_CREATED
,
75 BUS_EVENT_TYPE_INPUT_REPORT
,
86 struct device_desc desc
;
97 struct device_create_params
99 struct device_desc desc
;
103 struct device_remove_params
108 struct device_start_params
113 struct device_descriptor_params
121 struct device_report_params
124 HID_XFER_PACKET
*packet
;
143 device_get_report_descriptor
,
144 device_set_output_report
,
145 device_get_feature_report
,
146 device_set_feature_report
,
150 static inline const char *debugstr_device_desc(struct device_desc
*desc
)
152 if (!desc
) return "(null)";
153 return wine_dbg_sprintf("{vid %04x, pid %04x, version %04x, input %d, uid %08x, usage %04x:%04x, is_gamepad %u, is_hidraw %u}",
154 desc
->vid
, desc
->pid
, desc
->version
, desc
->input
, desc
->uid
, desc
->usages
.UsagePage
, desc
->usages
.Usage
,
155 desc
->is_gamepad
, desc
->is_hidraw
);
158 static inline BOOL
is_xbox_gamepad(WORD vid
, WORD pid
)
160 if (vid
!= 0x045e) return FALSE
;
161 if (pid
== 0x0202) return TRUE
; /* Xbox Controller */
162 if (pid
== 0x0285) return TRUE
; /* Xbox Controller S */
163 if (pid
== 0x0289) return TRUE
; /* Xbox Controller S */
164 if (pid
== 0x028e) return TRUE
; /* Xbox360 Controller */
165 if (pid
== 0x028f) return TRUE
; /* Xbox360 Wireless Controller */
166 if (pid
== 0x02d1) return TRUE
; /* Xbox One Controller */
167 if (pid
== 0x02dd) return TRUE
; /* Xbox One Controller (Covert Forces/Firmware 2015) */
168 if (pid
== 0x02e0) return TRUE
; /* Xbox One X Controller */
169 if (pid
== 0x02e3) return TRUE
; /* Xbox One Elite Controller */
170 if (pid
== 0x02e6) return TRUE
; /* Wireless XBox Controller Dongle */
171 if (pid
== 0x02ea) return TRUE
; /* Xbox One S Controller */
172 if (pid
== 0x02fd) return TRUE
; /* Xbox One S Controller (Firmware 2017) */
173 if (pid
== 0x0b00) return TRUE
; /* Xbox Elite 2 */
174 if (pid
== 0x0b05) return TRUE
; /* Xbox Elite 2 Wireless */
175 if (pid
== 0x0b12) return TRUE
; /* Xbox Series */
176 if (pid
== 0x0b13) return TRUE
; /* Xbox Series Wireless */
177 if (pid
== 0x0719) return TRUE
; /* Xbox 360 Wireless Adapter */
181 static inline BOOL
is_dualshock4_gamepad(WORD vid
, WORD pid
)
183 if (vid
!= 0x054c) return FALSE
;
184 if (pid
== 0x05c4) return TRUE
; /* DualShock 4 [CUH-ZCT1x] */
185 if (pid
== 0x09cc) return TRUE
; /* DualShock 4 [CUH-ZCT2x] */
186 if (pid
== 0x0ba0) return TRUE
; /* Dualshock 4 Wireless Adaptor */
190 static inline BOOL
is_dualsense_gamepad(WORD vid
, WORD pid
)
192 if (vid
!= 0x054c) return FALSE
;
193 if (pid
== 0x0ce6) return TRUE
; /* DualSense */
194 if (pid
== 0x0df2) return TRUE
; /* DualSense Edge */
198 #endif /* __WINEBUS_UNIXLIB_H */