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.

Resolved HID override for 'unsupported' devices?

Discussion in 'Input System' started by TheSaltyDog, Aug 6, 2020.

  1. TheSaltyDog

    TheSaltyDog

    Joined:
    Jul 2, 2016
    Posts:
    4
    So I have an older pair of saitek rudder pedals that I'd like to have control some input in my Unity project. I've got my HOTAS working with Input system pretty easily, but the documentation is unclear as to how to go about laying out this device.

    I created my script to register the input, as per the documentation, and the device is now detected by unity. It appears to be reading some of the HID JSON on its own as well:

    https://imgur.com/a/E6bHYPy

    Code (CSharp):
    1.     class SaitekFlightProRudders : Joystick
    2.     {
    3.  
    4.         static SaitekFlightProRudders()
    5.         {
    6.             InputSystem.RegisterLayout<SaitekFlightProRudders>(
    7.                 matches: new InputDeviceMatcher()
    8.                     .WithInterface("HID")
    9.                     .WithCapability("vendorId", 0x6A3)
    10.                     .WithCapability("productId", 0x763));
    11.         }
    12.  
    13.         [RuntimeInitializeOnLoadMethod]
    14.         static void Init() { }
    15.  
    16.     }
    What's clear as mud in the documentation however, is how to describe the layout of this device? Yeah, I get there's some structs, and some byte fields that will describes axes and buttons. But how is that struct registered as belonging to this device? That is not described anywhere I can see.


    Edit: Actually I figured out where to register the layout with the attribute ahead of the class definition and the assembler directives:

    Code (CSharp):
    1. [InputControlLayout(stateType = typeof(SaitekFlightProInputReport))]
    Now to figure out how to write the layout..
     
    Last edited: Aug 6, 2020