Using the PS3 Controller as a Mouse

YDL running on the Sony Playstation 3

Moderator: billb

Using the PS3 Controller as a Mouse

Postby protectivedad » 13 Aug 2008, 04:46

First, thanks for all the useful information. I've noticed people asking about how to use the PS3 sixaxis controller as a mouse in X. I wasn't able to google an answer for YDL.

This is a very rough outline of what I did to help those who know enough to duplicate my results.

1) Make sure you are able to compile programs and specifically X drivers;
2) Go to http://www.x.org/wiki/Releases/Download ... ct=Mirrors pick a mirror and get X11R7.3/src/driver/xf86-input-joystick-1.2.3.tar.gz;
3) Untar, compile (./configure --prefix=/usr & make) and install (make install);
4) Add the appropriate section in your xorg.conf file;
Section "InputDevice"
Identifier "Joystick0"
Driver "joystick"
Option "Device" "/dev/input/js0"
EndSection
5) Add the new input device into the server layout
Section "ServerLayout"
...
InputDevice "Joystick0" "SendCoreEvents"
EndSection

It should be working and there will be a joystick man page on the system now. You will have to add button mappings into the InputDevice section to simulate clicks, etc.

I've created an rpm which I can send to someone who has a repo up and running and wants it (maybe billb). This would save everyone the compile steps and they could easily google the xorg.conf changes.

EDIT:
Now that the RPM is available you don't need to do all the compiling, searching, etc. Just upgrade your existing rpm (which should be installed by default) with the one billb has hosted.

http://pleasantfiction.ipower.com/ps3li ... group.html
(updated link -- billb)
Last edited by protectivedad on 15 Aug 2008, 01:41, edited 2 times in total.
protectivedad
ydl beginner
ydl beginner
 
Posts: 26
Joined: 13 Aug 2008, 04:19

Re: Using the PS3 Controller as a Mouse

Postby juanmoreno92 » 13 Aug 2008, 05:23

I love you!(no homo)
juanmoreno92
ydl beginner
ydl beginner
 
Posts: 28
Joined: 26 Feb 2008, 01:25

Re: Using the PS3 Controller as a Mouse

Postby billb » 13 Aug 2008, 09:06

protectivedad wrote:It should be working and there will be a joystick man page on the system now. You will have to add button mappings into the InputDevice section to simulate clicks, etc.

I've created an rpm which I can send to someone who has a repo up and running and wants it (maybe billb). This would save everyone the compile steps and they could easily google the xorg.conf changes.


Sounds great ... send me a PM ... :D
PS3 60GB [CECHA01], FW 3.15, YDL 6.2, Samsung T260HD @ 1920x1200
Powermac G4 1.25 GHz x2, 2 GB RAM, YDL 6.2
User avatar
billb
Site Admin
Site Admin
 
Posts: 5522
Joined: 24 May 2007, 20:30
Location: Eastern NC, USA

Re: Using the PS3 Controller as a Mouse

Postby protectivedad » 13 Aug 2008, 14:28

I've been experimenting with the different options and assignments here is my current layout:
Code: Select all
Section "InputDevice"
        Identifier      "Joystick0"             
        Driver          "joystick"               
        Option          "Device"        "/dev/input/js0"
# This is the default Axis mapping for moving the mouse pointer
        Option          "MapAxis1"      "mode=relative axis=+1x deadzone=1000"
        Option          "MapAxis2"      "mode=relative axis=+1y deadzone=1000"
# These allow you to scroll up-down and left-right using the second Axis
        Option          "MapAxis3"      "mode=relative axis=+1zx deadzone=1000"
        Option          "MapAxis4"      "mode=relative axis=+1zy deadzone=1000"
# Map the PS button to disable/enable mouse events                 
# When using the joystick in another program you need to disable the mouse events
        Option          "MapButton17"   "disable-mouse"       
# Map the X, Y and B buttons respectively 
        Option          "MapButton16"   "button=1"             
        Option          "MapButton13"   "button=2"           
        Option          "MapButton14"   "button=3"           
EndSection
protectivedad
ydl beginner
ydl beginner
 
