Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Mapping a HID device to a DInput device.

Discussion in 'Input System' started by MihaPro_CarX, May 4, 2022.

  1. MihaPro_CarX

    MihaPro_CarX

    Joined:
    Apr 5, 2017
    Posts:
    17
    Hello.

    In our project we use InputSystem. Since we are developing a racing simulator, we need FFB support from racing wheels. To implement FFB, we use DInput, and in the future we will also integrate SDKs from steering wheel manufacturers. And here we are faced with the following problem. How do we map our HID device and InputSystem to a DInput device. From the side of the HID device, we have only PID and VID, we have the same PID and VID from the DInput device. But we need to support 2 racing wheels at the same time. In this case, there will be two devices with the same PID and VID. DInput has DIDEVICEINSTANCE.guidInstance, but

    I haven't yet found a way to map it to any of the HID devices. Maybe there is some way to solve this issue that I did not see? Or any suggestions how to solve a similar problem?

    I would appreciate any help, thanks.
     
  2. dmytro_at_unity

    dmytro_at_unity

    Unity Technologies

    Joined:
    Feb 12, 2021
    Posts:
    212
    We do report serial in the device capabilities, that could be used to match devices between different backends. Another less reliable way is to listen to inputs from all devices and see if same input comes from two devices, that way they can be cross corelated. Though that is less reliable.

    I assume you're talking about Logitech racing wheel SDK (it uses directinput IIRC), in that case I would suggest just writing a new device backend/data provider for it and avoiding HID backend all together.
     
  3. MihaPro_CarX

    MihaPro_CarX

    Joined:
    Apr 5, 2017
    Posts:
    17
    Hi dmytro_at_unity,

    Thanks for your advice. I'll try to see what the serail number is in device capabilities and how it can be mapped to a DInput device.

    Device detection by input comparison is a good idea, but I agree that it may not be completely reliable. I'll think about it. First of all, we are going to use DirectInput directly through the wrapper. This would solve the issue of FFB support on a wide range of devices.

    Ultimately, we could support some manufacturers through their SDKs, but this makes things more difficult, although features specific to specific racing wheels become available.