How to determine gamepad/joystick components mapping?

I have an app that monitors user gamepad/joystick experience. And as I’m new to such stuff I ran at some issues and hope you’ll advice me something.

I have two gamepads: XBox 360 Wireless for PC and SEGA Mega Drive Joystick (it’s how it is identified by OS). The first one has 16 components the second one has only 12 components. And if XBox’s [12]'s component is Start, Sega joystick’s Start component is [5]. A friend of mine has Logitech gamepad and PS3 gamepad, and I’m not sure what buttons mapping do they have. So I decided to implement several gamepad classes with specific mappings (one for XBox, another one for Sega, next one for Logitech gamepad), but what if some other gamepad will be used with this app? For example, Buffalo SNES USB gamepad.

Is there any solution on how to resolve such situation when you don’t know what mappings has that or another gamepad?

Another idea is to suggest user to set buttons minimum himself. But I didn’t find anything that is connected with components remapping in API. Is there any way to do this?