EDIT : I wrote this supposing that the browser detected the gamepad. If that's not the case though, I don't know how to do it.
Hey !
It just seems to be a mapping problem.
Here is some help that can be found in the runtime.js of the gamepad plugin :
How to write a mapping:
Construct 2 normalises all controller states to the format used by the XBox 360 controller
on Chrome/Windows. Everything is mapped to a single 20-element array in the format:
0: A 10: Left analog button
1: B 11: Right analog button
2: X 12: D-pad up
3: Y 13: D-pad down
4: Left shoulder button ?14: D-pad left
5: Right shoulder button ?15: D-pad right
6: Left shoulder trigger ?16: Left analog X axis
7: Right shoulder trigger 17: Left analog Y axis
8: Back 18: Right analog X axis
9: Start 19: Right analog Y axis
Since different controllers return buttons and axes in a different order on different
browsers and OSs, all combinations need to be mapped to the above 20-element array,
called the 'c2state'.
The buttons mapping array translates a raw button input to the c2state, and the axis
mapping array translates a raw axis input to the range 0, 1, 2 or 3 (automatically offset
by 16 to fit in to the c2state). However, sometimes an axis is mapped to a pair of buttons,
e.g. for the D-pad coming up as an axis. In this case the mapping is another array
of the buttons to map the axis to; the first element for the button when axis negative,
and the second element for the button when the axis positive. e.g. XBox 360 on Firefox/Windows
has axis 5 mapped to D-pad left and right; the entry is [14, 15] to map negative (left) to
c2state 14 (D-pad left), and positive (right) to c2state 15 (D-pad right).
If no mapping exists for an OS/browser/controller configuration, it defaults to assuming it's
the same as Windows/Chrome/XBox 360, done by the defaultMap function.
And here is the mappings already set in this plugin :
var win_ff_xbox360_buttons = [0, 1, 2, 3, 4, 5, 8, 9, 10, 11];
var win_ff_xbox360_axes = [0, 1, [7, 6], 2, 3, [14, 15], [12, 13]];
ctrlmap["windows"]["firefox"]["xbox360"] = function (index, isAxis)
{
return doControllerMapping(index, isAxis, win_ff_xbox360_buttons, win_ff_xbox360_axes);
};
var win_ff_lda_buttons = [2, 0, 1, 3, 4, 6, 5, 7, 8, 9];
var win_ff_lda_axes = [0, 1, 2, 3, [14, 15], [12, 13]];
ctrlmap["windows"]["firefox"]["logitechdualaction"] = function (index, isAxis)
{
return doControllerMapping(index, isAxis, win_ff_lda_buttons, win_ff_lda_axes);
};
For a debug purpose, I would edit the runtime of controler, and add a console.log in getMapper (function(_id)) (line 132), just to see what input you get from your D-pad, and then prepare a mapping just like the two I just paste above. If your specific gamepad isn't supported, I don't see any other way.