Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/unixlib.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index 929997f1aa7..6b6a2595ca0 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -143,6 +143,8 @@ 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, + .vid = 0x845e, + .pid = 0x0001, .input = -1, .manufacturer = {"The Wine Project"}, .product = {"Wine HID mouse"}, @@ -241,6 +243,8 @@ static const WCHAR keyboard_bus_id[] = {'W','I','N','E','K','E','Y','B','O','A', static const struct device_desc keyboard_device_desc = { .busid = keyboard_bus_id, + .vid = 0x845e, + .pid = 0x0002, .input = -1, .manufacturer = {"The Wine Project"}, .product = {"Wine HID keyboard"},
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index d3f40806e73..92a41e4d8ef 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -209,15 +209,19 @@ static WCHAR *get_instance_id(DEVICE_OBJECT *device) static WCHAR *get_device_id(DEVICE_OBJECT *device) { static const WCHAR input_format[] = L"&MI_%02u"; - static const WCHAR format[] = L"%s\vid_%04x&pid_%04x"; + static const WCHAR winebus_format[] = L"WINEBUS\VID_%04X&PID_%04X"; struct device_extension *ext = (struct device_extension *)device->DeviceExtension; - DWORD pos = 0, len = wcslen(ext->desc.busid) + 34; + DWORD pos = 0, len = 0, input_len = 0, winebus_len = 25; WCHAR *dst;
+ if (ext->desc.input != -1) input_len = 14; + + len += winebus_len + input_len + 1; + if ((dst = ExAllocatePool(PagedPool, len * sizeof(WCHAR)))) { - pos += swprintf(dst + pos, len - pos, format, ext->desc.busid, ext->desc.vid, ext->desc.pid); - if (ext->desc.input != -1) pos += swprintf(dst + pos, len - pos, input_format, ext->desc.input); + pos += swprintf(dst + pos, len - pos, winebus_format, ext->desc.vid, ext->desc.pid); + if (input_len) pos += swprintf(dst + pos, len - pos, input_format, ext->desc.input); }
return dst;
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/main.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 92a41e4d8ef..0fd7a405f80 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -229,13 +229,22 @@ static WCHAR *get_device_id(DEVICE_OBJECT *device)
static WCHAR *get_hardware_ids(DEVICE_OBJECT *device) { + static const WCHAR input_format[] = L"&MI_%02u"; + static const WCHAR winebus_format[] = L"WINEBUS\VID_%04X&PID_%04X"; struct device_extension *ext = (struct device_extension *)device->DeviceExtension; + DWORD pos = 0, len = 0, input_len = 0, winebus_len = 25; WCHAR *dst;
- if ((dst = ExAllocatePool(PagedPool, (wcslen(ext->desc.busid) + 2) * sizeof(WCHAR)))) + if (ext->desc.input != -1) input_len = 14; + + len += winebus_len + input_len + 1; + + if ((dst = ExAllocatePool(PagedPool, (len + 1) * sizeof(WCHAR)))) { - wcscpy(dst, ext->desc.busid); - dst[wcslen(dst) + 1] = 0; + pos += swprintf(dst + pos, len - pos, winebus_format, ext->desc.vid, ext->desc.pid); + if (input_len) pos += swprintf(dst + pos, len - pos, input_format, ext->desc.input); + pos += 1; + dst[pos] = 0; }
return dst;
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/bus_iohid.c | 3 --- dlls/winebus.sys/bus_sdl.c | 2 -- dlls/winebus.sys/bus_udev.c | 6 ------ dlls/winebus.sys/main.c | 2 +- dlls/winebus.sys/unixlib.c | 4 ---- dlls/winebus.sys/unixlib.h | 6 ++---- 6 files changed, 3 insertions(+), 20 deletions(-)
diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index 15f37dd2188..220dae92496 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -106,8 +106,6 @@ static IOHIDManagerRef hid_manager; static CFRunLoopRef run_loop; static struct list event_queue = LIST_INIT(event_queue); static struct list device_list = LIST_INIT(device_list); - -static const WCHAR busidW[] = {'I','O','H','I','D',0}; static struct iohid_bus_options options;
struct platform_private @@ -273,7 +271,6 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void * { struct device_desc desc = { - .busid = busidW, .input = -1, .serialnumber = {"0000"}, }; diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index a446eb77375..b7734b4016e 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -65,7 +65,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(plugplay); WINE_DECLARE_DEBUG_CHANNEL(hid_report);
static pthread_mutex_t sdl_cs = PTHREAD_MUTEX_INITIALIZER; -static const WCHAR sdl_busidW[] = {'S','D','L','J','O','Y',0}; static struct sdl_bus_options options;
static void *sdl_handle = NULL; @@ -712,7 +711,6 @@ static void sdl_add_device(unsigned int index) { struct device_desc desc = { - .busid = sdl_busidW, .input = -1, .manufacturer = {"SDL"}, .serialnumber = {"0000"}, diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index cd9b065e56b..1c1b7da78cf 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -100,9 +100,6 @@ static struct udev_monitor *udev_monitor; static int deviceloop_control[2]; static struct list event_queue = LIST_INIT(event_queue); static struct list device_list = LIST_INIT(device_list); - -static const WCHAR hidraw_busidW[] = {'H','I','D','R','A','W',0}; -static const WCHAR lnxev_busidW[] = {'L','N','X','E','V',0}; static struct udev_bus_options options;
struct platform_private @@ -985,7 +982,6 @@ static void udev_add_device(struct udev_device *dev) subsystem = udev_device_get_subsystem(dev); if (!strcmp(subsystem, "hidraw")) { - desc.busid = hidraw_busidW; if (!desc.manufacturer[0]) strcpy(desc.manufacturer, "hidraw");
#ifdef HAVE_LINUX_HIDRAW_H @@ -998,8 +994,6 @@ static void udev_add_device(struct udev_device *dev) { struct input_id device_id = {0};
- desc.busid = lnxev_busidW; - if (ioctl(fd, EVIOCGID, &device_id) < 0) WARN("ioctl(EVIOCGID) failed: %d %s\n", errno, strerror(errno)); else diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 0fd7a405f80..ffe54fcbf87 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -294,7 +294,7 @@ static DEVICE_OBJECT *bus_create_hid_device(struct device_desc *desc, struct uni
TRACE("desc %s, unix_device %p\n", debugstr_device_desc(desc), unix_device);
- swprintf(dev_name, ARRAY_SIZE(dev_name), L"\Device\%s#%p", desc->busid, unix_device); + swprintf(dev_name, ARRAY_SIZE(dev_name), L"\Device\WINEBUS#%p", unix_device); RtlInitUnicodeString(&nameW, dev_name); status = IoCreateDevice(driver_obj, sizeof(struct device_extension), &nameW, 0, 0, FALSE, &device); if (status) diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index 6b6a2595ca0..893296e8ebb 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -139,10 +139,8 @@ static const struct unix_device_vtbl mouse_vtbl = 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, .vid = 0x845e, .pid = 0x0001, .input = -1, @@ -239,10 +237,8 @@ static const struct unix_device_vtbl keyboard_vtbl = 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, .vid = 0x845e, .pid = 0x0002, .input = -1, diff --git a/dlls/winebus.sys/unixlib.h b/dlls/winebus.sys/unixlib.h index a088cb1266b..317599571c2 100644 --- a/dlls/winebus.sys/unixlib.h +++ b/dlls/winebus.sys/unixlib.h @@ -32,7 +32,6 @@
struct device_desc { - const WCHAR *busid; DWORD vid; DWORD pid; DWORD version; @@ -139,9 +138,8 @@ enum unix_funcs 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, is_gamepad %u}", - debugstr_w(desc->busid), desc->vid, desc->pid, desc->version, - desc->input, desc->uid, desc->is_gamepad); + return wine_dbg_sprintf("{vid %04x, pid %04x, version %04x, input %d, uid %08x, is_gamepad %u}", + desc->vid, desc->pid, desc->version, desc->input, desc->uid, desc->is_gamepad); }
#endif /* __WINEBUS_UNIXLIB_H */
As in https://bugs.winehq.org/show_bug.cgi?id=47751, the .text directive sometimes makes the global variables go in the wrong section.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
Reported by Bernhard Übelacker, non-mingw builds are crashing in RtlEnterCriticalSection(&device_list_cs), and this is possibly related, according to 0c853f026578dd7c8aede2f716c8e55d816ccf40, although I didn't reproduce the problem.
dlls/winebus.sys/main.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index ffe54fcbf87..b5130a7908e 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -41,23 +41,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(plugplay); WINE_DECLARE_DEBUG_CHANNEL(hid_report);
-#if defined(__i386__) && !defined(_WIN32) - -extern void * WINAPI wrap_fastcall_func1( void *func, const void *a ); -__ASM_STDCALL_FUNC( wrap_fastcall_func1, 8, - "popl %ecx\n\t" - "popl %eax\n\t" - "xchgl (%esp),%ecx\n\t" - "jmp *%eax" ); - -#define call_fastcall_func1(func,a) wrap_fastcall_func1(func,a) - -#else - -#define call_fastcall_func1(func,a) func(a) - -#endif - static DRIVER_OBJECT *driver_obj;
static DEVICE_OBJECT *mouse_obj; @@ -359,6 +342,18 @@ static void bus_unlink_hid_device(DEVICE_OBJECT *device) RtlLeaveCriticalSection(&device_list_cs); }
+#if defined(__i386__) && !defined(_WIN32) +extern void * WINAPI wrap_fastcall_func1(void *func, const void *a); +__ASM_STDCALL_FUNC(wrap_fastcall_func1, 8, + "popl %ecx\n\t" + "popl %eax\n\t" + "xchgl (%esp),%ecx\n\t" + "jmp *%eax"); +#define call_fastcall_func1(func,a) wrap_fastcall_func1(func,a) +#else +#define call_fastcall_func1(func,a) func(a) +#endif + static NTSTATUS build_device_relations(DEVICE_RELATIONS **devices) { struct device_extension *ext;