Skip to main content

use your DualSense (PS5) controller with python

Project description

pydualsense

control your dualsense through python. using the hid library this package implements the report features for controlling your PS5 controller.

Documentation

You can find the documentation at docs

Installation

Windows

Download hidapi and place the x64 .dll file into your Workspace. After that install the package from pypi.

pip install --upgrade pydualsense

Linux

On Linux based system you first need to add a udev rule to let the user access the PS5 controller without requiring root privileges.

sudo cp 70-ps5-controller.rules /etc/udev/rules.d
sudo udevadm control --reload-rules
sudo udevadm trigger

Then install the hidapi through your package manager of your system.

On an Ubuntu system the package libhidapi-dev is required.

sudo apt install libhidapi-dev

After that install the package from pypi.

pip install --upgrade pydualsense

usage

from pydualsense import pydualsense, TriggerModes

def cross_pressed(state):
    print(state)

ds = pydualsense() # open controller
ds.init() # initialize controller

ds.cross_pressed += cross_pressed
ds.light.setColorI(255,0,0) # set touchpad color to red
ds.triggerL.setMode(TriggerModes.Rigid)
ds.triggerL.setForce(1, 255)
ds.close() # closing the controller

See examples or examples docs folder for some more ideas

Help wanted

Help wanted from people that want to use this and have feature requests. Just open a issue with the correct label.

dependecies

  • hidapi-usb >= 0.3

Credits

Most stuff for this implementation were provided by and used from:

Coming soon

  • add bluetooth support
  • add multiple controllers
  • partially done
  • add documentation using sphinx

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydualsense-0.6.4.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

pydualsense-0.6.4-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file pydualsense-0.6.4.tar.gz.

File metadata

  • Download URL: pydualsense-0.6.4.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for pydualsense-0.6.4.tar.gz
Algorithm Hash digest
SHA256 e56dcae40b97f09d0bf109621cc889a265aa906cf903a5462dc789f332fff5ff
MD5 c5dafb66b6f820212234429401ae5389
BLAKE2b-256 ea6ed411630472c8a37157a9002adbde2bf88c460b12a4c2e23bd47f2411de54

See more details on using hashes here.

Provenance

File details

Details for the file pydualsense-0.6.4-py3-none-any.whl.

File metadata

  • Download URL: pydualsense-0.6.4-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for pydualsense-0.6.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8169f0e3cd2a6eb22d77688843c00f1b1ea74b773e1ab377accb1784b8befffe
MD5 f3bb4e495f6a5b04a5c6b6f4b7c12d0e
BLAKE2b-256 75576022b1686f95a13cafa22014d952aa0e3699f09bd31433df25905bb63cd5

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page