Commit Graph

196 Commits

Author SHA1 Message Date
Rémi Bernon 1f12b2160d winebus.sys: Free unix device in unix_device_remove.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-14 11:50:01 +02:00
Rémi Bernon bf1446523c winebus.sys: Allocate mouse and keyboard devices dynamically.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-14 11:49:59 +02:00
Rémi Bernon b86eade743 winebus.sys: Use helpers to create and destroy unix devices.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-14 11:49:57 +02:00
Rémi Bernon cd830398dd winebus.sys: Split destroy to a separate stop method.
So we can stop the device when it's removed from the ntoskrnl.exe device
list, and then destroy it only when it's not referenced anymore.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-14 11:49:55 +02:00
Rémi Bernon 56a4aaf419 winebus.sys: Remove the now useless get_string callback.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-13 21:12:39 +02:00
Rémi Bernon ff0d402efa winebus.sys: Query serialnumber string on device creation.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-13 21:12:36 +02:00
Rémi Bernon 093c13e333 winebus.sys: Query product string on device creation.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-13 21:12:34 +02:00
Rémi Bernon 9d4b70473c winebus.sys: Query manufacturer string on device creation.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-13 21:12:32 +02:00
Rémi Bernon e4f0b4ab8a winebus.sys: Remove the now useless native product strings.
This should now be handled by winexinput.sys.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-13 21:12:30 +02:00
Rémi Bernon 83f0de4487 winebus.sys: Return an event from IOHID bus wait on device creation.
Instead of calling bus_create_hid_device.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-08 20:40:56 +02:00
Rémi Bernon f7be0f5edf winebus.sys: Return an event from UDEV bus wait on device creation.
And queued events generated from initial device enumeration.

