Commit Graph

156 Commits

Author SHA1 Message Date
Alexandre Julliard e5d69d9ee6 configure: Assume that sys/ioctl.h is available on Unix.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 18:43:51 +01:00
Alexandre Julliard 13ec7952e0 configure: Assume that unistd.h is available on Unix.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 18:43:51 +01:00
Rémi Bernon b89204385b winebus.sys: Send PID effect state reports for UDEV lnxev devices.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52062
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-02 20:20:39 +01:00
Rémi Bernon b431dceeca winebus.sys: Rotate directions to match the backend conventions.
The first direction in HID PID reports seems to be in polar space,
rotated by 90° compared to the spherical coordinate space used in
dinput. We need to fixup the directions to match Linux FF or SDL
direction coordinate space.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51922
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-02 20:20:39 +01:00
Ivo Ivanov 31a668439b winebus.sys: Support arbitrary effect parameter updates.
DInput will only send the output reports that have been modified, we
need to support sparse effect updates.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52061
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-22 22:20:50 +01:00
Rémi Bernon fca0f18d08 winebus.sys: Avoid unnecessary scaling of effect parameter values.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-19 18:31:38 +01:00
Rémi Bernon 354be0a169 winebus.sys: Implement PID device gain for UDEV lnxev devices.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-17 15:26:16 +01:00
Rémi Bernon fd47d58e8c winebus.sys: Add a PID device gain output report.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-17 15:25:51 +01:00
Ivo Ivanov 57161ff693 winebus.sys: Accept whitespaces in strings parsed from uevent.
Fixes the device names appearing with the first words in joy.cpl
and probably in games, when the UDEV bus is used in HIDRAW mode.

Signed-off-by: Ivo Ivanov <logos128@gmail.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-12 22:42:51 +01:00
Rémi Bernon 5b735572c1 winebus.sys: Use +hid debug channel.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-09 11:16:55 +01:00
Huw Davies 6fdae1979b configure: Stop checking for poll.h and sys/poll.h - always use poll.h.
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-31 17:56:54 +01:00
Rémi Bernon 3ad0c002da winebus.sys: Drop the hid_report channel.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:49 +02:00
Damjan Jovanovic 82a5be4637 winebus.sys: Get inotify working on FreeBSD.
FreeBSD requires linking to the inotify library, and
including limits.h.

Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-25 18:50:59 +02:00
Rémi Bernon 3453c3ea32 winebus.sys: Map REL_HWEEL to HID_USAGE_GENERIC_SLIDER.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=40658
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-21 11:21:52 +02:00
Rémi Bernon d168f1e8e5 winebus.sys: Count all absolute axes.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=40658
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-21 11:21:50 +02:00
Rémi Bernon 6295af0840 winebus.sys: Prefer USAGE_AND_PAGE over BYTE arrays.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=40658
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-21 11:21:48 +02:00
Francois Gouget c4d5010fbf winebus.sys: Add a trailing linefeed to a couple of FIXME()s.
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-20 18:58:30 +02:00
Simon McVittie ab3416c61f winebus.sys: Add code path to bypass udevd and use inotify.
In a container with a non-trivial user namespace, we cannot rely on
libudev communicating with udevd as a way to monitor device nodes,
for the following reasons:

* If uid 0 from the host is not mapped to uid 0 in the container, libudev
  cannot authenticate netlink messages from the host, because their sender
  uid appears to be the overflowuid. Resolving this by mapping uid 0 into
  the container is not allowed when creating user namespaces as an
  unprivileged user, and even when running as a privileged user, it might
  be desirable for the real uid 0 to not be mapped as a way to harden the
  security boundary between container and host.

* Depending on the container configuration, initial enumeration might
  not be able to read /run/udev from the host system. If it can't, sysfs
  attributes will still work because those are read directly from the
  kernel via sysfs, but udev properties coming from user-space rules
  (in particular ID_INPUT_JOYSTICK and friends) will appear to be missing.

* The protocols between udevd and libudev (netlink messages for monitoring,
  and /run/udev for initial enumeration) are considered to be private to
  a particular version of udev, and are not a stable API; but in a
  container, we cannot expect that our copy of libudev is at exactly the
  same version as udevd on the host system.

Sidestep this by adding a code path that continues to use libudev for
the parts that work regardless of whether udevd is running or can be
communicated with.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-20 16:16:07 +02:00
Simon McVittie 22dae167d3 winebus.sys: Treat udev actions other than "remove" as "add".
As per https://github.com/systemd/systemd/blob/v247-rc1/NEWS#L5
there are more kernel uevent types than just "add" and "remove",
and we should be treating everything other than "remove" as being
potentially an "add".

