Xbox Controller with xboxdrv how to: Link in Last Post

General discussion for players of Oolite.

Moderators: winston, another_commander

Post Reply
User avatar
Bangbangduck
Deadly
Deadly
Posts: 169
Joined: Tue Apr 29, 2014 5:57 pm
Location: My God it's full of stars

Xbox Controller with xboxdrv how to: Link in Last Post

Post by Bangbangduck » Fri May 16, 2014 3:52 pm

Hi all

I dug an old xbox1 controller out for use with oolite. I had already modded the end with a USB plug so it's good to go.

Installed xboxdrv and it does indeed work :P

But I have a small problem.....

I want to add deadzone to the stick axis as they are a bit twitchy and are causing issues in combat.

Having scoured the internet for 3 hours I now I can add said deadzone to the config file but where the hell is it? All the howto's are just this side of ambigueous which doesn't help.

I have found the 'examples' folder which has several config files but which one is being used?

I also installed runxboxdrv as well but I get an error

Code: Select all

['xboxdrv', '--config=~/oolite.ini', '/GNUstep/Applications/Oolite/']

-- [ ERROR ] ------------------------------------------------------
CommandLineParser::read_config_file(): couldn't open: ~/oolite.ini
Last edited by Bangbangduck on Sat May 31, 2014 11:08 pm, edited 1 time in total.
Do not press this button [O].....Oh Bugger!
Cobra MKIII Grendal's Dam

User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6310
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Xbox Controller with xboxdrv how to add deadzone to conf

Post by Diziet Sma » Sat May 17, 2014 3:33 am

Bangbangduck wrote:Having scoured the internet for 3 hours I now I can add said deadzone to the config file but where the hell is it? All the howto's are just this side of ambigueous which doesn't help.

I have found the 'examples' folder which has several config files but which one is being used?
Rather ambiguous indeed.. the expression "clear as mud" comes to mind.

I'd be inclined to think that none of the example config files are being used. I would imagine that you'd have to copy your chosen .xboxdrv file to another location and edit it there. But what that location is, is far from clear.

I just installed xboxdrv to see if I could find it for you, and used Synaptic to get a list of installed files.
/.
/usr
/usr/bin
/usr/bin/xboxdrv
/usr/bin/xboxdrvctl
/usr/share
/usr/share/doc
/usr/share/doc/xboxdrv
/usr/share/doc/xboxdrv/AUTHORS
/usr/share/doc/xboxdrv/NEWS.gz
/usr/share/doc/xboxdrv/PROTOCOL.gz
/usr/share/doc/xboxdrv/README
/usr/share/doc/xboxdrv/TODO.gz
/usr/share/doc/xboxdrv/changelog.Debian.gz
/usr/share/doc/xboxdrv/chatpad.xkb.gz
/usr/share/doc/xboxdrv/copyright
/usr/share/doc/xboxdrv/examples
/usr/share/doc/xboxdrv/examples/absolutemouse.xboxdrv
/usr/share/doc/xboxdrv/examples/calibrate.macro
/usr/share/doc/xboxdrv/examples/constfilter.xboxdrv
/usr/share/doc/xboxdrv/examples/cyclekey.xboxdrv
/usr/share/doc/xboxdrv/examples/default.xboxdrv
/usr/share/doc/xboxdrv/examples/dosbox.xboxdrv
/usr/share/doc/xboxdrv/examples/evdev.xboxdrv
/usr/share/doc/xboxdrv/examples/fceux.xboxdrv
/usr/share/doc/xboxdrv/examples/fceux2.xboxdrv
/usr/share/doc/xboxdrv/examples/helloworld.macro
/usr/share/doc/xboxdrv/examples/microsoft-ergonomic-4000.xboxdrv
/usr/share/doc/xboxdrv/examples/mouse.xboxdrv
/usr/share/doc/xboxdrv/examples/multi-controller.sh
/usr/share/doc/xboxdrv/examples/playstation3.xboxdrv
/usr/share/doc/xboxdrv/examples/responsecurve-generator.py
/usr/share/doc/xboxdrv/examples/rotate.xboxdrv
/usr/share/doc/xboxdrv/examples/sensitivity.xboxdrv
/usr/share/doc/xboxdrv/examples/shift.xboxdrv
/usr/share/doc/xboxdrv/examples/tiefighter.xboxdrv
/usr/share/doc/xboxdrv/examples/two-sticks.xboxdrv
/usr/share/doc/xboxdrv/examples/warsow.xboxdrv
/usr/share/doc/xboxdrv/examples/xbmc.xboxdrv
/usr/share/doc/xboxdrv/examples/xboxdrv-dualstrike
/usr/share/doc/xboxdrv/examples/xboxdrv-dualstrike-mouse
/usr/share/doc/xboxdrv/examples/xboxdrv-ps3-usb
/usr/share/doc/xboxdrv/examples/xpad-wireless.xboxdrv
/usr/share/doc/xboxdrv/examples/zsnes.xboxdrv
/usr/share/doc/xboxdrv/runxboxdrv
/usr/share/doc/xboxdrv/runxboxdrv/README
/usr/share/doc/xboxdrv/runxboxdrv/keyconfig.plist
/usr/share/doc/xboxdrv/runxboxdrv/oolite.ini
/usr/share/doc/xboxdrv/runxboxdrv/runxboxdrv.gz
/usr/share/doc/xboxdrv/sensitivity.gnuplot
/usr/share/doc/xboxdrv/sensitivity.svg
/usr/share/doc/xboxdrv/xbox360-asciiart.txt
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/xboxdrv.1.gz
/usr/share/man/man1/xboxdrvctl.1.gz
Bangbangduck wrote:I also installed runxboxdrv as well but I get an error