Posts: 26
Joined: 13 Aug 2008, 04:19

Re: Using the PS3 Controller as a Mouse

Postby zerojay » 13 Aug 2008, 15:53

Awesome. I'll try this out tonight.
zerojay
ydl addict
ydl addict
 
Posts: 151
Joined: 09 May 2008, 20:32
Location: Quebec City, Canada

Re: Using the PS3 Controller as a Mouse

Postby protectivedad » 14 Aug 2008, 03:34

Also, the controller needs to be on before X starts or you need to ctrl-alt-f1 and ctrl-alt-f7 after the controller is connected.
protectivedad
ydl beginner
ydl beginner
 
Posts: 26
Joined: 13 Aug 2008, 04:19

Re: Using the PS3 Controller as a Mouse

Postby billb » 14 Aug 2008, 03:46

Thanks -- I've been meaning to try this all day but I've been unusually busy. At one point I even had to put on pants! I have the RPMs and will try to test it tonight, but right now it's Miller Time! :mrgreen:
PS3 60GB [CECHA01], FW 3.15, YDL 6.2, Samsung T260HD @ 1920x1200
Powermac G4 1.25 GHz x2, 2 GB RAM, YDL 6.2
User avatar
billb
Site Admin
Site Admin
 
Posts: 5522
Joined: 24 May 2007, 20:30
Location: Eastern NC, USA

Re: Using the PS3 Controller as a Mouse

Postby protectivedad » 14 Aug 2008, 04:23

No worries, mine's working great :) . I actually got GOK and the login accessibility working. I was able to control Linux from login to shutdown using only the PS3 Controller. I decided, though that since I have the Logitech Pro Bluetooth Keyboard/Pad combo, that I preferred typing using it and not the controller. :) Go figure.
protectivedad
ydl beginner
ydl beginner
 
Posts: 26
Joined: 13 Aug 2008, 04:19

Re: Using the PS3 Controller as a Mouse

Postby shermanlucy » 14 Aug 2008, 23:34

protectivedad wrote:1) Make sure you are able to compile programs and specifically X drivers;


Well I wasn't able to compile X drivers and I'm pretty sure there are other out there who want to do this but don't know where to start. So what I had to install first were these:
xkbfile (This one was needed by libdrm, if I remember correctly)
libdrm
dmx
xkbui,
And the finally I could install xorg-server

Once all that was taken care of I was able to install xf86-input-joystick-1.2.3 which was hard to find amongst many mirrors that didn't carry it, but here is where one is located at.
shermanlucy
ydl newbie
ydl newbie
 
Posts: 18
Joined: 08 Aug 2008, 08:36

Re: Using the PS3 Controller as a Mouse

Postby billb » 15 Aug 2008, 00:11

Here's protectivedad's RPM:

xorg-x11-drv-joystick-1.2.3-PD1.ppc.rpm

Just tested it and had no problems with installing it.


NOTE: It would be a good idea to create a backup of your /etc/X11/xorg.conf file before editing it. That way if you make a mistake and can't boot you can recover your original configuration.


Open a terminal window (Applications -> Accessories -> Terminal Window)

Then enter these commands:

