Commit Graph

119 Commits

Author SHA1 Message Date
Rémi Bernon af2b2d0433 hidclass.sys: Call IoInvalidateDeviceRelations before IoSetDevicePropertyData.
Otherwise setupapi may fail to find the device on which to set the
property. This triggers messages like the following the first time a
device is created (on prefix creation for mouse and keyboard devices):

  IoSetDevicePropertyData Failed to open device, error 0xe000020b.

Some IoSetDevicePropertyData implementation detail makes it always
return successfully but it's not doing anything and user32 will then
ignore the device when it enumerates rawinput devices.

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-05-05 21:52:23 +02:00
Rémi Bernon 3532d666b9 hidclass.sys: Assign rawinput handles through device properties.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Arkadiusz Hiler <ahiler@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-03 23:19:54 +02:00
Rémi Bernon 8e4d668e34 hidclass.sys: Register GUID_DEVINTERFACE_KEYBOARD interface.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-23 20:02:06 +02:00
Zebediah Figura c5565a74c3 hidclass.sys: Defer creating a child device until IRP_MN_START_DEVICE.
This is necessary to allow the Hauppauge CIR receiver driver for cx2310x drivers
(hcw10cir.sys) to start.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-20 21:07:09 +02:00
Zebediah Figura 06ab067758 hidclass.sys: Set PhysicalDeviceObject to the bus PDO.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-19 22:06:56 +02:00
Zebediah Figura a173672911 hidclass.sys: Stop creating a setupapi device.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-19 22:06:56 +02:00
Zebediah Figura aff72f2253 hidclass.sys: Pass a KEVENT to IoBuildSynchronousFsdRequest() in get_device_id().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-19 22:06:56 +02:00
Zebediah Figura f34b735eba hidclass.sys: Create separate parent FDO and child PDO objects.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-16 22:39:45 +02:00
Zebediah Figura 902696de93 hidclass.sys: Use GUID_DEVINTERFACE_HID directly.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-16 12:17:01 +02:00
Zebediah Figura a85d0f576a hidclass.sys: Remove the unused device_name field.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-16 12:16:53 +02:00
Zebediah Figura e30a14525e hidclass.sys: Merge main.c into pnp.c.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-16 12:16:49 +02:00
Zebediah Figura 5cc9c5ab51 hidclass.sys: Pass a KEVENT to IoBuildDeviceIoControlRequest() in hid_device_thread().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-16 12:16:43 +02:00
Rémi Bernon f4d5f7e88a hidclass.sys: Assign rawinput device handle in HID_LinkDevice.
The handles are just numeric values and not real object handles, they
are used in the hDevice field of the RAWINPUTHEADER struct.

They will also be used as an HID rawinput device array index on the
server side.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Arkadiusz Hiler <ahiler@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-15 10:37:55 +02:00
Zebediah Figura fd25cc3c3b hidclass.sys: Always wait for the lower driver in hid_device_thread().
Doing otherwise may result in memory corruption. The lower driver should complete its IRPs on device removal anyway.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-15 10:34:03 +02:00
Zebediah Figura 8c87a2618e hidclass.sys: Zero-initialize the HID_DEVICE_ATTRIBUTES structure.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-14 20:51:13 +02:00
Zebediah Figura 5e63c849b4 ntoskrnl/tests: Test child device enumeration.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-12 19:32:15 +02:00
Rémi Bernon 75dd9b9236 hidclass.sys: Fix parsed report descriptor length index.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-24 20:46:22 +01:00
Zebediah Figura 5294ebc9a0 hidclass.sys: No longer track devices in a list.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-12 14:41:43 +01:00
Zebediah Figura 76daa6b70c hidclass.sys: Do not manually clean up devices on unload.
We can rely on ntoskrnl to do this for us.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-12 14:41:33 +01:00
Zebediah Figura 0d406f09ee hidclass.sys: Pass a KEVENT to IoBuildDeviceIoControlRequest() in call_minidriver().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-11 22:26:36 +01:00
Arkadiusz Hiler 5a32339dc8 hidclass.sys: Calculate correct bitCount for vendor-specific 1 bit repeated elements.
DualSense controller's report descriptor comes with a 1 bit vendor specific
(Usage Page & Usage) element repeated through 'report count'.

Those were correctly interpreted as non-ranged buttons (exposed as button caps
with appropriate usage values) but their size was incorrectly assumed to be 1
ignoring the 'report count'.

