Using xboxdrv is actually easy. A basic HOWTO
Posted: Wed May 28, 2014 1:35 pm
Hello all
I've been ooliting for only a few weeks. Starting with Keyboard control, then, a brief flirtation with 'fly by mouse' and finally onto an original xbox controller. Which is where the Story really starts
First up I am using the latest crunchbang linux and am also an ubuntu user. The following should work on all flavours YMMV though. If there are issues google is your friend.
First I added the PPA from grumble -
You will need to do the following -
The original xbox one controller I modded by changing it's existing plug to a standard PC usb plug. -
http://www.instructables.com/id/X-Box-C ... -on-PCMac/
So with xboxdrv installed and the handset modded we are now good to go.
At it's most basic to have oolite flight/combat control under the eagis of xboxdrv you would do the following in terminal.
Please do not be afraid of this Command Line Interface. It is your friend -
First we need to ensure a module called xpad is blacklisted. This is another joystick interface software app. So type this -
Then type -
This just saves you rebooting. On the next reboot xpad wont be loaded ever. Unless removes from the blacklist of course.
Plug your controller in now, then -
This line of code suits the HOME install of oolite. Basically everything is in the GNUstep folder
If you did the SYSTEM WIDE install you would use the following code -
Oolite will pop up and then you can go into the Joystick Settings page and set up the axis controls and buttons to suit yourself.
Of course you can then go on with the 'game'.
The above codes ensure that the dpad and triggers work. also as you have to leave terminal open the -s on the end stops reams of key presses filling the terminal screen.
So all well and good at this point? You will have to run the above codes everytime you want to play, with the controller, of course.
But wait! There's more!
How would you like to automate the above to a menu entry. One click and everything fires up........Oh and how about expanding the remit of some of the controller buttons? Interested? Then read on...
First of all we need to create a xxxxx.xboxdrv config file. In my case it is called oolite.xboxdrv. This contains information on button settings, axis settings and 'other tweaks'. The following is what works for me. It is not exhaustive and may, in some part, not be best practice but it works thus far.
This image has the controls anotated to cross reference with the above.
If you look at the config file, particularly the 'buttonmap' headed areas you should see that to the left of the '=' is the controller notation as per the diagram. Everything to the right are the key codes which map to the keyboard letters/symbols.
Also notice there are pairs of code each side on some of the buttonmaps. Simply put I am using the left trigger (lt) as a 'shift' button. Basically it means I can make one button do two jobs. i.e. the right trigger fires the laser (rt=KEY_A) but if I do this - (lt+rt=KEY_M) It will launch a missile, if targeted.
For the 'shift N', keyboard command, the code used to prime equipment the xbox code is KEY_LEFTSHIFT+KEY_N. Simples!
You should be able to identify all the KEY_commands in the config file as they are simply the keyboard strokes used in the game.
OK look at the axismap further up. This still causes my nose to bleed Basically each axis, there are 4, can have a specific setup for sensitivity, responsecurve, deadzones etc... ooh there goes my nose again In this instance only sensitivity and a responsecurve are used. Sensitivity can go from -1.0 to 1.0 in increments of 0.1 if you will. negative value reduces sensitivity positive increases sensitivity. The string of numbers is the responsecurve. generated with a python script that is in the xboxdrv examples folder.
The setup I have seems to be OK....
At the very top are some general commands.
ui-clear=false - Usually set to true. This clears the actual games key map making way for the config files mapping.
silent=true - stops concurrent output of any key axis movement in terminal being 'printed'
deadzone=1500 - For joysticks where they may be a little slack at rest causing unwanted movement, at the slightest twitch, in game. 1500 seems to work for this setup up to 4000/6000 can be a useful range also.
dpad-as-button/trigger-as-button=true - without these lines niether would function.
The config file is saved in /home/yourname folder as oolite.xboxdrv . Now to try it out. Put the following in terminal. Ensure your controller is plugged in and in this instance in the config file change the 'ui-clear=false' to true. Remember to save the change
If you did the SYSTEM WIDE install you would use the following code -
The game should pop up and when you launch everything should work on the controller.
I will go on to the automagic menu entry later. For now I hope this helps someone even if it's only me
BBD
I've been ooliting for only a few weeks. Starting with Keyboard control, then, a brief flirtation with 'fly by mouse' and finally onto an original xbox controller. Which is where the Story really starts
First up I am using the latest crunchbang linux and am also an ubuntu user. The following should work on all flavours YMMV though. If there are issues google is your friend.
First I added the PPA from grumble -
Code: Select all
sudo add-apt-repository ppa:grumbel/ppa
sudo apt-get update
sudo apt-get install xboxdrv
The original xbox one controller I modded by changing it's existing plug to a standard PC usb plug. -
http://www.instructables.com/id/X-Box-C ... -on-PCMac/
So with xboxdrv installed and the handset modded we are now good to go.
At it's most basic to have oolite flight/combat control under the eagis of xboxdrv you would do the following in terminal.
Please do not be afraid of this Command Line Interface. It is your friend -
First we need to ensure a module called xpad is blacklisted. This is another joystick interface software app. So type this -
Code: Select all
echo "blacklist xpad" | sudo tee /etc/modprobe.d/blacklist-xpad.conf
Code: Select all
sudo rmmod xpad
Plug your controller in now, then -
This line of code suits the HOME install of oolite. Basically everything is in the GNUstep folder
Code: Select all
sudo xboxdrv --dpad-as-button --trigger-as-button -s ~/GNUstep/Applications/Oolite/oolite.app/oolite-wrapper/
Code: Select all
sudo xboxdrv --dpad-as-button --trigger-as-button -s /opt/Oolite/oolite.app/oolite-wrapper]
Of course you can then go on with the 'game'.
The above codes ensure that the dpad and triggers work. also as you have to leave terminal open the -s on the end stops reams of key presses filling the terminal screen.
So all well and good at this point? You will have to run the above codes everytime you want to play, with the controller, of course.
But wait! There's more!
How would you like to automate the above to a menu entry. One click and everything fires up........Oh and how about expanding the remit of some of the controller buttons? Interested? Then read on...
First of all we need to create a xxxxx.xboxdrv config file. In my case it is called oolite.xboxdrv. This contains information on button settings, axis settings and 'other tweaks'. The following is what works for me. It is not exhaustive and may, in some part, not be best practice but it works thus far.
Code: Select all
[xboxdrv]
ui-clear=false
silent=true
deadzone=1500
dpad-as-button=true
trigger-as-button=true
#The sticks. Left is x/y1 Right is x/y2
[ui-axismap]
X1^sen:-0.3^resp:-32768:-23014:-15417:-9709:-5618:-2876:-1213:-359:-44:0:44:359:1213:2876:5618:9708:15417:23013:32767=ABS_X
Y1^sen:-0.3^resp:-32768:-23014:-15417:-9709:-5618:-2876:-1213:-359:-44:0:44:359:1213:2876:5618:9708:15417:23013:32767=ABS_Y
X2^sen:-0.3^resp:-32768:-23014:-15417:-9709:-5618:-2876:-1213:-359:-44:0:44:359:1213:2876:5618:9708:15417:23013:32767=ABS_RX
#The coloured buttons
[ui-buttonmap]
a=KEY_T
lt+a=KEY_LEFTSHIFT+KEY_T
b=KEY_N
lt+b=KEY_LEFTSHIFT+KEY_N
x=KEY_E
lt+x=KEY_U
y=KEY_Y
#The white and black buttons. As per the original Xbox controller
[ui-buttonmap]
lb=KEY_S
lt+lb=KEY_J
rb=KEY_W
lt+rb=KEY_I
#The Triggers
[ui-buttonmap]
lt+rt=KEY_M
rt=KEY_A
#The Dpad
[ui-buttonmap]
dl=KEY_KPPLUS
lt+dl=XK_backslash
dr=KEY_KPMINUS
lt+dr=KEY_LEFTSHIFT+XK_backslash
du=KEY_R
dd=KEY_B
#The Back/Start buttons
[ui-buttonmap]
back=KEY_ESC
start=KEY_0
lt+start=KEY_TAB
#The thumbstick buttons
[ui-buttonmap]
tl=KEY_KPASTERISK
#tr set in oolite F2 game option joystick menu. For fine control of axis
tr=
# EOF #
If you look at the config file, particularly the 'buttonmap' headed areas you should see that to the left of the '=' is the controller notation as per the diagram. Everything to the right are the key codes which map to the keyboard letters/symbols.
Also notice there are pairs of code each side on some of the buttonmaps. Simply put I am using the left trigger (lt) as a 'shift' button. Basically it means I can make one button do two jobs. i.e. the right trigger fires the laser (rt=KEY_A) but if I do this - (lt+rt=KEY_M) It will launch a missile, if targeted.
For the 'shift N', keyboard command, the code used to prime equipment the xbox code is KEY_LEFTSHIFT+KEY_N. Simples!
You should be able to identify all the KEY_commands in the config file as they are simply the keyboard strokes used in the game.
OK look at the axismap further up. This still causes my nose to bleed Basically each axis, there are 4, can have a specific setup for sensitivity, responsecurve, deadzones etc... ooh there goes my nose again In this instance only sensitivity and a responsecurve are used. Sensitivity can go from -1.0 to 1.0 in increments of 0.1 if you will. negative value reduces sensitivity positive increases sensitivity. The string of numbers is the responsecurve. generated with a python script that is in the xboxdrv examples folder.
The setup I have seems to be OK....
At the very top are some general commands.
ui-clear=false - Usually set to true. This clears the actual games key map making way for the config files mapping.
silent=true - stops concurrent output of any key axis movement in terminal being 'printed'
deadzone=1500 - For joysticks where they may be a little slack at rest causing unwanted movement, at the slightest twitch, in game. 1500 seems to work for this setup up to 4000/6000 can be a useful range also.
dpad-as-button/trigger-as-button=true - without these lines niether would function.
The config file is saved in /home/yourname folder as oolite.xboxdrv . Now to try it out. Put the following in terminal. Ensure your controller is plugged in and in this instance in the config file change the 'ui-clear=false' to true. Remember to save the change
Code: Select all
sudo xboxdrv --config ~/oolite.xboxdrv ~/GNUstep/Applications/Oolite/oolite.app/oolite-wrapper/
Code: Select all
sudo xboxdrv --config ~/oolite.xboxdrv /opt/Oolite/oolite.app/oolite-wrapper]
I will go on to the automagic menu entry later. For now I hope this helps someone even if it's only me
BBD