Commit Graph

112 Commits

Author SHA1 Message Date
Rémi Bernon 74b7845ff0 hid: Implement HidP_SetScaledUsageValue.
The function seems to actually do overflows and rounding errors.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-26 21:49:09 +02:00
Rémi Bernon 3b40a03267 hid: Implement HidP_UnsetUsages.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-26 21:49:09 +02:00
Rémi Bernon b36b2999c8 hid: Return HIDP_STATUS_SUCCESS even if no usages are found.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-12 17:30:21 +02:00
Rémi Bernon 2e3a0dac84 hidclass.sys: Rename WINE_HIDP_PREPARSED_DATA to struct hid_preparsed_data.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-10 17:53:55 +02:00
Alistair Leslie-Hughes 656691feb7 hid: Validate preparsed data pointer passed in HidP functions.
Power Rangers: Battle for the Grid.

0514:trace:hidp:HidP_GetCaps preparsed_data 000000004C9566B0, caps 000000000010EF00.
0514:trace:hidp:HidP_GetCaps preparsed_data 0000000000000000, caps 000000000010F020.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-10 17:53:55 +02:00
Rémi Bernon 9ef00c9353 hidclass.sys: Remove old reports from WINE_HIDP_PREPARSED_DATA.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-09 11:41:55 +02:00
Rémi Bernon 7096c26a2e hidclass.sys: Implement button array value caps.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-04 21:48:28 +02:00
Rémi Bernon 7f0e91f5aa hid: Always return node count in HidP_GetLinkCollectionNodes.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-28 19:43:28 +02:00
Rémi Bernon 37009031bb hid: Build link collection nodes in HidP_GetLinkCollectionNodes.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-28 19:43:28 +02:00
Rémi Bernon b860281d32 hid: Rewrite HidP_GetData using enum_value_caps.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-28 19:43:28 +02:00
Rémi Bernon 1c4e7a00a3 hid: Rewrite HidP_MaxDataListLength using enum_value_caps.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-28 19:43:28 +02:00
Rémi Bernon 28bbaf6707 hid: Return HIDP_STATUS_INCOMPATIBLE_REPORT_ID when id mismatches.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-28 19:43:27 +02:00
Rémi Bernon 38d863f1f7 hid: Rewrite HidP_GetScaledUsageValue using enum_value_caps.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-25 10:34:22 +02:00
Rémi Bernon 7650f87737 hid: Rewrite HidP_GetUsageValue using enum_value_caps.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-25 10:34:17 +02:00
Rémi Bernon cb5856695c hid: Rewrite HidP_SetUsageValue using enum_value_caps.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-25 10:34:13 +02:00
Rémi Bernon 0a192647fe hid: Rewrite HidP_GetUsageValueArray using enum_value_caps.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-25 10:34:09 +02:00
Rémi Bernon 334c6cf8f4 hid: Introduce new copy_bits helper for HidP_SetUsageValueArray.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-25 10:34:05 +02:00
Rémi Bernon f8e6965036 hid: Rewrite HidP_GetUsagesEx using enum_value_caps.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-24 22:03:07 +02:00
Rémi Bernon 1184afb640 hid: Rewrite HidP_GetUsages using enum_value_caps.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-24 22:03:00 +02:00
Rémi Bernon 8f5b49c0c4 hid: Rewrite HidP_SetUsages using enum_value_caps.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-24 22:02:56 +02:00
Rémi Bernon 14caae214f hid: Rewrite HidP_MaxUsageListLength using enum_value_caps.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-24 22:02:49 +02:00
Rémi Bernon dae8caf9f0 hid: Rewrite HidP_GetSpecificValueCaps using enum_value_caps.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-24 22:02:44 +02:00
Rémi Bernon ad03df1222 hid: Introduce new enum_value_caps helper for HidP_GetSpecificButtonCaps.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-23 22:27:33 +02:00
Rémi Bernon 04bd7c9d68 hid: Introduce new get_value_caps_range helper for HidP_InitializeReportForID.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-23 22:27:27 +02:00
Rémi Bernon e5b636c056 hid: Rewrite HidP_Get*Caps using HidP_GetSpecific*Caps.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-23 22:27:21 +02:00
Rémi Bernon 619bd1867a hid: Implement HidP_SetUsageValueArray stub.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-15 22:51:55 +02:00
Rémi Bernon dec362a766 hid: Check preparsed data magic in HidP_GetLinkCollectionNodes.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-10 23:04:04 +02:00
Rémi Bernon 45958834b8 hid: Use caps.BitSize to differenciate buttons from values.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-07 21:23:20 +02:00
Rémi Bernon 573e8bada9 hid/tests: Don't print buttons after HidP_GetUsages failed.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-07 21:22:51 +02:00
Rémi Bernon dc7547a84b hidclass.sys: Factor HIDP_BUTTON_CAPS with HIDP_VALUE_CAPS.
Buttons are really just values with BitSize == 1, and having a union for
that makes the code more complicated than it needs.