Because of that the InputReportByteLength is miscalculated as 63 instead of
64. If the buffer passed to HidD_GetInputReport() is allocated using that
value the call will fail with ERROR_INSUFFICIENT_BUFFER.

This change fixes the above and cleans up the code a bit so the size for each
case is calculated directly from the count and size instead of using the
values that were derived from them.

Signed-off-by: Arkadiusz Hiler <ahiler@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-21 20:46:13 +01:00
Michael Stefaniuc f073d9a9d3 hidclass.sys: Use wide-char string literals.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-16 11:25:18 +01:00
Zebediah Figura 4c1ff566dd hidclass.sys: Don't reset the report count when recording a main item.
The report count is global and should be preserved.

This fixes the Logitech Extreme 3D Pro controller when used with hidraw.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-18 19:37:44 +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
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
Sven Baars 1413f577c5 hidclass.sys: Fix some memory leaks on error path (Coverity).
Signed-off-by: Sven Baars <sven.wine@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-10 23:20:41 +02:00
Zebediah Figura 6a6081fc93 hidclass.sys: Avoid freeing pool memory with HeapFree().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-22 09:50:16 +02:00
Francois Gouget 7c44f3dcd6 hidclass.sys: A spelling fix in an ERR() message.
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-08 17:53:36 +02:00
Zebediah Figura b84334d2bd hidclass.sys: Create a mouse device interface for HID mouse devices.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-07-04 21:14:54 +02:00
Zebediah Figura 878a1f5cea hidclass.sys: Detach the HID device before deleting it.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-27 09:29:13 +02:00
Zebediah Figura 3d011fcdff hidclass.sys: Get rid of unused minidriver parameter to HID_DeleteDevice().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-06 17:41:27 +02:00
Zebediah Figura 700633ee0f hidclass.sys: Use PDRIVER_ADD_DEVICE.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-06 17:41:23 +02:00
Zebediah Figura 6c6aeea8a8 ntoskrnl.exe: Correctly handle instance IDs.
The instance ID is only the third part of the "A\B\C" form, and must be
combined with the device ID to form the whole name for setupapi (the "device
instance ID").

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-05 16:46:20 +02:00
Zebediah Figura 1e05e96c47 hidclass.sys: Allocate IRP return buffers from paged pool.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-05 16:44:52 +02:00
Alexandre Julliard af0e0d9b62 hidclass.sys: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-05 08:36:39 +02:00
Piotr Caban 99114803b8 hidclass.sys: Limit written data to the actual report size.
Linux hidraw devices are not accepting to large set feature ioctls.

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:37 +02:00
Piotr Caban f57b869124 hidclass.sys: Support descriptors with over 10 individual usages in feature.
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:35 +02:00
Piotr Caban 84a248c1dd hidclass.sys: Remove no longer used features list.
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:24 +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
Piotr Caban 24b0faaf41 hidclass.sys: Fill some reserved fields when building HIDP_{BUTTON,VALUE}_CAPS.
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-10 16:04:25 +02:00
Jacek Caban f7bc649598 hidclass.sys: Support canceling read IRPs.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-09 08:14:35 -05:00
Jacek Caban 85082e8bd3 hidclass.sys: Make read IRP queue thread safe.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-09 08:14:31 -05:00
Piotr Caban 4316373998 hidclass.sys: Treat all one-bit fields as buttons.
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:36 -05:00
Piotr Caban 37d129e8fe hidclass.sys: Set LinkUsage field in build_elements 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-06 08:04:32 -05:00
Piotr Caban 31cd586c8c hidclass.sys: Set LinkUsagePage field in build_elements 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-06 08:04:29 -05:00
Piotr Caban 5c01898c9d hidclass.sys: Set LinkCollection field in build_elements 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-06 08:04:25 -05:00
Zhiyi Zhang 56b509a84a hidclass.sys: Handle create existent device failure.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-03-21 19:32:35 +01:00
Aric Stewart 5040b8d534 hidclass.sys: Prevent buffer overrun.
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-06 19:57:27 +01:00
Aric Stewart 7229893493 hidclass.sys: Move IoSetDeviceInterfaceState to PNP_RemoveDevice.
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-20 17:05:08 +01:00
Aric Stewart 5b31b764c0 hidclass.sys: IoCreateSymbolicLink is now called by IoSetDeviceInterfaceState.
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-20 17:05:02 +01:00