Send PS3 commands from non-device?

Discuss everything to do with GIMX here
ImBrian
Posts: 14
Joined: Wed Oct 23, 2013 6:08 am

Send PS3 commands from non-device?

Post by ImBrian »

Forgive me if this has been covered - I'm new here and did a fair bit of searching around and hadn't seen anything.

I'm working on a project to integrate several devices in my home (Smart TV, Roku, etc) into a single interface run off a Raspberry Pi on my local network. So far, it's working great. I was hoping to add support for my PS3 with GIMX running on the Pi. I have the package installed onto my Rasbpian setup. It seems the primary (only?) use of GIMX is used for hardware peripherals to interface with the PS3. What I'm interested in - if possible - is a command line interface to send button events to my PS3. I'd love to be able to execute a single bash command to represent a "button triangle" event (for example). This would allow me to easily integrate it into any number of other apps.

Has anyone played with this? Is there any documentation? If it is not currently supported, would it be difficult to do so?

Thanks!
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: Send PS3 commands from non-device?

Post by Matlo »

Hi,

There are two ways to do this:
GIMX creator
ImBrian
Posts: 14
Joined: Wed Oct 23, 2013 6:08 am

Re: Send PS3 commands from non-device?

Post by ImBrian »

Awesome! Thanks, @Matlo - I'll give this a try soon. I appreciate the super fast reply!
ImBrian
Posts: 14
Joined: Wed Oct 23, 2013 6:08 am

Re: Send PS3 commands from non-device?

Post by ImBrian »

It looks like neither lsinput nor evemu-tools are in the standard repo for Raspbian. Is there intent to have that bug fixed in the near future? I see it was submitted and commented on very recently. Would be great to avoid any additional overhead (simulating an input and compiling requisite libs). I'd be happy to test!

Thanks!
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: Send PS3 commands from non-device?

Post by Matlo »

The issue is already fixed in the source code repo.

You can wait for the next release to come out, or build GIMX from the sources: http://gimx.fr/wiki/index.php?title=Dev ... t_on_Linux
GIMX creator
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: Send PS3 commands from non-device?

Post by Matlo »

I added a new feature to make sending controls from the command line easier: http://code.google.com/p/diyps3controll ... ail?id=236

Example:

emuclient -p /dev/ttyUSB0 --event "lstick x(127)" --event "rstick y(-128)" --event "circle(255)" --event "square(0)"

This moves the left stick right, the right stick forward, fully presses the circle button, and releases the square button.
The state of all other controls is cleared, i.e. all other buttons and axes are released (in the above command, --event "square(0)" is not necessary).
emuclient should complete in about 10ms (adding a 10ms delay before closing the serial port is necessary... otherwise bytes can get lost).

Names and value ranges:
"lstick x", "lstick y", "rstick x", "rstick y": [-128,127]
"acc x", "acc y", "acc z", "gyro": [-512,511]
"select", "start", "PS", "l3", "r3": {0, 255} (only two values as these buttons are not pressure-sensitive)
"up", "right", "down", "left", "triangle", "circle", "cross", "square", "l1", "r1", "l2", "r2": [0,255]
GIMX creator
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: Send PS3 commands from non-device?

Post by Matlo »

GIMX creator
ImBrian
Posts: 14
Joined: Wed Oct 23, 2013 6:08 am

Re: Send PS3 commands from non-device?

Post by ImBrian »

@Matlo - amazing. Thank you so much for taking the time to do this. I wasn't looking forward to compiling the work-around and all the dependencies on my Pi. The binaries are a huge help! I'm hoping to start digging into it this weekend.

Thank you again!
ImBrian
Posts: 14
Joined: Wed Oct 23, 2013 6:08 am

Re: Send PS3 commands from non-device?

Post by ImBrian »

So, I have no configuration file - as I'm not using any specific keyboard mapping - with the new command line event input, I imagine it's unnecessary. I'm using a supported bluetooth dongle on a Raspberry Pi that has already had it's mac address changed to spoof that of one of my paired controllers.

I execute:

Code: Select all

emu 00:00:00:00:00:00 hci0 2
(with my appropriate mac address).

The PS3 turns on, so it looks like emu is working correctly. Without any interaction, I get a lot of log spam such as this (which did not occur with the older version):

Code: Select all

0 1382817971.897151 R b0 . o... 1 { 00 00 }
1382817971.897291 Sixaxis input   01: 00 00 00 00 00 80 80 80 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 05 16 00 00 00 00 33 02 77 01 9e 02 00 02 00 02 00 02 00
non blocking send took: 225 µs
For now, I just want a simple command - hit the "X" button to start a game or movie. I run this command in a different terminal while emu is still running:

Code: Select all

pi@raspberrypi ~ $ emuclient --event "cross(255)" --event "cross(0)"
option -e with value `cross(255)'
option -e with value `cross(0)'
using default refresh period: 11.25ms
But it doesn't seem to work for me. I'm still tinkering to see if I'm messing something up - or perhaps something is not configured.

Update: ...and I see now that the feature explicitly says
"it's now possible to send controls to the USB adapter from the command line, without having to create a configuration and macros to use with the --keygen argument."
which implies it may not be supported via bluetooth connection.
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: Send PS3 commands from non-device?

Post by Matlo »

You have to execute emuclient two times:
emuclient --event "cross(255)"
emuclient --event "cross(0)"
And it may be necessary to add a delay between the two commands (50 ms should be enough for the ps3 to register the input).
GIMX creator
Post Reply