Previous Entry Share Next Entry
A Sixaxis boot-start fix I discovered.
kubuntu
pecosdave
First of all this is related to an older post that isn't exactly accurate anymore.

Starting with later versions of BlueZ, the version that first came with Ubuntu 12.04, maybe earlier in 11.10 the patch to make your PS3 control work with Linux didn't really work anymore, but fortunately a short time later they added the patch directly into the driver so you didn't have to worry about it. You have to run sixpair and the sixaxis program, but you no longer have to recompile BlueZ.

Many people, like myself, have found that even though we can make it work, we can't make it work on bootup like it's supposed to even after typing "sixad --boot-yes". You can type "/etc/init.d/sixad status" and it will say "running" but it wont actually pair the control. I theorized this was a loading order, if sixad loads before BlueZ does that's probably a problem.

Unlike when I wrote start up scripts for Netware servers and even DOS autoexec.bat files startup on Linux is a little more confusing. In the Ubuntu world Upstart has mostly replaced Init, but Init is still in use. Most of the fixes I found recommended just leaving sixad for the last run-level loaded while BlueZ can start in the earlier run-levels. Unfortunately Ubuntu seems to default to run-level 2 and stay there now since Upstart is making run-levels a thing of the past. Where is just Upstart in play fixing it wouldn't be a problem you can easily make sixad depend on the other Bluetooth services. Unfortunately the Bluetooth service is Upstart and sixad is Init.

The fix is easy, but will take a little customizing in your own setup. In /etc/init.d/ you will find the file that starts the sixad server. You need to edit that, see the link at the top of this post if you need a walk through for how to do that, yes you will need root/sudo ability to do that. You will find a section that looks like this:


if (sixad_already_running_check "$1"); then
log_warning_msg "sixad is already running"
else
{
log_daemon_msg "Starting sixad"
$DAEMON --start &>>/var/log/sixad &
log_end_msg 0
}
fi


Simply add this text to that line in your file:


if (sixad_already_running_check "$1"); then
log_warning_msg "sixad is already running"
else
{
log_daemon_msg "Starting sixad"
sleep 20; $DAEMON --start &>>/var/log/sixad &
log_end_msg 0
}
fi


After editing be sure to run "sixad --boot-yes" to be certain the script runs and reboot your system to test it. That text you inserted makes your system wait 20 seconds (or whatever you change it to) before actually starting sixad. Make sure you get good and logged in and at least 20 seconds have passed since the command ran (which is probably invisible to you) before you hit the connect button on your control. Chances are by the time the desktop loads enough time has passed but don't rush it.

This works on my netbook. You may need to adjust the sleep time on your system, my netbook isn't very fast but 20 works out. Too short of a sleep time and it may still load sixad before BlueZ, too long and it still loads but doesn't work for reasons I'm uncertain of but confirmed as a problem. If your system is fast 20 may be too long.

As usual, back up your files, don't blame me if you screw it up, it worked for me, it may not for you. This is editing a file that runs in startup so you may theoretically hose it up bad enough that your system won't boot anymore, edit at your own risk.

Tags:

  • 1
See, when I plug my Xbox controller into my Windows box, it just works. Every time. :P

Yeah, but this is Bluetooth, I don't have to plug anything in after the fix :-)

  • 1
?

Log in