Instead of calling bus_create_hid_device.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-08 20:40:52 +02:00
Rémi Bernon 507a3076de winebus.sys: Return an event from SDL bus wait on device creation.
Instead of calling bus_create_hid_device.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-08 20:40:48 +02:00
Rémi Bernon 60740e8745 winebus.sys: Remove the now useless bus_enumerate_hid_devices.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 21:43:04 +02:00
Rémi Bernon 6ce5ba8f2f winebus.sys: Look for duplicate UDEV devices on the unix side.
Devices are only added from a single thread but they may be destroyed
concurrently so we need to guard the list against race conditions.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 21:43:03 +02:00
Rémi Bernon 4366cba6e6 winebus.sys: Move device vtable to the struct unix_device side.
And name the callbacks a bit more consistently.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 21:43:03 +02:00
Rémi Bernon 08f943b595 winebus.sys: Create devices using a struct device_desc descriptor.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 21:43:03 +02:00
Rémi Bernon 5e0c1ce443 winebus.sys: Move mouse and keyboard devices to unixlib.c.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-02 21:57:38 +02:00
Rémi Bernon 2457113970 winebus.sys: Return an event from IOHID bus wait on device removal.
Instead of calling bus_unlink_hid_device or IoInvalidateDeviceRelations.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-02 21:57:38 +02:00
Rémi Bernon 9f09e2a3cb winebus.sys: Return an event from UDEV bus wait on device removal.
Instead of calling bus_unlink_hid_device or IoInvalidateDeviceRelations.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-02 21:57:38 +02:00
Rémi Bernon 6006758ca8 winebus.sys: Return an event from SDL bus wait on device removal.
Instead of calling bus_unlink_hid_device or IoInvalidateDeviceRelations.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-02 21:57:38 +02:00
Rémi Bernon f6d567d3e3 winebus.sys: Pass a struct bus_event pointer to bus_wait.
Allocated on the caller side.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-02 21:57:38 +02:00
Rémi Bernon d22ece4c58 winebus.sys: Stop enforcing input and IG suffix on gamepads.
The &IG_00 suffix is now automatically added by winexinput.sys.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-02 21:57:38 +02:00
Rémi Bernon 7b4b48a774 winebus.sys: Report WINEBUS\WINE_COMP_XINPUT compatible id for gamepads.
In addition, and before WINEBUS\WINE_COMP_HID, so that winexinput.sys
will match first as soon as it is introduced.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-02 10:30:24 +02:00
Rémi Bernon 06ab0d5405 winebus.sys: Report WINEBUS\WINE_COMP_HID compatible id.
And match it in winehid.sys instead of individual bus ids.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-02 10:30:20 +02:00
Michael Stefaniuc 079c47a38e winebus.sys: Print the debug string and not the pointer to it.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-26 10:40:09 +02:00
Rémi Bernon 11c6b376c0 winebus.sys: Use the private data pointer as device unique id.
Instead of a separately allocated device list entry pointer. And link
the device object into the device list directly.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-25 11:18:18 +02:00
Rémi Bernon 09c14c6321 winebus.sys: Allocate private device data separately.
And use an opaque struct unix_device as private data.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-25 11:18:16 +02:00
Rémi Bernon 7e1d1fac70 winebus.sys: Load bus options in main.c.
And pass them to bus_init function.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-25 11:18:14 +02:00
Rémi Bernon edbb3fac25 winebus.sys: Introduce a new unixlib interface.
And use it for bus entry points.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-25 11:18:11 +02:00
Rémi Bernon b4d8cd3891 winebus.sys: Create the IOHID bus thread in main.c.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-25 11:18:09 +02:00
Rémi Bernon 9d7f1eefa1 winebus.sys: Create the UDEV bus thread in main.c.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-25 11:18:07 +02:00
Rémi Bernon 9a78467975 winebus.sys: Create the SDL bus thread in main.c.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-25 11:18:05 +02:00
Rémi Bernon 6e7ca58374 winebus.sys: Pass HID_XFER_PACKET and IO_STATUS_BLOCK to callbacks.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-18 20:07:53 +02:00
Rémi Bernon ee5cde83da winebus.sys: Merge begin_report_processing with start_device.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-18 20:07:50 +02:00
Rémi Bernon 8f065f97c9 winebus.sys: Remove the now useless bus_remove_hid_device.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-18 20:07:47 +02:00
Rémi Bernon 620b514aa0 winebus.sys: Build report descriptors in start_device.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-18 20:07:44 +02:00
Rémi Bernon 68c6c7d936 winebus.sys: Introduce a new start_device callback.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-18 20:07:26 +02:00
Rémi Bernon db410052a3 winebus.sys: Unlink device before releasing it.
Otherwise the device will still be linked in the device list and any
thread iterating it to find a matching device will access stale pointer.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-17 00:43:52 +02:00
Rémi Bernon d3885f92fc winebus.sys: Return NTSTATUS from build_report_descriptor.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-17 00:43:50 +02:00
Rémi Bernon 12ef137b47 winebus.sys: Ignore EV_REL / EV_ABS ioctl failures.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-17 00:43:48 +02:00
Rémi Bernon fd73402ce6 winebus.sys: Parse udev device version and input number from uevent.
And try parsing it from the hid or input and usb parent nodes, but not
beyond.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-17 00:43:46 +02:00
Rémi Bernon c2fc919e04 winebus.sys: Simplify parsing udev device info from uevent.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-17 00:43:44 +02:00
Rémi Bernon aa40700f9f winebus.sys: Only read EVIOCGID result if the ioctl succeeded.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-17 00:43:42 +02:00
Rémi Bernon acff5b4191 winebus.sys: Always call the EVDEV ioctls for input UDEV subsystem.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-17 00:43:41 +02:00
Rémi Bernon 5c3f2f88a6 winebus.sys: Use bus_find_hid_device to find SDL devices from id.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-17 00:43:39 +02:00
Rémi Bernon 5703d5c0b3 winebus.sys: Pass bus id instead of vtbl to lookup functions.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-17 00:43:36 +02:00
Rémi Bernon a67ac02dc3 winebus.sys: Move SDL mapping loading to a separate helper.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-13 11:52:43 +02:00
Rémi Bernon 90b8a97237 winebus.sys: Move SDL function loading to a separate helper.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-13 11:52:41 +02:00
Rémi Bernon 5d6419a53c winebus.sys: Fix duplicate lnxev / hidraw device lookup.
The comparison result was wrong, and the device syspath always differs
anyway between two different subsystems. We need to compare the parent
device syspath.

The input subsystem devices also needs to be deduplicated between eventX
devices and jsX devices.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-13 11:52:39 +02:00
Rémi Bernon 3fb4eec6c3 winebus.sys: Make hidraw report callbacks consistent.
This was inconsistently forcing the first report byte to the report id.

The report ids are stripped when they aren't used, in the packet
hidclass.sys provides, but hidraw API wants them all the time, so we
need to use an intermediate buffer.

Also ioctl length argument have a lower size capacity, so we have to
check for it as well.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-13 11:52:36 +02:00