To cope with this, try_add_device() now checks whether the same device
was already added. If so, we ignore it.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-20 16:16:07 +02:00
Rémi Bernon b51c982de1 winebus.sys: Process quirky DS4 bluetooth reports.
Based on a Proton patch from Andrew Eikum <aeikum@codeweavers.com>.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-18 18:36:32 +02:00
Rémi Bernon 92c4cccb43 winebus.sys: Define BUS_BLUETOOTH if it is missing.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-18 18:36:28 +02:00
Rémi Bernon de7032816b winebus.sys: Do not parse bluetooth "PRODUCT=" uevent field.
These contain the bluetooth dongle VID / PID instead.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-12 18:29:22 +02:00
Ivo Ivanov 5d022fd0dc winebus.sys: Fix incorrect length when parsing uevent "HID_NAME=".
Signed-off-by: Ivo Ivanov <logos128@gmail.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 16:55:26 +02:00
Rémi Bernon 1c4523a9d4 winebus.sys: Add a PID set ramp force output report.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 15:27:25 +02:00
Rémi Bernon 4a2db9f29e winebus.sys: Add a PID set constant force output report.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 15:27:25 +02:00
Rémi Bernon c263fea14f winebus.sys: Add a PID set condition output report.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 15:27:25 +02:00
Rémi Bernon 4b653ae043 winebus.sys: Add a PID set envelope output report.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 15:27:25 +02:00
Rémi Bernon 6f2e66963c winebus.sys: Add a PID set periodic output report.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 15:27:25 +02:00
Rémi Bernon 57d99dcfb7 winebus.sys: Parse product string from uevent HID_NAME.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:35 +02:00
Rémi Bernon cf464a4d0b winebus.sys: Remove "stub!" from lnxev_device_haptics_start trace.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Huw Davies 43cd5d8a2d winebus.sys: Convert the product strings to Unicode on the Unix-side.
This avoids keeping two copies of each string.

It also fixes a regression on macOS from commit 9d4b70473c
that incorrectly treated a CFStringRef as a char ptr.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-05 11:51:04 +02:00
Rémi Bernon 9132162266 winebus.sys: Implement PID effect update for UDEV lnxev devices.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-05 11:33:35 +02:00
Rémi Bernon 12d91995fd winebus.sys: Add a PID effect update output report.
Advertising support of the periodic effect types only for now.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-05 11:33:19 +02:00
Rémi Bernon a41c5e057c winebus.sys: Implement PID effect control for UDEV lnxev devices.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-04 11:02:02 +02:00
Rémi Bernon 3b3228e9c7 winebus.sys: Add a PID effect control output report.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-04 11:01:56 +02:00
Rémi Bernon 11fe73ed8f winebus.sys: Implement PID device control for UDEV lnxev devices.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-01 12:37:47 +02:00
Rémi Bernon 903c7ea75d winebus.sys: Add a PID device control output report.
And include it in the HID report descriptor when SDL device has support
for any haptic effect, or when UDEV lnxev device has any FF bit set.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-01 12:37:17 +02:00
Rémi Bernon 55e978168e winebus.sys: Move hidraw_device code around.
To keep lnxev_device functions and related helpers all together.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-27 17:40:14 +02:00
Gerald Pfeifer 0c81dc223d winebus.sys: Fix non-Linux builds.
commit 40a9f69a1d

   winebus.sys: Rename UDEV bus device variables to be consistent.

   Introducing a struct base_device, and hidraw_device / lnxev_device
   depending on the sub-type of the device.

moved an existing use of ABS_VOLUME that was guarded by

  #ifdef HAS_PROPER_INPUT_HEADER

outside that guard, breaking the build on non-Linux platforms.

Address this by putting appropriate guards in place.

Signed-off-by: Gerald Pfeifer <gerald@pfeifer.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-27 17:40:14 +02:00
Rémi Bernon a27708dc9b winebus.sys: Add haptics rumble support for UDEV lnxev devices.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-24 21:55:19 +02:00
Rémi Bernon 78f67d5c08 winebus.sys: Handle feature and output reports in hid_device.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-23 10:28:45 +02:00
Rémi Bernon 04b19a969b winebus.sys: Use report ids in crafted HID reports.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-23 10:28:39 +02:00
Rémi Bernon 9cf1e8353c winebus.sys: Factor out setting HID report values.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-23 10:28:33 +02:00
Rémi Bernon c6df23fed3 winebus.sys: Factor out HID report buffers allocation.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-23 10:28:21 +02:00
Rémi Bernon 9d5e9b5f42 winebus.sys: Use the computed element offsets to create reports.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-22 21:48:10 +02:00
Rémi Bernon fa3905bafa winebus.sys: Introduce a new raw_device / hid_device abstraction.
For any device which requires building HID reports.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-22 21:48:02 +02:00
Rémi Bernon 40a9f69a1d winebus.sys: Rename UDEV bus device variables to be consistent.
Introducing a struct base_device, and hidraw_device / lnxev_device
depending on the sub-type of the device.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-22 21:47:53 +02:00
Rémi Bernon 8221229498 winebus.sys: Always add padding after button blocks.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-21 11:40:58 +02:00
Rémi Bernon 593c4d5149 winebus.sys: Move hats before buttons and use one byte each.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-21 11:40:54 +02:00
Rémi Bernon d7c4867257 winebus.sys: Enforce all axis values to be 32bit.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-21 11:40:43 +02:00