su -l (that's a lowercase l, not a number 1)
<enter your root password>
cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup

And to edit the file:

gedit /etc/X11/xorg.conf

Save and close gedit, then type exit back in the terminal window to return to your regular user status.


After adding this section to my /etc/X11/xorg.conf file (from PD's posted configuration):

Code: Select all
Section "InputDevice"
        Identifier      "Joystick0"             
        Driver          "joystick"               
        Option          "Device"        "/dev/input/js0"
# This is the default Axis mapping for moving the mouse pointer
        Option          "MapAxis1"      "mode=relative axis=+1x deadzone=1000"
        Option          "MapAxis2"      "mode=relative axis=+1y deadzone=1000"
# These allow you to scroll up-down and left-right using the second Axis
        Option          "MapAxis3"      "mode=relative axis=+1zx deadzone=1000"
        Option          "MapAxis4"      "mode=relative axis=+1zy deadzone=1000"
# Map the PS button to disable/enable mouse events                 
# When using the joystick in another program you need to disable the mouse events
        Option          "MapButton17"   "disable-mouse"       
# Map the X, Y and B buttons respectively
        Option          "MapButton16"   "button=1"             
        Option          "MapButton13"   "button=2"           
        Option          "MapButton14"   "button=3"           
EndSection


And also this to Section "ServerLayout" (from Step 5 in PD's post above)

Code: Select all
InputDevice "Joystick0" "SendCoreEvents"


And rebooting with my Sixaxis plugged in and turned on (necessary to press the PS button?), I was able to use the Sixaxis as a mouse after logging in. At the login screen the mouse pointer just moved into the upper left corner, seemingly on it's own, but behaved normally once I logged in. After spending some time doing figure 8's on the screen :P I tried unplugging the controller and hit the PS button to connect over bluetooth, but then it became /dev/input/js1 and of course stopped working.

I haven't been able to use it if I don't have the Sixaxis plugged in at startup and connect via bluetooth, though ... should this be working? I realize the controller has to be turned on, but don't know if /dev/input/js0 is created before X starts.
PS3 60GB [CECHA01], FW 3.15, YDL 6.2, Samsung T260HD @ 1920x1200
Powermac G4 1.25 GHz x2, 2 GB RAM, YDL 6.2
User avatar
billb
Site Admin
Site Admin
 
Posts: 5522
Joined: 24 May 2007, 20:30
Location: Eastern NC, USA

Re: Using the PS3 Controller as a Mouse

Postby protectivedad » 15 Aug 2008, 01:36

Boot without the controller plugged in. At the login screen turn on your controller connecting through bluetooth. Once it is connected ctlr-alt-f1 and then ctlr-alt-f7 (or ctrl-alt-backspace and restart the gdm login) and the joystick will be working.
protectivedad
ydl beginner
ydl beginner
 
Posts: 26
Joined: 13 Aug 2008, 04:19

Re: Using the PS3 Controller as a Mouse

Postby billb » 15 Aug 2008, 01:49

OK -- thanks. :) I'm rebuilding an RPM at the moment, but will give that a try later.
PS3 60GB [CECHA01], FW 3.15, YDL 6.2, Samsung T260HD @ 1920x1200
Powermac G4 1.25 GHz x2, 2 GB RAM, YDL 6.2
User avatar
billb
Site Admin
Site Admin
 
Posts: 5522
Joined: 24 May 2007, 20:30
Location: Eastern NC, USA

Re: Using the PS3 Controller as a Mouse

Postby shermanlucy » 15 Aug 2008, 03:24

Well for me i used gdmsetup's automatic login as a way to bypass the use of a keyboard completely from start up to shut down. It tuned out that I could press the PS button at anytime once my desktop showed up and it would work without any ctlr-alt-f1 or anything. Since I share my usb keyboard with my roomate it simplifies things to do it this way although it may not be for everyone.
shermanlucy
ydl newbie
ydl newbie
 
Posts: 18
Joined: 08 Aug 2008, 08:36

Re: Using the PS3 Controller as a Mouse

Postby billb » 15 Aug 2008, 03:26

@protectivedad -- thanks for the RPM. I'll be adding it to my ps3bodega.repo tonight. :D
PS3 60GB [CECHA01], FW 3.15, YDL 6.2, Samsung T260HD @ 1920x1200
Powermac G4 1.25 GHz x2, 2 GB RAM, YDL 6.2
User avatar
billb
Site Admin
Site Admin
 
Posts: 5522
Joined: 24 May 2007, 20:30
Location: Eastern NC, USA

Re: Using the PS3 Controller as a Mouse

Postby MarkyboyUK » 15 Aug 2008, 12:43

Quick question for those using the sixaxis as a mouse and as a joypad in SDLMAME - does the sixaxis behave properly as a joypad in SDLMAME or does SDLMAME get confused with the sixaxis acting as both a mouse and a joypad at the same time?
MarkyboyUK
ydl beginner
ydl beginner
 
Posts: 29
Joined: 12 May 2008, 20:20

Next

Return to Playstation 3

Who is online

Users browsing this forum: No registered users and 9 guests