include: Add STORAGE_HOTPLUG_INFO structure.
[wine.git] / dlls / winebus.sys / unixlib.h
blob753886304db9a5ebc0ddad815ec885487a21101d
1 /*
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
22 #include <stdarg.h>
24 #include <windef.h>
25 #include <winbase.h>
26 #include <winternl.h>
27 #include <ddk/hidclass.h>
28 #include <ddk/hidpi.h>
29 #include <hidusage.h>
31 #include "wine/debug.h"
32 #include "wine/list.h"
34 struct device_desc
36 UINT vid;
37 UINT pid;
38 UINT version;
39 UINT input;
40 UINT uid;
41 USAGE_AND_PAGE usages;
42 BOOL is_gamepad;
43 BOOL is_hidraw;
45 WCHAR manufacturer[MAX_PATH];
46 WCHAR product[MAX_PATH];
47 WCHAR serialnumber[MAX_PATH];
50 struct sdl_bus_options
52 BOOL split_controllers;
53 BOOL map_controllers;
54 /* freed after bus_init */
55 UINT mappings_count;
56 char **mappings;
59 struct udev_bus_options
61 BOOL disable_hidraw;
62 BOOL disable_input;
63 BOOL disable_udevd;
66 struct iohid_bus_options
70 enum bus_event_type
72 BUS_EVENT_TYPE_NONE,
73 BUS_EVENT_TYPE_DEVICE_REMOVED,
74 BUS_EVENT_TYPE_DEVICE_CREATED,
75 BUS_EVENT_TYPE_INPUT_REPORT,
78 struct bus_event
80 UINT type;
81 UINT64 device;
82 union
84 struct
86 struct device_desc desc;
87 } device_created;
89 struct
91 USHORT length;
92 BYTE buffer[1];
93 } input_report;
97 struct device_create_params
99 struct device_desc desc;
100 UINT64 device;
103 struct device_remove_params
105 UINT64 device;
108 struct device_start_params
110 UINT64 device;
113 struct device_descriptor_params
115 UINT64 device;
116 BYTE *buffer;
117 UINT length;
118 UINT *out_length;
121 struct device_report_params
123 UINT64 device;
124 HID_XFER_PACKET *packet;
125 IO_STATUS_BLOCK *io;
128 enum unix_funcs
130 sdl_init,
131 sdl_wait,
132 sdl_stop,
133 udev_init,
134 udev_wait,
135 udev_stop,
136 iohid_init,
137 iohid_wait,
138 iohid_stop,
139 mouse_create,
140 keyboard_create,
141 device_remove,
142 device_start,
143 device_get_report_descriptor,
144 device_set_output_report,
145 device_get_feature_report,
146 device_set_feature_report,
147 unix_funcs_count,
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 */
178 return FALSE;
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 */
187 return FALSE;
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 */
195 return FALSE;
198 #endif /* __WINEBUS_UNIXLIB_H */