Well I've managed to map all the PS3 Sixaxes controller buttons and axes to match the XBox 360 equivalents exactly as you would expect based on their positions on the controller except for the D-pad for which it seems there is an insurmountable obstacle in that the D-pad on the XBox 360 controller has 2 axes X and Y whereas the Sixaxes has 4 up, down, left and right with each button's pressure acting as an axis.
Anyway this is what I figured out and how.
Based on this page:
https://sites.google.com/site/gobusto/stuff I figured out what buttons and axes the XBox 360 controller and the PS3 Controller have, combined with using "jstest /dev/input/js0" with the PS3 controller that I have:
PS3 Axes (27):
0 = Left stick X
1 = Left stick Y
2 = Right stick X
3 = Right stick Y
4 = ?
5 = ?
6 = ?
7 = ?
8 = D-pad up
9 = D-pad right
10 = D-pad down
11 = ? (does nothing but logically should be D-pad left)
12 = L2
13 = R2
14 = L1
15 = R1
16 = Triangle
17 = Circle
18 = X
19 = Square
20 = ?
21 = ?
22 = ?
23 = Motion Sensor min and max when right or left side edge points towards ceiling
24 = Motion Sensor min and max when handles point toward ceiling or floor
25 = Motion Sensor min and max when sat right way up or flat on face
26 = ?
PS3 Buttons (19):
0 = Select
1 = Left stick click
2 = Right stick click
3 = Start
4 = D-pad up
5 = D-pad right
6 = D-pad down
7 = D-pad left
8 = L2
9 = R2
10 = L1
11 = R1
12 = Triangle
13 = Circle
14 = X
15 = Square
16 = PS button
17 = ?
18 = ?
XBox 360 Axes (8):
0 = Left stick X
1 = Left stick Y
2 = Left trigger
3 = Right stick X
4 = Right stick Y
5 = Right trigger
6 = D-pad X
7 = D-pad Y
XBox 360 Buttons (11):
0 = A
1 = B
2 = X
3 = Y
4 = Left bumper
5 = Right bumper
6 = Start
7 = Xbox logo
8 = Left stick click
9 = Right stick click
10 = back
PS3 and XBox 360 axes equivalents (based on use and position on controller):
XBox <==> PS3
----------------------
Left stick X <==> Left stick X
Left stick Y <==> Left stick Y
Left trigger <==> L2
Right stick X <==> Right stick X
Right stick Y <==> Right stick Y
Right trigger <==> L2
D-pad X <==> ? (unable)
D-pad Y <==> ? (unable)
PS3 and XBox 360 button equivalents (based on use and position on controller):
XBox <==> PS3
--------------------------
A <==> X
B <==> Circle
X <==> Square
Y <==> Triangle
L1 <==> Left bumper
R1 <==> Right bumper
Start <==> Start
XBox logo <==> PS logo
Left Stick click <==> Left Stick click
Right Stick click <==> Right Stick click
Back <==> Select
Resulting map of XBox 360 to PS3 Axes:
XBox ==> PS3
------------
0 ==> 0
1 ==> 1
2 ==> 12
3 ==> 2
4 ==> 3
5 ==> 13
6 ==> ? (9 causes problems)
7 ==> ? (8 causes problems)
Resulting map of XBox 360 to PS3 Buttons:
XBox ==> PS3
------------
0 ==> 14
1 ==> 13
2 ==> 15
3 ==> 12
4 ==> 10
5 ==> 11
6 ==> 3
7 ==> 16
8 ==> 1
9 ==> 2
10 ==> 0
Then I had to get the output of "jscal -q /dev/input/js0" which gives me my current mapping:
jscal -u 27,0,1,2,5,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,19,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,720,721,722 /dev/input/js0
And rearange it into axes and buttons. The 27 tells you that the subsequent 27 numbers are axes, and the first number after that - 19 - tells you that the following 19 numbers are buttons (I guessed that the postions corresponded to the button or axes numbers):
Button number: # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
Button code: 27,0,1,2,5,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,
Axes number: # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Axes code: 19,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,720,721,722
Then I had to perform swaps like button 0 on the XBox needs to be the button 14 code for the PS3 so I would swap button code 0 for button code 50:
Button number: # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
Button code: 27,50,1,2,5,40,41,42,43,44,45,46,47,48,49,0 ,51,52,53,54,55,56,57,58,59,60,61,62,
And make sure that the code I was swapping with was the code that had originally been in the position on the PS3 not the current one as after a few swaps that has probably changed.
Which eventually gave me for my controller:
Button number: # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
Button code: 27,0,1,48,2,5,49,42,43,44,45,46,47,40,41,50,51,52,53,54,55,56,57,58,59,60,61,62,
Axes number: # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Axes code: 19,302,301,303,300,298,299,291,720,289,290,288,293,294,296,292,297,295,721,722
Which I recombined into a jscal command:
jscal -u 27,0,1,48,2,5,49,42,43,44,45,46,47,40,41,50,51,52,53,54,55,56,57,58,59,60,61,62,19,302,301,303,300,298,299,291,720,289,290,288,293,294,296,292,297,295,721,722 /dev/input/js0
Which seems to work for every XBox 360 button and axis except the D-pad, which would need some kind of patch for the dev input code for the kernel.