Giter VIP home page Giter VIP logo

dualshock4-pi's Introduction

DUALSHOCK 4 + Raspberry Pi 3

This is just a simplified compilation of commands needed to get the Dualshock 4 up and running on the Raspberry Pi 3.

Credit to these links/websites for the guidance:

https://github.com/retropie/retropie-setup/wiki/PS4-Controller

https://github.com/chrippa/ds4drv

https://www.piborg.org/joyborg

Procedures to install linux driver for Dualshock 4 on Raspberry Pi 3

Copy and paste all these commands to complete the installation. Make sure the Dualshock 4 controller is charged to ensure reliable bluetooth connection later on.

Commands list:

Step 0:

sudo apt-get update

Step 1:

You will now need to run the following to ensure the generic joystick drivers are installed first:

sudo apt-get -y install joystick

Step 2:

Then you will want to run jstest as follows:

jstest /dev/input/js0

Note: If you run the above command jstest for the first time, you will get this error: jstest: No such file or directory It is because there is no Joystick connected yet. Don't worry. Just proceed to Step 3.

Step 3:

sudo apt install python-dev python3-dev python-pip python3-pip

Step 4:

(install either one or both)

Install for Python 3: sudo pip3 install ds4drv

Install for Python 2: sudo pip install ds4drv

Step 5:

Allow non-root users to control the ds4drv joystick: Location:/etc/udev/rules.d/

sudo wget https://raw.githubusercontent.com/chrippa/ds4drv/master/udev/50-ds4drv.rules -O /etc/udev/rules.d/50-ds4drv.rules

sudo udevadm control --reload-rules

sudo udevadm trigger

By now, the driver is fully installed and you can test pairing with Dualshock 4

Make sure Bluetooth on the Pi is turned ON. Then, press and hold PS button + Share button on Dualshock 4 Hold until the LED on the controller blinks rapidly

Step 6:

On the terminal run this command to run the driver normally:

sudo ds4drv

If you want to run the driver in the background (daemon), add & at the end:

sudo ds4drv &

If everything is correct, the Pi will detect the controller. Now you can retry Step 2 to test the Dualshock 4 input. You can open up a new Terminal session to perform the following command.

jstest /dev/input/js0

______________________________________________________________________________________________________________________

Step 7:

[IMPORTANT] Now configure ds4drv to run at startup by editing the rc.local file:

sudo nano /etc/rc.local

After the # By default this script does nothing. line, add a new line with the contents:

/usr/local/bin/ds4drv &

Step 8:

Now just reboot the Pi so that the driver will be started at boot.

Once rebooted, enter command in Step 9 to check if the ds4drv driver is running in the background as root.

Step 9:

ps aux | grep python

dualshock4-pi's People

Contributors

macunixs avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.