We'll simplify the code a lot using HIDP_VALUE_CAPS everywhere, as the
two structure types are compatible.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-04 20:00:30 +02:00
Rémi Bernon 9f193d5d41 hid: Use nameless unions.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-04 20:00:30 +02:00
Alexandre Julliard 30e7c49a7f hid: Use --prefer-native instead of DLL_WINE_PREATTACH.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-18 12:09:06 +01:00
Gabriel Ivăncescu ec88633912 hid: Implement HidP_GetUsageValueArray.
Games like Risk of Rain 2 need this with certain controllers.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-27 23:34:51 +01:00
Rémi Bernon 56d529694b hid: Implement HidP_GetLinkCollectionNodes.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-12 20:02:40 +01:00
Rémi Bernon 9a9af8b39a hid/tests: Add tests for HidP_GetLinkCollectionNodes.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-12 20:02:40 +01:00
Rémi Bernon 5c145acd4b hid: Add HidP_GetLinkCollectionNodes stub.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-12 20:02:40 +01:00
Rémi Bernon d63c7afc20 hid/tests: Call CancelIo before closing device.
This was causing some leak to be reported on wineserver shutdown when
no data can be read from a device.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-12 20:02:40 +01:00
Andrew Eikum b466419c32 hid: Move preparsed data definition to global header.
PHIDP_PREPARSED_DATA is supposed to be an opaque pointer, but the size
is accessible through user32.GetRawInputDeviceInfo(RIDI_PREPARSEDDATA),
so we will need to know the struct layout in user32, too.

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-04 22:43:01 +01:00
Andrew Eikum 6563166142 hid: Fix looking up report in HidP_GetValueCaps.
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-09 19:37:21 +02:00
Rémi Bernon cce8074aa9 hid: Fill the HIDD_ATTRIBUTES Size member, and add a test for expected size.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-20 23:02:22 +02:00
Alexandre Julliard f534ccba00 hid: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-05 08:35:57 +02:00
Andrew Eikum 6a610a3258 hid: Fix usage value mask.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47223
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-21 23:42:31 +02:00
Piotr Caban 2b5efe1b1c hid: Fix error handling in HidP_SetUsages.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-14 21:19:34 +02:00
Piotr Caban 42be0b7701 hid: Set button values in HidP_SetUsages function.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-13 18:49:39 +02:00
Piotr Caban 395d268565 hid: Change format of preparsed data.
Advantages of this format:
  - all table elements have constant size, that makes iterating table easier
  - allow report lookup by report ID in O(1) time
  - doesn't sort reports, it makes it possible to preserve original order
  of elements making output of functions more similar to native
  - preparsed data is created from collection, this will allow to add
  support for multiple top-most collections

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-13 18:48:51 +02:00
Andrew Eikum daa9906cce hid: Shift usage values to LSB.
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-06 13:19:33 -05:00
Piotr Caban 028e1ee3db hid: Only set first usage in an array in HidP_SetUsageValue.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-06 08:04:22 -05:00
Piotr Caban 6249de6e5d hid: Add support for ranges in find_value.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-06 08:04:18 -05:00
Piotr Caban c5d704334f hid: Add HidP_SetUsages implementation.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-06 08:04:14 -05:00
Alistair Leslie-Hughes 718b1bc542 hid: Implement HidD_FlushQueue().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45878
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-08 19:35:47 +02:00