Code: Select all

['xboxdrv', '--config=~/oolite.ini', '/GNUstep/Applications/Oolite/']

-- [ ERROR ] ------------------------------------------------------
CommandLineParser::read_config_file(): couldn't open: ~/oolite.ini
Hmm.. you did copy oolite.ini from /usr/share/doc/xboxdrv/runxboxdrv/ to your home folder, yes? If you did, perhaps it's a file permissions problem?

I'm sorta guessing here, but looking through the runxboxdrv documentation and wrapper script, I get the impression that the .xboxdrv configuration file would also need to be copied to your home folder and edited there.

Unfortunately, I don't have an xbox controller to test with, but I'll keep searching and experimenting, see what I can find out.

Edit:
Did you remember to disable the kernel's built-in xbox driver, xpad, as detailed here?:
http://www.omgubuntu.co.uk/2013/07/deal ... -in-ubuntu

See also the xboxdrv manpage, in the section "Running xboxdrv".

Edit 2:
The more I read around, the more I get the feeling the configuration file should just be in the root of your home folder.

Edit 3:
If you have no luck, and are using some variant of Ubuntu, this looks like a possible alternative solution.. This guy noticed all the problems people are having with xboxdrv and has created a fully configured and set up daemon-ised version of xboxdrv, ready to install.
http://www.webupd8.org/2014/04/get-xbox ... gured.html
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied

User avatar
Bangbangduck
Deadly
Deadly
Posts: 169
Joined: Tue Apr 29, 2014 5:57 pm
Location: My God it's full of stars

Re: Xbox Controller with xboxdrv how to add deadzone to conf

Post by Bangbangduck » Sat May 17, 2014 4:01 pm

Hello there

So glad I'm not the only one lol! I came across the same deamonised setup. I tried it but although it worked it wouldn't tie up with oolite control.

But As I had already installed xboxdrv from an alternate site it may be they wouldn't work together so I have purged the original download and cleared the PPA. Also removed Gambas3 which also claimed to be up to the job. As regards the runxboxdrv I had the .ini file in place and permissions were set as per the howto. So no idea here lol

Have just downloaded The aforementioned setup so I will see what happens with this one.

In other news - Related - Perusing the forum for possible answers I saw that Oolite Trunk has the rather nifty deadzone/response tweak installed by default (very nice piece of work overall chaps) This works great!!!!!!!!! So if all else fails I stay on the nightly build instead.

OK just tried the Deamon version again and although the deadzones set OK nothing passes to oolite as regards this. So I have no idea what where or who. I saved the profile it created but nothing doing.

I'll just tackle running xboxdrv from a menu entry now as it does the job with the trunk install.

Thanks for the help though my good fellow!

