Commit 08f943b5 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winebus.sys: Create devices using a struct device_desc descriptor.

parent f299b427
...@@ -45,9 +45,8 @@ typedef struct ...@@ -45,9 +45,8 @@ typedef struct
struct unix_device *get_unix_device(DEVICE_OBJECT *device) DECLSPEC_HIDDEN; struct unix_device *get_unix_device(DEVICE_OBJECT *device) DECLSPEC_HIDDEN;
/* HID Plug and Play Bus */ /* HID Plug and Play Bus */
DEVICE_OBJECT *bus_create_hid_device(const WCHAR *busidW, WORD vid, WORD pid, WORD input, DEVICE_OBJECT *bus_create_hid_device(struct device_desc *desc, const platform_vtbl *vtbl,
DWORD version, DWORD uid, const WCHAR *serialW, BOOL is_gamepad, struct unix_device *unix_device) DECLSPEC_HIDDEN;
const platform_vtbl *vtbl, struct unix_device *unix_device) DECLSPEC_HIDDEN;
DEVICE_OBJECT *bus_find_hid_device(const WCHAR *bus_id, void *platform_dev) DECLSPEC_HIDDEN; DEVICE_OBJECT *bus_find_hid_device(const WCHAR *bus_id, void *platform_dev) DECLSPEC_HIDDEN;
void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length) DECLSPEC_HIDDEN; void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length) DECLSPEC_HIDDEN;
DEVICE_OBJECT *bus_enumerate_hid_devices(const WCHAR *bus_id, enum_func function, void *context) DECLSPEC_HIDDEN; DEVICE_OBJECT *bus_enumerate_hid_devices(const WCHAR *bus_id, enum_func function, void *context) DECLSPEC_HIDDEN;
......
...@@ -294,25 +294,26 @@ static const platform_vtbl iohid_vtbl = ...@@ -294,25 +294,26 @@ static const platform_vtbl iohid_vtbl =
static void handle_DeviceMatchingCallback(void *context, IOReturn result, void *sender, IOHIDDeviceRef IOHIDDevice) static void handle_DeviceMatchingCallback(void *context, IOReturn result, void *sender, IOHIDDeviceRef IOHIDDevice)
{ {
struct device_desc desc =
{
.busid = busidW,
.input = -1,
.serial = {'0','0','0','0',0},
};
struct platform_private *private; struct platform_private *private;
DEVICE_OBJECT *device; DEVICE_OBJECT *device;
DWORD vid, pid, version, uid;
CFStringRef str = NULL; CFStringRef str = NULL;
WCHAR serial_string[256];
BOOL is_gamepad = FALSE;
TRACE("OS/X IOHID Device Added %p\n", IOHIDDevice);
vid = CFNumberToDWORD(IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDVendorIDKey))); desc.vid = CFNumberToDWORD(IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDVendorIDKey)));
pid = CFNumberToDWORD(IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDProductIDKey))); desc.pid = CFNumberToDWORD(IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDProductIDKey)));
version = CFNumberToDWORD(IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDVersionNumberKey))); desc.version = CFNumberToDWORD(IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDVersionNumberKey)));
str = IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDSerialNumberKey)); str = IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDSerialNumberKey));
if (str) CFStringToWSTR(str, serial_string, ARRAY_SIZE(serial_string)); if (str) CFStringToWSTR(str, desc.serial, ARRAY_SIZE(desc.serial));
uid = CFNumberToDWORD(IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDLocationIDKey))); desc.uid = CFNumberToDWORD(IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDLocationIDKey)));
if (IOHIDDeviceOpen(IOHIDDevice, 0) != kIOReturnSuccess) if (IOHIDDeviceOpen(IOHIDDevice, 0) != kIOReturnSuccess)
{ {
ERR("Failed to open HID device %p (vid %04x, pid %04x)\n", IOHIDDevice, vid, pid); ERR("Failed to open HID device %p (vid %04x, pid %04x)\n", IOHIDDevice, desc.vid, desc.pid);
return; return;
} }
IOHIDDeviceScheduleWithRunLoop(IOHIDDevice, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); IOHIDDeviceScheduleWithRunLoop(IOHIDDevice, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
...@@ -320,8 +321,8 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void * ...@@ -320,8 +321,8 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void *
if (IOHIDDeviceConformsTo(IOHIDDevice, kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad) || if (IOHIDDeviceConformsTo(IOHIDDevice, kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad) ||
IOHIDDeviceConformsTo(IOHIDDevice, kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick)) IOHIDDeviceConformsTo(IOHIDDevice, kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick))
{ {
if (is_xbox_gamepad(vid, pid)) if (is_xbox_gamepad(desc.vid, desc.pid))
is_gamepad = TRUE; desc.is_gamepad = TRUE;
else else
{ {
int axes=0, buttons=0; int axes=0, buttons=0;
...@@ -358,15 +359,16 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void * ...@@ -358,15 +359,16 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void *
} }
CFRelease(element_array); CFRelease(element_array);
} }
is_gamepad = (axes == 6 && buttons >= 14); desc.is_gamepad = (axes == 6 && buttons >= 14);
} }
} }
TRACE("dev %p, desc %s.\n", IOHIDDevice, debugstr_device_desc(&desc));
if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct platform_private)))) if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct platform_private))))
return; return;
device = bus_create_hid_device(busidW, vid, pid, -1, version, uid, str ? serial_string : NULL, device = bus_create_hid_device(&desc, &iohid_vtbl, &private->unix_device);
is_gamepad, &iohid_vtbl, &private->unix_device);
if (!device) HeapFree(GetProcessHeap(), 0, private); if (!device) HeapFree(GetProcessHeap(), 0, private);
else else
{ {
......
...@@ -731,14 +731,17 @@ static BOOL set_mapped_report_from_event(DEVICE_OBJECT *device, SDL_Event *event ...@@ -731,14 +731,17 @@ static BOOL set_mapped_report_from_event(DEVICE_OBJECT *device, SDL_Event *event
return FALSE; return FALSE;
} }
static void try_add_device(unsigned int index) static void sdl_add_device(unsigned int index)
{ {
DWORD vid = 0, pid = 0, version = 0; struct device_desc desc =
{
.busid = sdl_busidW,
.input = -1,
.serial = {'0','0','0','0',0},
};
struct platform_private *private; struct platform_private *private;
DEVICE_OBJECT *device = NULL; DEVICE_OBJECT *device = NULL;
WCHAR serial[34] = {0};
char guid_str[34]; char guid_str[34];
BOOL is_xbox_gamepad;
SDL_Joystick* joystick; SDL_Joystick* joystick;
SDL_JoystickID id; SDL_JoystickID id;
...@@ -757,43 +760,36 @@ static void try_add_device(unsigned int index) ...@@ -757,43 +760,36 @@ static void try_add_device(unsigned int index)
id = pSDL_JoystickInstanceID(joystick); id = pSDL_JoystickInstanceID(joystick);
if (pSDL_JoystickGetProductVersion != NULL) { if (pSDL_JoystickGetProductVersion != NULL) {
vid = pSDL_JoystickGetVendor(joystick); desc.vid = pSDL_JoystickGetVendor(joystick);
pid = pSDL_JoystickGetProduct(joystick); desc.pid = pSDL_JoystickGetProduct(joystick);
version = pSDL_JoystickGetProductVersion(joystick); desc.version = pSDL_JoystickGetProductVersion(joystick);
} }
else else
{ {
vid = 0x01; desc.vid = 0x01;
pid = pSDL_JoystickInstanceID(joystick) + 1; desc.pid = pSDL_JoystickInstanceID(joystick) + 1;
version = 0; desc.version = 0;
} }
guid = pSDL_JoystickGetGUID(joystick); guid = pSDL_JoystickGetGUID(joystick);
pSDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str)); pSDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
MultiByteToWideChar(CP_ACP, 0, guid_str, -1, serial, sizeof(guid_str)); MultiByteToWideChar(CP_ACP, 0, guid_str, -1, desc.serial, sizeof(guid_str));
if (controller) if (controller) desc.is_gamepad = TRUE;
{
TRACE("Found sdl game controller %i (vid %04x, pid %04x, version %u, serial %s)\n",
id, vid, pid, version, debugstr_w(serial));
is_xbox_gamepad = TRUE;
}
else else
{ {
int button_count, axis_count; int button_count, axis_count;
TRACE("Found sdl device %i (vid %04x, pid %04x, version %u, serial %s)\n",
id, vid, pid, version, debugstr_w(serial));
axis_count = pSDL_JoystickNumAxes(joystick); axis_count = pSDL_JoystickNumAxes(joystick);
button_count = pSDL_JoystickNumButtons(joystick); button_count = pSDL_JoystickNumButtons(joystick);
is_xbox_gamepad = (axis_count == 6 && button_count >= 14); desc.is_gamepad = (axis_count == 6 && button_count >= 14);
} }
TRACE("%s id %d, desc %s.\n", controller ? "controller" : "joystick", id, debugstr_device_desc(&desc));
if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*private)))) return; if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*private)))) return;
device = bus_create_hid_device(sdl_busidW, vid, pid, -1, version, index, serial, is_xbox_gamepad, device = bus_create_hid_device(&desc, &sdl_vtbl, &private->unix_device);
&sdl_vtbl, &private->unix_device);
if (!device) HeapFree(GetProcessHeap(), 0, private); if (!device) HeapFree(GetProcessHeap(), 0, private);
else else
{ {
...@@ -812,7 +808,7 @@ static void process_device_event(SDL_Event *event) ...@@ -812,7 +808,7 @@ static void process_device_event(SDL_Event *event)
TRACE_(hid_report)("Received action %x\n", event->type); TRACE_(hid_report)("Received action %x\n", event->type);
if (event->type == SDL_JOYDEVICEADDED) if (event->type == SDL_JOYDEVICEADDED)
try_add_device(((SDL_JoyDeviceEvent*)event)->which); sdl_add_device(((SDL_JoyDeviceEvent *)event)->which);
else if (event->type == SDL_JOYDEVICEREMOVED) else if (event->type == SDL_JOYDEVICEREMOVED)
{ {
id = ((SDL_JoyDeviceEvent *)event)->which; id = ((SDL_JoyDeviceEvent *)event)->which;
......
...@@ -1014,8 +1014,7 @@ static int check_device_syspath(DEVICE_OBJECT *device, void* context) ...@@ -1014,8 +1014,7 @@ static int check_device_syspath(DEVICE_OBJECT *device, void* context)
return strcmp(get_device_syspath(private->udev_device), context); return strcmp(get_device_syspath(private->udev_device), context);
} }
static void get_device_subsystem_info(struct udev_device *dev, char const *subsystem, DWORD *vendor_id, static void get_device_subsystem_info(struct udev_device *dev, char const *subsystem, struct device_desc *desc)
DWORD *product_id, DWORD *input, DWORD *version, WCHAR **serial_number)
{ {
struct udev_device *parent = NULL; struct udev_device *parent = NULL;
const char *ptr, *next, *tmp; const char *ptr, *next, *tmp;
...@@ -1035,41 +1034,42 @@ static void get_device_subsystem_info(struct udev_device *dev, char const *subsy ...@@ -1035,41 +1034,42 @@ static void get_device_subsystem_info(struct udev_device *dev, char const *subsy
if (!strncmp(ptr, "HID_UNIQ=", 9)) if (!strncmp(ptr, "HID_UNIQ=", 9))
{ {
if (sscanf(ptr, "HID_UNIQ=%256s\n", buffer) != 1 || !*buffer) continue; if (sscanf(ptr, "HID_UNIQ=%256s\n", buffer) != 1 || !*buffer) continue;
if (!*serial_number) *serial_number = strdupAtoW(buffer); if (!desc->serial[0]) MultiByteToWideChar(CP_UNIXCP, 0, buffer, -1, desc->serial, ARRAY_SIZE(desc->serial));
} }
if (!strncmp(ptr, "HID_PHYS=", 9) || !strncmp(ptr, "PHYS=\"", 6)) if (!strncmp(ptr, "HID_PHYS=", 9) || !strncmp(ptr, "PHYS=\"", 6))
{ {
if (!(tmp = strstr(ptr, "/input")) || tmp >= next) continue; if (!(tmp = strstr(ptr, "/input")) || tmp >= next) continue;
if (*input == -1) sscanf(tmp, "/input%d\n", input); if (desc->input == -1) sscanf(tmp, "/input%d\n", &desc->input);
} }
if (!strncmp(ptr, "HID_ID=", 7)) if (!strncmp(ptr, "HID_ID=", 7))
{ {
if (bus || *vendor_id || *product_id) continue; if (bus || desc->vid || desc->pid) continue;
sscanf(ptr, "HID_ID=%x:%x:%x\n", &bus, vendor_id, product_id); sscanf(ptr, "HID_ID=%x:%x:%x\n", &bus, &desc->vid, &desc->pid);
} }
if (!strncmp(ptr, "PRODUCT=", 8)) if (!strncmp(ptr, "PRODUCT=", 8))
{ {
if (*version) continue; if (desc->version) continue;
if (!strcmp(subsystem, "usb")) if (!strcmp(subsystem, "usb"))
sscanf(ptr, "PRODUCT=%x/%x/%x\n", vendor_id, product_id, version); sscanf(ptr, "PRODUCT=%x/%x/%x\n", &desc->vid, &desc->pid, &desc->version);
else else
sscanf(ptr, "PRODUCT=%x/%x/%x/%x\n", &bus, vendor_id, product_id, version); sscanf(ptr, "PRODUCT=%x/%x/%x/%x\n", &bus, &desc->vid, &desc->pid, &desc->version);
} }
} }
} }
} }
static void try_add_device(struct udev_device *dev) static void udev_add_device(struct udev_device *dev)
{ {
DWORD vid = 0, pid = 0, version = 0, input = -1; static const WCHAR base_serial[] = {'0','0','0','0',0};
struct device_desc desc =
{
.input = -1,
};
struct platform_private *private; struct platform_private *private;
DEVICE_OBJECT *device = NULL; DEVICE_OBJECT *device = NULL;
const char *subsystem; const char *subsystem;
const char *devnode; const char *devnode;
WCHAR *serial = NULL;
BOOL is_gamepad = FALSE;
int fd; int fd;
static const CHAR *base_serial = "0000";
if (!(devnode = udev_device_get_devnode(dev))) if (!(devnode = udev_device_get_devnode(dev)))
return; return;
...@@ -1093,55 +1093,59 @@ static void try_add_device(struct udev_device *dev) ...@@ -1093,55 +1093,59 @@ static void try_add_device(struct udev_device *dev)
} }
#endif #endif
get_device_subsystem_info(dev, "hid", &vid, &pid, &input, &version, &serial); get_device_subsystem_info(dev, "hid", &desc);
get_device_subsystem_info(dev, "input", &vid, &pid, &input, &version, &serial); get_device_subsystem_info(dev, "input", &desc);
get_device_subsystem_info(dev, "usb", &vid, &pid, &input, &version, &serial); get_device_subsystem_info(dev, "usb", &desc);
subsystem = udev_device_get_subsystem(dev); subsystem = udev_device_get_subsystem(dev);
if (!strcmp(subsystem, "hidraw"))
{
desc.busid = hidraw_busidW;
}
#ifdef HAS_PROPER_INPUT_HEADER #ifdef HAS_PROPER_INPUT_HEADER
if (!strcmp(subsystem, "input")) else if (!strcmp(subsystem, "input"))
{ {
struct input_id device_id = {0}; struct input_id device_id = {0};
char device_uid[255]; char device_uid[255];
desc.busid = lnxev_busidW;
if (ioctl(fd, EVIOCGID, &device_id) < 0) if (ioctl(fd, EVIOCGID, &device_id) < 0)
WARN("ioctl(EVIOCGID) failed: %d %s\n", errno, strerror(errno)); WARN("ioctl(EVIOCGID) failed: %d %s\n", errno, strerror(errno));
else else
{ {
vid = device_id.vendor; desc.vid = device_id.vendor;
pid = device_id.product; desc.pid = device_id.product;
version = device_id.version; desc.version = device_id.version;
} }
device_uid[0] = 0; device_uid[0] = 0;
if (ioctl(fd, EVIOCGUNIQ(254), device_uid) >= 0 && device_uid[0]) if (ioctl(fd, EVIOCGUNIQ(254), device_uid) >= 0 && device_uid[0])
serial = strdupAtoW(device_uid); MultiByteToWideChar(CP_UNIXCP, 0, device_uid, -1, desc.serial, ARRAY_SIZE(desc.serial));
} }
#endif #endif
if (serial == NULL) serial = strdupAtoW(base_serial); if (!desc.serial[0]) lstrcpyW(desc.serial, base_serial);
if (is_xbox_gamepad(vid, pid)) if (is_xbox_gamepad(desc.vid, desc.pid))
is_gamepad = TRUE; desc.is_gamepad = TRUE;
#ifdef HAS_PROPER_INPUT_HEADER #ifdef HAS_PROPER_INPUT_HEADER
else else
{ {
int axes=0, buttons=0; int axes=0, buttons=0;
axes = count_abs_axis(fd); axes = count_abs_axis(fd);
buttons = count_buttons(fd, NULL); buttons = count_buttons(fd, NULL);
is_gamepad = (axes == 6 && buttons >= 14); desc.is_gamepad = (axes == 6 && buttons >= 14);
} }
#endif #endif
TRACE("Found udev device %s (vid %04x, pid %04x, version %04x, input %d, serial %s)\n", TRACE("dev %p, node %s, desc %s.\n", dev, debugstr_a(devnode), debugstr_device_desc(&desc));
debugstr_a(devnode), vid, pid, version, input, debugstr_w(serial));
if (strcmp(subsystem, "hidraw") == 0) if (strcmp(subsystem, "hidraw") == 0)
{ {
if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct platform_private)))) if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct platform_private))))
return; return;
device = bus_create_hid_device(hidraw_busidW, vid, pid, input, version, 0, serial, device = bus_create_hid_device(&desc, &hidraw_vtbl, &private->unix_device);
is_gamepad, &hidraw_vtbl, &private->unix_device);
if (!device) HeapFree(GetProcessHeap(), 0, private); if (!device) HeapFree(GetProcessHeap(), 0, private);
} }
#ifdef HAS_PROPER_INPUT_HEADER #ifdef HAS_PROPER_INPUT_HEADER
...@@ -1149,8 +1153,7 @@ static void try_add_device(struct udev_device *dev) ...@@ -1149,8 +1153,7 @@ static void try_add_device(struct udev_device *dev)
{ {
if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct wine_input_private)))) if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct wine_input_private))))
return; return;
device = bus_create_hid_device(lnxev_busidW, vid, pid, input, version, 0, serial, device = bus_create_hid_device(&desc, &lnxev_vtbl, &private->unix_device);
is_gamepad, &lnxev_vtbl, &private->unix_device);
if (!device) HeapFree(GetProcessHeap(), 0, private); if (!device) HeapFree(GetProcessHeap(), 0, private);
} }
#endif #endif
...@@ -1166,8 +1169,6 @@ static void try_add_device(struct udev_device *dev) ...@@ -1166,8 +1169,6 @@ static void try_add_device(struct udev_device *dev)
WARN("Ignoring device %s with subsystem %s\n", debugstr_a(devnode), subsystem); WARN("Ignoring device %s with subsystem %s\n", debugstr_a(devnode), subsystem);
close(fd); close(fd);
} }
HeapFree(GetProcessHeap(), 0, serial);
} }
static void try_remove_device(struct udev_device *dev) static void try_remove_device(struct udev_device *dev)
...@@ -1213,7 +1214,7 @@ static void build_initial_deviceset(void) ...@@ -1213,7 +1214,7 @@ static void build_initial_deviceset(void)
path = udev_list_entry_get_name(dev_list_entry); path = udev_list_entry_get_name(dev_list_entry);
if ((dev = udev_device_new_from_syspath(udev_context, path))) if ((dev = udev_device_new_from_syspath(udev_context, path)))
{ {
try_add_device(dev); udev_add_device(dev);
udev_device_unref(dev); udev_device_unref(dev);
} }
} }
...@@ -1286,7 +1287,7 @@ static void process_monitor_event(struct udev_monitor *monitor) ...@@ -1286,7 +1287,7 @@ static void process_monitor_event(struct udev_monitor *monitor)
if (!action) if (!action)
WARN("No action received\n"); WARN("No action received\n");
else if (strcmp(action, "add") == 0) else if (strcmp(action, "add") == 0)
try_add_device(dev); udev_add_device(dev);
else if (strcmp(action, "remove") == 0) else if (strcmp(action, "remove") == 0)
try_remove_device(dev); try_remove_device(dev);
else else
......
...@@ -108,11 +108,19 @@ const platform_vtbl mouse_vtbl = ...@@ -108,11 +108,19 @@ const platform_vtbl mouse_vtbl =
.set_feature_report = mouse_set_feature_report, .set_feature_report = mouse_set_feature_report,
}; };
static const WCHAR mouse_bus_id[] = {'W','I','N','E','M','O','U','S','E',0};
static const struct device_desc mouse_device_desc =
{
.busid = mouse_bus_id,
.input = -1,
.serial = {'0','0','0','0',0},
};
static struct unix_device mouse_device; static struct unix_device mouse_device;
static NTSTATUS mouse_device_create(void *args) static NTSTATUS mouse_device_create(void *args)
{ {
struct device_create_params *params = args; struct device_create_params *params = args;
params->desc = mouse_device_desc;
params->device = &mouse_device; params->device = &mouse_device;
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
...@@ -187,11 +195,19 @@ const platform_vtbl keyboard_vtbl = ...@@ -187,11 +195,19 @@ const platform_vtbl keyboard_vtbl =
.set_feature_report = keyboard_set_feature_report, .set_feature_report = keyboard_set_feature_report,
}; };
static const WCHAR keyboard_bus_id[] = {'W','I','N','E','K','E','Y','B','O','A','R','D',0};
static const struct device_desc keyboard_device_desc =
{
.busid = keyboard_bus_id,
.input = -1,
.serial = {'0','0','0','0',0},
};
static struct unix_device keyboard_device; static struct unix_device keyboard_device;
static NTSTATUS keyboard_device_create(void *args) static NTSTATUS keyboard_device_create(void *args)
{ {
struct device_create_params *params = args; struct device_create_params *params = args;
params->desc = keyboard_device_desc;
params->device = &keyboard_device; params->device = &keyboard_device;
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
......
...@@ -27,9 +27,22 @@ ...@@ -27,9 +27,22 @@
#include <ddk/wdm.h> #include <ddk/wdm.h>
#include <hidusage.h> #include <hidusage.h>
#include "wine/debug.h"
#include "wine/list.h" #include "wine/list.h"
#include "wine/unixlib.h" #include "wine/unixlib.h"
struct device_desc
{
const WCHAR *busid;
DWORD vid;
DWORD pid;
DWORD version;
DWORD input;
DWORD uid;
WCHAR serial[256];
BOOL is_gamepad;
};
struct sdl_bus_options struct sdl_bus_options
{ {
BOOL map_controllers; BOOL map_controllers;
...@@ -70,6 +83,7 @@ struct bus_event ...@@ -70,6 +83,7 @@ struct bus_event
struct device_create_params struct device_create_params
{ {
struct device_desc desc;
struct unix_device *device; struct unix_device *device;
}; };
...@@ -90,4 +104,12 @@ enum unix_funcs ...@@ -90,4 +104,12 @@ enum unix_funcs
extern const unixlib_entry_t __wine_unix_call_funcs[] DECLSPEC_HIDDEN; extern const unixlib_entry_t __wine_unix_call_funcs[] DECLSPEC_HIDDEN;
static inline const char *debugstr_device_desc(struct device_desc *desc)
{
if (!desc) return "(null)";
return wine_dbg_sprintf("{busid %s, vid %04x, pid %04x, version %04x, input %d, uid %08x, serial %s, is_gamepad %u}",
debugstr_w(desc->busid), desc->vid, desc->pid, desc->version,
desc->input, desc->uid, debugstr_w(desc->serial), desc->is_gamepad);
}
#endif /* __WINEBUS_UNIXLIB_H */ #endif /* __WINEBUS_UNIXLIB_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment