Send PS3 commands from non-device?
Send PS3 commands from non-device?
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!
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!
Re: Send PS3 commands from non-device?
Hi,
There are two ways to do this:
There are two ways to do this:
- use the --keygen argument
see http://gimx.fr/wiki/index.php?title=Com ... nt_options
Sadly this is broken since GIMX 1.00: http://code.google.com/p/diyps3controll ... ail?id=234 - emulate a keyboard using evemu:
Code: Select all
sudo apt-get install evemu-tools lsinput sudo evemu-describe /dev/input/eventX > keyboard.prop sudo evemu-device keyboard.prop
/dev/input/eventX is a physical keyboard, and /dev/input/eventY is the emulated keyboard.Code: Select all
sudo evemu-event /dev/input/eventY --sync --type 1 --code 17 --value 1 #add some delay there sudo evemu-event /dev/input/eventY --sync --type 1 --code 17 --value 0
To list the input devices, type:The key codes can be found there: https://github.com/torvalds/linux/blob/ ... put.h#L201Code: Select all
sudo lsinput
In the above example, key code 17 corresponds to the w key.
GIMX creator
Re: Send PS3 commands from non-device?
Awesome! Thanks, @Matlo - I'll give this a try soon. I appreciate the super fast reply!
Re: Send PS3 commands from non-device?
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!
Thanks!
Re: Send PS3 commands from non-device?
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
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
Re: Send PS3 commands from non-device?
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]
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
Re: Send PS3 commands from non-device?
GIMX creator
Re: Send PS3 commands from non-device?
@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!
Thank you again!
Re: Send PS3 commands from non-device?
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:
(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):
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:
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
I execute:
Code: Select all
emu 00:00:00:00:00:00 hci0 2
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
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
Update: ...and I see now that the feature explicitly says
which implies it may not be supported via bluetooth connection."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."
Re: Send PS3 commands from non-device?
You have to execute emuclient two times:
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).emuclient --event "cross(255)"
emuclient --event "cross(0)"
GIMX creator