Multiple Identifiers of the same type reported

Hey guys,
So I am having an issue where multiple Identifier types are being reported for a controller (Saitek X45).
I’ve posted the output that I get for the ReadText test program using the linux version of jinput. Notice that Component 29: rz and Component 31: rz are both being reported as rz types. There are also a few buttons that are being reported as UNKNOWN

So is there an easy way to distinquish which component is reporting back even if they have the same Identifiers?

Thanks!


Controller Env = net.java.games.input.DefaultControllerEnvironment@c53dce
Linux plugin claims to have found 4 controllers
Saitek Saitek X45
Type: Stick
Component Count: 33
Component 0: Trigger
    Identifier: Trigger
    ComponentType: Absolute Digital
Component 1: Thumb
    Identifier: Thumb
    ComponentType: Absolute Digital
Component 2: Thumb 2
    Identifier: Thumb 2
    ComponentType: Absolute Digital
Component 3: Top
    Identifier: Top
    ComponentType: Absolute Digital
Component 4: Top 2
    Identifier: Top 2
    ComponentType: Absolute Digital
Component 5: Pinkie
    Identifier: Pinkie
    ComponentType: Absolute Digital
Component 6: Base
    Identifier: Base
    ComponentType: Absolute Digital
Component 7: Base 2
    Identifier: Base 2
    ComponentType: Absolute Digital
Component 8: Base 3
    Identifier: Base 3
    ComponentType: Absolute Digital
Component 9: Base 4
    Identifier: Base 4
    ComponentType: Absolute Digital
Component 10: Base 5
    Identifier: Base 5
    ComponentType: Absolute Digital
Component 11: Base 6
    Identifier: Base 6
    ComponentType: Absolute Digital
Component 12: Unknown
    Identifier: Unknown
    ComponentType: Absolute Digital
Component 13: Unknown
    Identifier: Unknown
    ComponentType: Absolute Digital
Component 14: Unknown
    Identifier: Unknown
    ComponentType: Absolute Digital
Component 15: Dead
    Identifier: Dead
    ComponentType: Absolute Digital
Component 16: A
    Identifier: A
    ComponentType: Absolute Digital
Component 17: B
    Identifier: B
    ComponentType: Absolute Digital
Component 18: C
    Identifier: C
    ComponentType: Absolute Digital
Component 19: X
    Identifier: X
    ComponentType: Absolute Digital
Component 20: Y
    Identifier: Y
    ComponentType: Absolute Digital
Component 21: Z
    Identifier: Z
    ComponentType: Absolute Digital
Component 22: Left Thumb
    Identifier: Left Thumb
    ComponentType: Absolute Digital
Component 23: Right Thumb
    Identifier: Right Thumb
    ComponentType: Absolute Digital
Component 24: Left Thumb 2
    Identifier: Left Thumb 2
    ComponentType: Absolute Digital
Component 25: Right Thumb 2
    Identifier: Right Thumb 2
    ComponentType: Absolute Digital
Component 26: x
    Identifier: x
    ComponentType: Absolute Analog
Component 27: y
    Identifier: y
    ComponentType: Absolute Analog
Component 28: rx
    Identifier: rx
    ComponentType: Absolute Analog
Component 29: rz
    Identifier: rz
    ComponentType: Absolute Analog
Component 30: slider
    Identifier: slider
    ComponentType: Absolute Analog
Component 31: rz
    Identifier: rz
    ComponentType: Absolute Analog
Component 32: pov
    Identifier: pov
    ComponentType: Absolute Digital

Hi

Currently, we just set the name from the identifier. Short term I think you need to get the index in the component[] to identify it.

I wonder if we should have an index on there when more than one axis of the same type is detected. This could also be an issue if you have say 2 joysticks plugged in that are the same. The OS might not assign an instance ID. And the name would be the same.

I think maybe the safest way to fix both of these is to have an index of some kind on both controllers and components. The controller indexes are unique across all devices currently connected, and he component index is unique across that controller.

It doesn’t even have to be an index, that would imply that a component knows where it sits in the controller, which I’m not sure is a good idea. Maybe just some kind of hash that the plugin assigns that controller/component.

If it’s a hash, would it have to be consistant across executions?, would people end up using it for saving player settings?

Lets see if we can get a nice solution for this.

Endolf

I’m not sure I understand the problem - Identifiers are just structured names for components and there’s no guarantee there is only component for each identifier. If you need input from a particular component, ask it directly. If you’re using events, the component that triggered an event is included with the event.

The problem of persisting controller settings is not solved of course, as there’s no component/controller identification that is guaranteed stable between jinput invocations.

  • elias

I guess currently the only unique identifier is the Component object itself, which like Elias pointed out, you can always get.

Endolf

Yea, persisting the controller settings is exactly my problem. Currently I read the Identifier and associate that with an event. Save that out to an xml file. The next time the player runs the game, the xml file is read in and events are associated based on the identifiers.

So certainly you could match the Component object with an event; however, this won’t work on multiple executions of the program.

I’ve thought about tieing the order in which buttons/axis are reported but is there any gaurantee that the controller will report the buttons in the same order every time?

Thanks

Hi

The plugin just does what the native layer (OS) tells it, in my experience it’s always the same, but I guess there is no gaurantee.

Endolf

Do you happen to know if its “always the same” across platform too? Meaning, will the button layouts be the same on Linux as they are in Windows?

I was thinking it would be cool to have pre-defined controller layouts - for instance, if you have an XBox360 Controller, then a player’s controls would default to a standard config for this controller (of course the player could change this if they wanted to). In order to have such a profile, its necessary to be able to identify the buttons/axis the same way regardless of OS and what other devices are plugged in.

Hi

Across platforms even the name of the controller changes, this is down to the OS drivers. The axis on joysticks/gamepads differ too. I have one device that IIRC, one of the axis on windows shows up as a throttle (giving two throttles) and under linux it’s an rz (given 2 rz), again, it’s a driver level thing. Without writing our own drivers or driver wrappers, there isn’t alot we can do about this, and jinput is supposed to be the lowest level of interaction, so we just hand to the developers using JInput what we get from the OS.

Endolf

Ah, so what about this:

Make profiles OS dependent. So an XBox360 Controller would essentially have 3 versions of a profile, 1 for linux, 1 for OSX, and 1 for XP.

What do you think about that?

Hi

That should work. Of course driver updates might screw up axis names and/or the order they are enumerated, but you can’t cover everything :slight_smile:

Doing profiles per platform sounds like your best bet.

HTH

Endolf