BBD
Do not press this button [O].....Oh Bugger!
Cobra MKIII Grendal's Dam

User avatar
Bangbangduck
Deadly
Deadly
Posts: 169
Joined: Tue Apr 29, 2014 5:57 pm
Location: My God it's full of stars

Re: Xbox Controller with xboxdrv how to add deadzone to conf

Post by Bangbangduck » Sat May 17, 2014 8:50 pm

Just a heads up on the xboxdrv quest,

To clarify I have been running Oolite 1.77. I had been 'flying by mouse' but wanted to use an xbox controller (I had some stashed away)
I am a Linux user and as with any other not averse to a bit of CLI if required. Though I am far from proficient.

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


I have an original xbox one controller which I modded by changing it's existing plug to a standard PC usb plug. -

http://www.ocmodshop.com/how-to-use-an- ... c-gamepad/

The above link I found useful only for the wiring as I completely removed the original plug rather than kept it dual purpose as in the how to.

So plug in the controller open up Terminal and type -

Code: Select all

sudo xboxdrv --silent
The above fires up the software to use the controller. The --silent on the end stops verbose code appearing in terminal everytime you do something with the controller.

Open up an Oolite session and go to the Game Options menu. Go to Joystick configuration and you can indeed configure the axis for flight control and buttons for weapons and sundry other controls.

This is great but, if like mine, the stick axis are a bit worn/loose then your flight path will drift and twitch when you have the sticks at rest/centered. A bit of a bummer!

Also the triggers and Dpad may not work and these could be useful to expand your control range. The following should be entered in terminal instead of the original line of code. -

Code: Select all

sudo xboxdrv --deadzone 5000 --dpad-as-button --trigger-as-button --silent
xboxdrv - Activates the software link

--deadzone 5000 - Sets an area on the sticks where they wont do anything. The figure can be increased if you still drift/twitch.

--dpad-as-button - The four points of the dpad can be assigned a task in oolite Joystick configuration page.

--trigger-as-button - Allows these to be assigned a task as above.

--silent - as per the original code.

This is the simplest, for me, cure for my drifting axis mainly. There all the above can be made into a config file with all the above plus full keymapping if you have the nouse - I don't.

Once created you would use the following command

Code: Select all

sudo xboxdrv --silent --config [FILE]
Where [FILE] is the path to your created config file.

I hope the above helps anyone needing to, primarily, sort out the deadzone. xboxdrv will also work with other types of Joysticks.

YMMV

BBD
Do not press this button [O].....Oh Bugger!
Cobra MKIII Grendal's Dam

User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6310
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Xbox Controller with xboxdrv how to add deadzone to conf

Post by Diziet Sma » Sun May 18, 2014 3:56 am

Congratulations on getting it figured out! Now I can uninstall it from my machine..

@ moderators: Should this thread perhaps be moved to the Linux section?
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied

User avatar
Bangbangduck
Deadly
Deadly
Posts: 169
Joined: Tue Apr 29, 2014 5:57 pm
Location: My God it's full of stars

Re: Xbox Controller with xboxdrv how to add deadzone to conf

Post by Bangbangduck » Sun May 18, 2014 8:43 am

Cheers 8) Perhaps change the topic title now as well?

Maybe 'Howto add deadzone to xboxdrv simply'

BBD
Do not press this button [O].....Oh Bugger!
Cobra MKIII Grendal's Dam

User avatar
Bangbangduck
Deadly
Deadly
Posts: 169
Joined: Tue Apr 29, 2014 5:57 pm
Location: My God it's full of stars

Re: Xbox Controller with xboxdrv how to add deadzone to conf

Post by Bangbangduck » Sun May 18, 2014 11:50 pm

I have managed to create a config file which I can call up so that the keys and axis are setup as per this script. One minor niggle is that the \ which I have assigned to right dpad wont work. Other than that I have some small measure of understanding.

Trying to create a simple launcher bash script is proving harder. Heres the problem. Oolite is installed (obviously) but typing the name in the CLI gives me an error --

oolite is not installed - to install type etc etc.

even if I navigate via CLI to the app and call it it still insists it's not installed. All this despite the fact I have it as a menu entry, both 1.77 and trunk, which does activate the game. Or I can go to it in it's folder and double click it to run. Any ideas anyone?

