From 1530c79dd7b72d9582e199a2f84c1d53d5777477 Mon Sep 17 00:00:00 2001 From: Florian K <37000563+flok@users.noreply.github.com> Date: Fri, 1 Jan 2021 11:36:35 +0100 Subject: [PATCH 1/8] Update install instructions Updated the install instructions with the hidapi download and placement. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 13c9066..34e4c85 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # pydualsense -control your dualsense through python. using the hid library this module implements the sending report for controlling you new PS5 controller. It creates a background thread to constantly receive and update the controller. +control your dualsense through python. using the hid library this package implements the report features for controlling your new PS5 controller. # install -Just install the package from [pypi](https://pypi.org/project/pydualsense/) +Download [hidapi](https://github.com/libusb/hidapi/releases) and place the x64 .dll file into your System32 folder. After that install the package from [pypi](https://pypi.org/project/pydualsense/). ```bash pip install pydualsense @@ -22,7 +22,7 @@ ds.triggerL.setForce(1, 255) ds.close() # closing the controller ``` -See ``examples`` folder for some more ideas +See [examples](https://github.com/flok/pydualsense/tree/master/examples) folder for some more ideas # Help wanted From a3f697866b68c547d262deeae3dfa7f63edd6778 Mon Sep 17 00:00:00 2001 From: Florian K <37000563+flok@users.noreply.github.com> Date: Fri, 1 Jan 2021 19:01:30 +0100 Subject: [PATCH 2/8] Changed place for hidapi.dll Adding dlls to your System32 is not a good idea. Place the dll into your Workspace --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 34e4c85..f5ab9c6 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ control your dualsense through python. using the hid library this package implem # install -Download [hidapi](https://github.com/libusb/hidapi/releases) and place the x64 .dll file into your System32 folder. After that install the package from [pypi](https://pypi.org/project/pydualsense/). +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 pydualsense From 11e78fbece911036bff828545545fcd885715bc4 Mon Sep 17 00:00:00 2001 From: Florian Kaiser <37000563+flok@users.noreply.github.com> Date: Fri, 1 Jan 2021 20:32:55 +0100 Subject: [PATCH 3/8] Fix Python > 3.8 dll import --- pydualsense/pydualsense.py | 6 +++++- setup.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pydualsense/pydualsense.py b/pydualsense/pydualsense.py index b7e1206..3f450df 100644 --- a/pydualsense/pydualsense.py +++ b/pydualsense/pydualsense.py @@ -1,4 +1,8 @@ -from os import device_encoding + +# needed for python > 3.8 +if sys.version_info >= (3,8): + os.add_dll_directory(os.getcwd()) + import hid # type: ignore from .enums import (LedOptions, PlayerID, PulseOptions, TriggerModes, Brightness) diff --git a/setup.py b/setup.py index 7dedb77..c4c8b28 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ with open("README.md", "r") as fh: setup( name='pydualsense', - version='0.4.1', + version='0.4.2', description='use your DualSense (PS5) controller with python', long_description=long_description, long_description_content_type="text/markdown", From d76717c1633740bdb94571b500a8fb44ac8e0b1c Mon Sep 17 00:00:00 2001 From: Florian Kaiser <37000563+flok@users.noreply.github.com> Date: Fri, 1 Jan 2021 20:34:42 +0100 Subject: [PATCH 4/8] Fix missing import --- pydualsense/pydualsense.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydualsense/pydualsense.py b/pydualsense/pydualsense.py index 3f450df..5e1c693 100644 --- a/pydualsense/pydualsense.py +++ b/pydualsense/pydualsense.py @@ -1,5 +1,6 @@ # needed for python > 3.8 +import os, sys if sys.version_info >= (3,8): os.add_dll_directory(os.getcwd()) @@ -7,7 +8,6 @@ import hid # type: ignore from .enums import (LedOptions, PlayerID, PulseOptions, TriggerModes, Brightness) import threading -import sys import winreg class pydualsense: From 7b0270fa7de857e85e03d699a717fb093f0652de Mon Sep 17 00:00:00 2001 From: Nougator <37145431+nougator@users.noreply.github.com> Date: Fri, 1 Jan 2021 20:56:57 +0100 Subject: [PATCH 5/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f5ab9c6..f1c8b67 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ pip install pydualsense ```python -from pydualsense import pydualsense +from pydualsense import pydualsense, TriggerModes ds = pydualsense() # open controller ds.init() # initialize controller From ff01788c895006807591c3c04b09016105af5982 Mon Sep 17 00:00:00 2001 From: Florian K <37000563+flok@users.noreply.github.com> Date: Fri, 1 Jan 2021 23:39:54 +0100 Subject: [PATCH 6/8] Mypy enums import error fix --- pydualsense/pydualsense.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pydualsense/pydualsense.py b/pydualsense/pydualsense.py index 5e1c693..8907719 100644 --- a/pydualsense/pydualsense.py +++ b/pydualsense/pydualsense.py @@ -5,8 +5,7 @@ if sys.version_info >= (3,8): os.add_dll_directory(os.getcwd()) import hid # type: ignore -from .enums import (LedOptions, PlayerID, - PulseOptions, TriggerModes, Brightness) +from .enums import (LedOptions, PlayerID, PulseOptions, TriggerModes, Brightness) # type: ignore import threading import winreg class pydualsense: @@ -538,4 +537,4 @@ class DSTrigger: if not isinstance(mode, TriggerModes): raise TypeError('Trigger mode parameter needs to be of type `TriggerModes`') - self.mode = mode \ No newline at end of file + self.mode = mode From 1e0b23da41ae9e779421694bdec8067fd56d2506 Mon Sep 17 00:00:00 2001 From: Florian K <37000563+flok@users.noreply.github.com> Date: Fri, 1 Jan 2021 23:41:15 +0100 Subject: [PATCH 7/8] Update python-mypy.yml --- .github/workflows/python-mypy.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-mypy.yml b/.github/workflows/python-mypy.yml index c5f0f7f..3af1328 100644 --- a/.github/workflows/python-mypy.yml +++ b/.github/workflows/python-mypy.yml @@ -11,11 +11,11 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: '3.x' + python-version: '3.9' - name: Install Dependencies run: | python -m pip install --upgrade pip - pip install mypy + python -m pip install mypy - name: mypy run: | - mypy pydualsense/ \ No newline at end of file + mypy pydualsense/ From e766dca70f54b818269c5052b3cb77f3cdeb9cee Mon Sep 17 00:00:00 2001 From: Florian K <37000563+flok@users.noreply.github.com> Date: Fri, 1 Jan 2021 23:42:29 +0100 Subject: [PATCH 8/8] Deleting mypy action Mypy gives weird results on github. Lets only work with it locally --- .github/workflows/python-mypy.yml | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 .github/workflows/python-mypy.yml diff --git a/.github/workflows/python-mypy.yml b/.github/workflows/python-mypy.yml deleted file mode 100644 index 3af1328..0000000 --- a/.github/workflows/python-mypy.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Mypy - -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - name: Mypy - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.9' - - name: Install Dependencies - run: | - python -m pip install --upgrade pip - python -m pip install mypy - - name: mypy - run: | - mypy pydualsense/