playstation 4 input automation

I’ll start this one off by stating that I’m not as much of as a gamer as I used to be, it’s a shame, but interests change over time.

What better way to combine hobbies of new with hobbies of old than with automation?

There’s a great little puzzle game out there called Active Neurons that I enjoyed once upon a time ago. The thing about this particular puzzler is that the first two stages (white and blue) are completely static. Meaning, there are no adversary mechanics to interfere with the player’s movement until the third stage.

Fore some reason, I took it upon myself to learn how to automate these first two levels, not because it’s difficult, but because it had to be possible and I was curious to find out how.

Watch it in action or try it yourself with my code.

How did I do this?


Surprisingly, it didn’t take much searching to come across a quality FOSS PS4 Remote Play client. Chiaki was extremely promising and worked flawlessly.

Building on Fedora 33

NOTE: Desktop Environments on Xorg only, Wayland is not supported

The instructions to build from source are found within the repo and I’ve provided package names below to save yourself some internet searches and cmake failures.

Note: ffmpeg-devel must be obtained from RPMfusion free:

dnf install -y$(rpm -E %fedora).noarch.rpm
dnf install -y cmake gcc-c++ python3-protobuf protobuf-compiler opus-devel openssl-devel qt5-qtbase-devel qt5-qtmultimedia-devel qt5-qtsvg-devel SDL2-devel ffmpeg-devel


The author of Chiaki lists usage instructions within the repository, be careful and fully examine them before executing any code.

There is one particular step where you’ll need to run a provided script in order to obtain your PSN account ID, make sure to audit the code before running it.. providing your credentials to python script mentioned by a random blog such as mine is a great way to get phished, don’t trust anything. The beauty of FOSS is that you can view and modify the code yourself, take advantage of that!

That being said, if you prefer to use an AppImage from the author, it is also available here.

Targeting the Remote Play client window


I used the following lazy but useful wmctrl and grep pipeline in order to find the correct Chiaki window identity in hexadecimal.

wmctrl -l | grep '[C]hiaki | Stream' | grep -Eo '0x[0-9a-f]+'


After grabbing the proper window ID, I used xdotool to activate and focus my target Chiaki window. With the stream window focused, you’ll now be able to send simulated keyboard input that correspond with the default key bindings for Chiaki (that map to buttons on the DualShock 4 controller.

Input files

My script takes an input file of multiplier and button combinations, separated by new lines of the following format:


where multiplier is optional and button_shorthand can be found below. I tried to make button_shorthand as mnemonic as possible.

Keymap table

You can find the whole keymap table in the project’s README here.

Putting it all together

I provided some sample input files for the first two stages (white and blue) of Active Neurons.

To loop through an entire stage at once:

for stage in $(seq -f white"%02g" 1 10); do ./ games/active_neurons/white/$stage; done

While this mainly serves to solve a niche puzzle game, I would imagine that this could be used for repetitive key sequence(s) as well.