WineHQ

Hid: Difference between revisions

 
(4 intermediate revisions by 2 users not shown)
Line 5: Line 5:


==HID (Human Interface Devices) in WINE==
==HID (Human Interface Devices) in WINE==
Direct HID support has been added to Wine. This page is to help users and developers be able to test and use HID devices. This is not directly about [[DInput]] or [[XInput]] support and those topics should be discussed elsewhere.
HID support has been added to Wine. It is now used as a backend for every game controller device and all the relevant APIs to access them from the Windows side. It is implemented over the host's libSDL or evdev, although pass-through of host HID devices is also possible when they are accessible through hidraw.


==Relevant Debug Channels==
==Relevant Debug Channels==
* <code>+hid</code>: Higher level HID messages
* <code>+hid</code>: Traces all HID stack events
* <code>+hid_report</code>: Very noisy messages for every input and output report to hid devices
* <code>+rawinput</code>: Traces for the RawInput frontend
* <code>+plugplay</code>: Low level native bus device releated messages
* <code>+dinput</code>: Traces for the DInput frontend
* <code>+xinput</code>: Traces for the XInput frontend
* <code>+input</code>: Traces for the Windows.Gaming.input frontend


==Steps to do HID Testing==
==Pass-through of specific HID devices==
# On Linux, by default no hidraw devices on Linux are given any access to users. So you will need to had rw permission to the <code>/dev/hidraw<X></code> device that you want to have accessible in Wine.  Or if you want to be wild and crazy you can add a new udev rule to add permission to all the devices as they are added. '''This is not necessary on Mac'''.
 
# ('''This is not necessary on the development TIP''')The winebus service is not started by default yet. so you will need to start winebus.  (wine net start winebus) This makes things a little complicated. I would recommend testing with a process like this:
Some devices, such as the Sony DualShock and Sony DualSense are using a proprietary protocol that is the only way to access features such as LED control or advanced haptics. This protocol is supported by several Windows applications, and the only way to make it accessible to them is to setup the HID stack in pass-through mode directly to the host HID device, through hidraw.
<nowiki>
 
wine cmd
On Linux, by default, no hidraw devices are not accessible to normal users. You will need to either add rw permission to the <code>/dev/hidraw<X></code> device that you want to have accessible in Wine, or better, add a new udev rule to automatically allow access on matching devices when they are added.
net start winebus
 
<test application>
Several distributions already provide packages that contain the necessary udev rules for these devices. Most of them are related to Steam, and on Debian the package is named <code>steam-devices</code>. Installing this package (you don't even need to install Steam) should be enough to have the udev rules installed and no manual setup will then be necessary. For manual configuration, the relevant udev rules to copy can be found in that package sources [https://github.com/ValveSoftware/steam-devices/blob/master/60-steam-input.rules].
</nowiki>
Or you an change the service start for winebus in the registry <code>[System\\CurrentControlSet\\Services\\WineBus] "Start"=dword:00000002</code>


==Tools to use with device testing==
==Tools to use with device testing==
Line 53: Line 53:
| style="width:400px; align=center" | MY-POWER / CSL (low budget ps3 controller)
| style="width:400px; align=center" | MY-POWER / CSL (low budget ps3 controller)
| style="width:100px; align=center" |  Linux
| style="width:100px; align=center" |  Linux
| style="width:400px; align=center" | Working
|}
{| border="1"
| style="width:400px; align=center" | Playstation 4 Controller (DS4)
| style="width:100px; align=center" |  OS/X
| style="width:400px; align=center" | Working
| style="width:400px; align=center" | Working
|}
|}

Latest revision as of 11:00, 25 February 2024

Maintained by Aric Stewart

If you find incorrect information here please contact me.

HID (Human Interface Devices) in WINE

HID support has been added to Wine. It is now used as a backend for every game controller device and all the relevant APIs to access them from the Windows side. It is implemented over the host's libSDL or evdev, although pass-through of host HID devices is also possible when they are accessible through hidraw.

Relevant Debug Channels

  • +hid: Traces all HID stack events
  • +rawinput: Traces for the RawInput frontend
  • +dinput: Traces for the DInput frontend
  • +xinput: Traces for the XInput frontend
  • +input: Traces for the Windows.Gaming.input frontend

Pass-through of specific HID devices

Some devices, such as the Sony DualShock and Sony DualSense are using a proprietary protocol that is the only way to access features such as LED control or advanced haptics. This protocol is supported by several Windows applications, and the only way to make it accessible to them is to setup the HID stack in pass-through mode directly to the host HID device, through hidraw.

On Linux, by default, no hidraw devices are not accessible to normal users. You will need to either add rw permission to the /dev/hidraw<X> device that you want to have accessible in Wine, or better, add a new udev rule to automatically allow access on matching devices when they are added.

Several distributions already provide packages that contain the necessary udev rules for these devices. Most of them are related to Steam, and on Debian the package is named steam-devices. Installing this package (you don't even need to install Steam) should be enough to have the udev rules installed and no manual setup will then be necessary. For manual configuration, the relevant udev rules to copy can be found in that package sources [1].

Tools to use with device testing

  • hid_test.exe: Wine tests written around direct HID access, in the wine tree dlls/hid/tests.
  • hclient.exe: This is distributed by Microsoft in the DDK (and various free download sites if you are so inclined). This tool will enumerate devices and allow for all various levels of control and exploration.
  • hid.exe: (https://www.codeweavers.com/xfer/aric/HID/ access-key: sLcm7EZ7) A quick sample application for testing HID joysticks and gamepads with source.
  • HID descriptor parser: (http://eleccelerator.com/usbdescreqparser/) a web page to parse descriptor byte strings. Useful for debugging devices.

Devices that have been tested

Device Platform(s) Status
Logitech Rumblepad 2 Linux / OS/X Working
Xbox360 Controller OS/X Working (with 3rd party drivers installed)
Steam Controller ---- Not Working
MY-POWER / CSL (low budget ps3 controller) Linux Working
Playstation 4 Controller (DS4) OS/X Working

Previous Talks given by Aric Stewart at WineConfs


This page was last edited on 25 February 2024, at 11:00.