This is the config file. Very simple at this point. It is saved as 'oolite.xboxdrv' and called up with

Code: Select all

sudo xboxdrv --silent --config ~/oolite.xboxdrv
[code[xboxdrv]
silent=true
deadzone=6000
dpad-as-button=true
trigger-as-button=true

#Joysticks Left is x/y1 Right is x/y2
#[ui-axismap]
#x1=
#y1=
#x2=
#y2=

#Coloured buttons
[ui-buttonmap]
a=KEY_T
b=KEY_I
x=KEY_U
y=KEY_Y

#White Button / Black Button respectively
#[ui-buttonmap]
#lb=
#rb=

#The Triggers. Needs 'trigger-as-button=true'
[ui-buttonmap]
lt=KEY_M
rt=KEY_A

#Dpad needs 'dpad-as-button=true'
[ui-buttonmap]
dl=KEY_E
dr=KEY_BACKSLASH
du=KEY_C
dd=KEY_J

#Button names specific to original xbox controller
[ui-buttonmap]
#back=
start=KEY_ESC

#Axis pressed down buttons
[ui-buttonmap]
tl=KEY_KPASTERISK
#tr=

# EOF #][/code]

BBD
Do not press this button [O].....Oh Bugger!
Cobra MKIII Grendal's Dam

User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6310
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Xbox Controller with xboxdrv how to add deadzone to conf

Post by Diziet Sma » Mon May 19, 2014 2:02 am

Bangbangduck wrote:Trying to create a simple launcher bash script is proving harder. Heres the problem. Oolite is installed (obviously) but typing the name in the CLI gives me an error --

oolite is not installed - to install type etc etc.

even if I navigate via CLI to the app and call it it still insists it's not installed.
Hmm.. are you aware that the base file oolite in ~/GNUstep/Applications/Oolite (assuming you have a /home based install) is a short bash script which calls another wrapper script, which actually launches the game?
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied

User avatar
Bangbangduck
Deadly
Deadly
Posts: 169
Joined: Tue Apr 29, 2014 5:57 pm
Location: My God it's full of stars

Re: Xbox Controller with xboxdrv how to add deadzone to conf

Post by Bangbangduck » Mon May 19, 2014 7:21 pm

Hahaaaaaaaa! :idea:

A rather important bit of information that! Thank you for the illumination on this dark and desperate plan!! :mrgreen:
This is the CLI string that ties the config file to the game and launches said game -

Code: Select all

sudo xboxdrv -s --config ~/oolite.xboxdrv ~/GNUstep/Applications/Oolite/oolite.app/oolite-wrapper
So I am almost there it seems......

BBD
Do not press this button [O].....Oh Bugger!
Cobra MKIII Grendal's Dam

User avatar
Bangbangduck
Deadly
Deadly
Posts: 169
Joined: Tue Apr 29, 2014 5:57 pm
Location: My God it's full of stars

Re: Xbox Controller with xboxdrv how to add deadzone to conf

Post by Bangbangduck » Sun May 25, 2014 3:43 pm

Hi all

Well my netbook really can't handle the coolness known as Oolite 1.79. A shame because the joystick tweaking is fantastic. My main PC does though so that's great.

Any way because of this I have been slogging away at the fine tuning of the axis control. So I can play on the move. The quest? To make the control less twitchy near center. This is mainly to aid locking on to a target during a firefight where death by over/under steer is very unforgiving.

So I eventually used a python script by grumble that creates the node points in a curve based on a couple of inputs. I chose 14 points and it created the string of coordinates for the response line of the code below. Pleased to say it seems to be doing the trick. I have even been able to #out the deadzone line because of it.

I also managed to get the KEY_BACKSLASH code to work by using the X11SYM code. This is XK_BACKSLASH. Next up I am going to work out the best set up of keys to controller using one of the triggers as a 'shift' function so I can expand each buttons remit. Here's where I am thus far -

Code: Select all

[xboxdrv]
ui-clear=true
silent=true
#deadzone=5000
dpad-as-button=true
trigger-as-button=true

[axis-sensitivity]
x1=-0.5
y1=-0.5
x2=-0.5
y2=-0.5

#Joysticks Left is x/y1 Right is x/y2
[ui-axismap]
x1^resp:-32768:-29365:-26139:-23080:-20180:-17431:-14824:-12353:-10011:-7789:-5683:-3687:-1794:0:1794:3687:5683:7789:10010:12353:14824:17430:20180:23079:26138:29364:32767=ABS_X
y1^resp:-32768:-29365:-26139:-23080:-20180:-17431:-14824:-12353:-10011:-7789:-5683:-3687:-1794:0:1794:3687:5683:7789:10010:12353:14824:17430:20180:23079:26138:29364:32767=ABS_Y
x2^resp:-32768:-29365:-26139:-23080:-20180:-17431:-14824:-12353:-10011:-7789:-5683:-3687:-1794:0:1794:3687:5683:7789:10010:12353:14824:17430:20180:23079:26138:29364:32767=ABS_RX
y2^resp:-32768:-29365:-26139:-23080:-20180:-17431:-14824:-12353:-10011:-7789:-5683:-3687:-1794:0:1794:3687:5683:7789:10010:12353:14824:17430:20180:23079:26138:29364:32767=ABS_RY


[ui-buttonmap]
a=KEY_T
b=KEY_I
x=KEY_U
y=KEY_Y


[ui-buttonmap]
lb=KEY_S
rb=KEY_W

[ui-buttonmap]
lt=KEY_M
rt=KEY_A

[ui-buttonmap]
dl=KEY_E
dr=XK_backslash
du=KEY_C
dd=KEY_J

[ui-buttonmap]
#back=
start=KEY_ESC

[ui-buttonmap]
tl=KEY_KPASTERISK
#tr=

# EOF #
BBD
Do not press this button [O].....Oh Bugger!
Cobra MKIII Grendal's Dam

User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6310
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Xbox Controller with xboxdrv how to add deadzone to conf

Post by Diziet Sma » Sun May 25, 2014 4:21 pm

Well done.. once you've got it all figured out, it would make for a great tutorial piece in the Linux section. 8)
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied

User avatar
Bangbangduck
Deadly
Deadly
Posts: 169
Joined: Tue Apr 29, 2014 5:57 pm
Location: My God it's full of stars

Re: Xbox Controller with xboxdrv how to add deadzone to conf

Post by Bangbangduck » Mon May 26, 2014 12:07 am

Cheers

I will do. Setting up the keys/buttons should be easy. Only the choices of layout are making it complicated :mrgreen:

Other than that I am having one minor issue with running a #!/bin/sh. Theory being you can add a menu entry and it will fire up xboxdrv with the config file and then start the game. When game is aborted it shuts down.

It works but then I lose the Y2 axis which is the yaw control. If I use the CLI string, as I had been, everything is fine so not sure what the problem is yet.

BBD
Do not press this button [O].....Oh Bugger!
Cobra MKIII Grendal's Dam

User avatar
Bangbangduck
Deadly
Deadly
Posts: 169
Joined: Tue Apr 29, 2014 5:57 pm
Location: My God it's full of stars

Re: Xbox Controller with xboxdrv how to add deadzone to conf

Post by Bangbangduck » Tue May 27, 2014 8:38 am

Fixed it!

I wish I could say it was down to extreme cleverness. But it isn't..

Everything is the same as it was yesterday but Y2 just started working :shock: :? :roll:

I now have a menu entry that fires up the game and xboxdrv with my config file :mrgreen:

Currently working on a revised button layout on the pad to try and maximise button function.. or just cause a headache trying to remember what key does what and when LOL!

Once I have it finalised I'll post under the linux thread.

BBD
Do not press this button [O].....Oh Bugger!
Cobra MKIII Grendal's Dam

User avatar
Bangbangduck
Deadly
Deadly
Posts: 169
Joined: Tue Apr 29, 2014 5:57 pm
Location: My God it's full of stars

Re: Xbox Controller with xboxdrv how to add deadzone to conf

Post by Bangbangduck » Sat May 31, 2014 11:06 pm

Hello all

Please follow this link to the complete how to set up and use xboxdrv.

http://www.aegidian.org/bb/viewtopic.php?f=9&t=16519

BBD
Do not press this button [O].....Oh Bugger!
Cobra MKIII Grendal's Dam

Post Reply