Usually one would do this with a controller map. A controller map is basically a text file that maps from the controller button codes into a common format. For example SDL uses this file which contains the controller UUID, controller name, and which codes map to which key in the SDL controller interface.
I don't know what framework you are using but look up if your framework has a similar file. If they do not you will probably need to do this manually, or perhaps if you are lucky you can adapt the SDL file to fit your needs, but check the license first, it might not be free to use*.
*As of writing this postanswer the license is a zlib license which does allow editing as long as it is clearly mentioned that it has been edited.