Can somebody help me setting up my joystick in xbmc?

I found guides on the net but they are pretty bad written (see here and here).

I know I have to edit the file ~/.xbmc/userdata/keymaps/Keymap.xml

Inside the file I add a new tag inside the global-tag called

Code:
<joystick name="NAME_OF_YOUR_JOYSTICK"> </joystick>


The name of the joystick I get with

Code:
 cat /proc/bus/input/devices


Okay, so far so good. But how do I define the directions?

The 2nd guide reads:
for an axis add:
<axis id="AXIS_ID" limit="VALUE_LIMIT">NAME_OF_XBMC_ACTION</axis>
and for a D-PAD or hat add:
<had id="HAT_ID" position="DIRECTION">"NAME_OF_XBMC_ACTION</hat>

BUTTON_ID, AXIS_ID and HAT_ID correspond to the index you got from jstest above +1, as jstests indices start as 0, but XBMC seems to start from 1...
VALUE_LIMIT is the limit that needs to be reached so XBMC activates that function. The default value of an axis is usually 0, so use "+1" and "-1" for the different directions of the axis.
DIRECTION is the direction of the D-PAD or hat and takes strings like "left", "right", "up" or "down".
With the command jstest I can see the left-right-movement of the left mini-joystick on my gamepad (it looks like a playstation-2-gamepad) is axis 0. Unfortunately the values are negative when I move it left and positiv when moving right. So what do I use to fill-in the field reading "value-limit"?

Jstest is using values from -32767 to -1 for left-movement and 1-32767 for right-movement. Jscal is using values from 0-127 for left and 129-255 for right-movement.
128 is middle-position when not touching anything. Which numbers do I have to use for the Keymap.xml?
Guide number one doesn't explain anything at all.