I wasn't sure on which StackExchange site I should ask this, so I'll give it a try over here.
I installed sdlmame (0.140-1) and qmc2 (0.2.b17-1) as a frontend on ArchLinux.
I enabled a USB joystick control on the Options screen and calibrated it. I had to uncheck axises 0, 1, 4 and 5 since they are not working. I am using a regular USB gamepad with a D-Pad (direction controller) and 10 action buttons which are being detected correctly (or so it seems in the Test screen). Axises 2 and 3 seem to be working.
When I load a ROM, the action buttons are working fine, but the D-Pad has no reaction at all. It's weird since the test page shows the expected reaction to the pressing of the D-Pad, but I have no D-Pad functionality whatsoever in the games.