# 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](https://flok.github.io/pydualsense/)
# Installation
## Windows
Download [hidapi](https://github.com/libusb/hidapi/releases) and place the x64 .dll file into your Workspace. After that install the package from [pypi](https://pypi.org/project/pydualsense/).
```bash
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.
```bash
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.
```bash
sudo apt install libhidapi-dev
```
After that install the package from [pypi](https://pypi.org/project/pydualsense/).
```bash
pip install --upgrade pydualsense
```
# usage
```python
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](https://github.com/flok/pydualsense/tree/master/examples) or [examples docs](https://flok.github.io/pydualsense/examples.html) 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://www.reddit.com/r/gamedev/comments/jumvi5/dualsense_haptics_leds_and_more_hid_output_report/)
- [https://github.com/Ryochan7/DS4Windows](https://github.com/Ryochan7/DS4Windows)
# Coming soon
- add multiple controllers
- add documentation using sphinx
Raw data
{
"_id": null,
"home_page": null,
"name": "pydualsense",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": "ps5, controller, dualsense, pydualsense",
"author": "Florian (flok) K",
"author_email": "37000563+flok@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/fe/2c/f7259d5f59d05aacb6d02fab9b60b5a94bd503dbf684ae898bd640637acd/pydualsense-0.7.3.tar.gz",
"platform": null,
"description": "# pydualsense\ncontrol your dualsense through python. using the hid library this package implements the report features for controlling your PS5 controller.\n\n# Documentation\n\nYou can find the documentation at [docs](https://flok.github.io/pydualsense/)\n\n# Installation\n\n\n## Windows \nDownload [hidapi](https://github.com/libusb/hidapi/releases) and place the x64 .dll file into your Workspace. After that install the package from [pypi](https://pypi.org/project/pydualsense/). \n\n```bash\npip install --upgrade pydualsense\n```\n\n## Linux\n\nOn Linux based system you first need to add a udev rule to let the user access the PS5 controller without requiring root privileges.\n\n```bash\nsudo cp 70-ps5-controller.rules /etc/udev/rules.d\nsudo udevadm control --reload-rules\nsudo udevadm trigger\n```\n\nThen install the hidapi through your package manager of your system.\n\nOn an Ubuntu system the package ```libhidapi-dev``` is required.\n\n```bash\nsudo apt install libhidapi-dev\n```\n\nAfter that install the package from [pypi](https://pypi.org/project/pydualsense/). \n\n```bash\npip install --upgrade pydualsense\n```\n\n# usage\n\n```python\n\nfrom pydualsense import pydualsense, TriggerModes\n\ndef cross_pressed(state):\n print(state)\n\nds = pydualsense() # open controller\nds.init() # initialize controller\n\nds.cross_pressed += cross_pressed\nds.light.setColorI(255,0,0) # set touchpad color to red\nds.triggerL.setMode(TriggerModes.Rigid)\nds.triggerL.setForce(1, 255)\nds.close() # closing the controller\n```\n\nSee [examples](https://github.com/flok/pydualsense/tree/master/examples) or [examples docs](https://flok.github.io/pydualsense/examples.html) folder for some more ideas\n\n# Help wanted\n\nHelp wanted from people that want to use this and have feature requests. Just open a issue with the correct label.\n\n# dependecies\n\n- hidapi-usb >= 0.3\n\n# Credits\n\n\nMost stuff for this implementation were provided by and used from:\n\n\n- [https://www.reddit.com/r/gamedev/comments/jumvi5/dualsense_haptics_leds_and_more_hid_output_report/](https://www.reddit.com/r/gamedev/comments/jumvi5/dualsense_haptics_leds_and_more_hid_output_report/)\n- [https://github.com/Ryochan7/DS4Windows](https://github.com/Ryochan7/DS4Windows)\n\n# Coming soon\n\n- add multiple controllers\n- add documentation using sphinx\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "use your DualSense (PS5) controller with python",
"version": "0.7.3",
"project_urls": {
"Repository": "https://github.com/flok/pydualsense"
},
"split_keywords": [
"ps5",
" controller",
" dualsense",
" pydualsense"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "6058e36ff7bd090273a7d0745a669845defdc036e129daea5558800750a97160",
"md5": "17377fbe4b202bc337faee6c7c5c2f53",
"sha256": "5b63fd87273410dd55a4ad73b2d7952b442d9ad1867bef9f6a296fc106e87fef"
},
"downloads": -1,
"filename": "pydualsense-0.7.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "17377fbe4b202bc337faee6c7c5c2f53",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 99810,
"upload_time": "2025-01-28T22:00:43",
"upload_time_iso_8601": "2025-01-28T22:00:43.693092Z",
"url": "https://files.pythonhosted.org/packages/60/58/e36ff7bd090273a7d0745a669845defdc036e129daea5558800750a97160/pydualsense-0.7.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "fe2cf7259d5f59d05aacb6d02fab9b60b5a94bd503dbf684ae898bd640637acd",
"md5": "b8f18a1b49819fca70df35d6e56789ee",
"sha256": "f2ac6da437bee21d77a13c5dfc64ea996939e209385f7f9d6204db5a8ed91c28"
},
"downloads": -1,
"filename": "pydualsense-0.7.3.tar.gz",
"has_sig": false,
"md5_digest": "b8f18a1b49819fca70df35d6e56789ee",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 100588,
"upload_time": "2025-01-28T22:00:44",
"upload_time_iso_8601": "2025-01-28T22:00:44.853609Z",
"url": "https://files.pythonhosted.org/packages/fe/2c/f7259d5f59d05aacb6d02fab9b60b5a94bd503dbf684ae898bd640637acd/pydualsense-0.7.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-28 22:00:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "flok",
"github_project": "pydualsense",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "cffi",
"specs": [
[
"==",
"1.15.1"
]
]
},
{
"name": "hidapi-usb",
"specs": [
[
"==",
"0.3.1"
]
]
},
{
"name": "pycparser",
"specs": [
[
"==",
"2.21"
]
]
}
],
"lcname": "pydualsense"
}