Pydualsense
control your dualsense controller with python
Install / Use
/learn @flok/PydualsenseREADME
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:
- https://www.reddit.com/r/gamedev/comments/jumvi5/dualsense_haptics_leds_and_more_hid_output_report/
- https://github.com/Ryochan7/DS4Windows
Coming soon
- add multiple controllers
- add documentation using sphinx
Related Skills
gh-issues
354.3kFetch GitHub issues, spawn sub-agents to implement fixes and open PRs, then monitor and address PR review comments. Usage: /gh-issues [owner/repo] [--label bug] [--limit 5] [--milestone v1.0] [--assignee @me] [--fork user/repo] [--watch] [--interval 5] [--reviews-only] [--cron] [--dry-run] [--model glm-5] [--notify-channel -1002381931352]
node-connect
354.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
oracle
354.3kBest practices for using the oracle CLI (prompt + file bundling, engines, sessions, and file attachment patterns).
taskflow
354.3kUse when work should span one or more detached tasks but still behave like one job with a single owner context. TaskFlow is the durable flow substrate under authoring layers like Lobster, ACPX, plugins, or plain code. Keep conditional logic in the caller; use TaskFlow for flow identity, child-task linkage, waiting state, revision-checked mutations, and user-facing emergence.
