Getting Joystick/gamepad input inc. controller type

Hello Everyone
I’m currently using GitHub - 0xcafed00d/joystick: Go Joystick API to get joystick state - which (in basic form) works on Windows with XBox360 (compatible) controller, DualShock 4 and also Legion Go joystick/s.

However, the button mappings between DS4 and Xbox for the face buttons (and I am sure the axes) don’t map the same, i.e. I would like to have the same button (mask) for these:

  • Ⓐ/✕
  • Ⓑ/◯
  • Ⓧ/☐
  • Ⓨ/🛆

There doesn’t appear to be any way to identify the controller type (using the underlying Windows Multi Media (legacy) dll/api).

Does anyone know of a package that manages this better - without adopting a whole framework - note that this isn’t for game development - but for a background (OS level) utility that can respond to gamepad inputs.

Things I have looked at so far include:

  1. I can guess which the controllers are, since the DS4 returns a different number of buttons and axes to an XBox360 - but I can’t find anywhere this is documented so it is just guessing based on 2/3 controllers…
  2. Roll my own Windows calls - but this seems over the top (and OS specific) plus I don’t have any experience of this - and likely reinventing the wheel…
  3. Windows Gaming Input - but I don’t see any examples of Golang accessing the api and it looks like you might have to buy in to the whole SDK.
  4. SDL - but this looks too over the top for my purposes and it looks unlikely to solve the issue either

Note that I would prefer a cross platform solution but the prime target is windows…

Thank you in advance - Andy