MattHag
58ddb0d6cd
Introduce HIDAPI protocol
...
Improve type hints and names.
2024-10-11 07:42:38 -04:00
MattHag
46366b2430
Fix warnings from automatic code inspections
...
Warnings found by automatic code inspection and partially tackled
- Drop distuitls inf favour of setuptools
- Replace deprecated pyudev.Device.from_device_number
- Remove unnecessary brackets
- Avoid access to private variables etc.
- Shadows built-in name
- Line length >120 characters
- Not a module level variable
- Simplify clause
and more
2024-10-11 07:42:38 -04:00
MattHag
54aace050c
Replace action strings with constants
...
Avoids spelling mistakes and helps readability.
2024-10-11 07:42:38 -04:00
MattHag
614a5dc633
Add type hints and clean up
2024-10-11 07:42:38 -04:00
MattHag
8d0672ac3c
base_usb: Add external interface
...
Clean up, type hint and tests base_usb and related modules.
2024-10-11 07:42:38 -04:00
MattHag
46fafa0e68
hidapi: Explicitly load hidapi/udev implementation
...
Linux uses udev, other platforms use the cross-platform hidapi
implementation. Remove implicit loading of hidapi in hidapi/__init__.py.
2024-10-11 07:42:38 -04:00
MattHag
3c1aa35067
hidapi: Completely remove dependency on gi
...
Related #2480
2024-10-08 14:35:16 -04:00
MattHag
ea0eb66f39
Refactor: Remove all GDK dependencies from hidapi package
...
The hidapi hardware layer must not know or depend on any UI libraries.
Removes all GDK dependencies from the hidapi packages, which makes
testing of these modules easier and removes unwanted cross-dependencies.
Related #2480
2024-09-15 09:18:51 -04:00
MattHag
70def31942
Refactor: Distinguish module from package
...
Adapt module names to easily distinguish them.
Related #2480
2024-09-15 09:18:51 -04:00
MattHag
67829c5807
Clean up imports ( #2537 )
...
* Remove import as _ in solaar startup
Related #2273
* Remove import as _ in listener
Related #2273
* Remove import as _ in cli init
Related #2273
* Remove import as _ in gtk
Related #2273
* Remove import as _ in show
Related #2273
* Remove import as _ in tray
Related #2273
* Remove import as _ in profiles
Related #2273
* Remove import as _ in config
Related #2273
* Remove import as _ in config panel
Related #2273
* Remove import as _ in window
Related #2273
* Remove import as _ in pair
Related #2273
* Remove import as _ in pair window
Related #2273
* Remove import as _ in cli package
Related #2273
* Remove import as _ in ui package
Related #2273
* Remove commented out code
Related #2273
* Use constant for Logitech ID
2024-07-15 08:37:18 -04:00
Peter F. Patel-Schneider
db93e9ab10
hidapi: remove check on driver
2024-06-13 07:44:47 -04:00
MattHag
e316ed1bc2
Remove unnecessary receiver info 'hid_driver'
...
The same constant is used everywhere.
2024-06-03 08:37:02 -04:00
MattHag
c23ebcd267
Use double quotes for module level docstrings
...
Make module level docstrings distinguishable from license text.
Related #2273
2024-06-02 09:54:21 -04:00
MattHag
5a63e44d58
Remove empty comment lines
...
Remove hashtags solely used for structuring.
Related #2273
2024-06-02 09:54:21 -04:00
Matthias Hagmann
7d171b1d09
Refactor: Use dataclasses and enums
...
Replace NamedTuples with more flexible dataclass, which also support
type hints. Introduce enums to replace constant strings, which need to
be kept in sync. Also enhances interfaces by limiting it to the enum
values. Remove unused variables.
2024-05-22 21:14:41 -04:00
MattHag
500b9998c5
Fix macOS compatibility and reenable CI tests
...
* Fix CI for macOS
* Fix error message for missing hidapi
* Skip some device and receiver tests on macOS
Tests fail on macOS, enable them when unit tests are
refined to only test the module without dependencies.
* Safe guard dbus import
2024-05-22 18:45:40 -04:00
MattHag
d0a3e474c7
hidapi: Unify imports in hidapi package ( #2487 )
...
Remove all 'import xyz as _xyz' and favor import of module name to
get more context in the code.
Related #2273
2024-05-16 15:58:22 -04:00
MattHag
704a87696f
hidapi: Remove Python 2 compatibility ( #2460 )
...
Related #2273
2024-04-30 08:19:50 -04:00
Matthias Hagmann
4e6361429e
refactor: Use f-strings for more exceptions and log message
...
Semi manually convert remaining strings with no translation to f-string.
2024-03-24 07:01:56 -04:00
Peter F. Patel-Schneider
c617988788
hidapi: remove deprecation warnings
2024-03-19 09:07:21 -04:00
Matthias Hagmann
5b09ace1f5
ruff: Apply single line import format
...
# Usage
pre-commit run --all-files
Related #2295
2024-03-13 15:41:21 -04:00
Matthias Hagmann
e92f1a8a0b
Automatically upgrade strings to f-string
...
Used flynt to convert strings to f-strings, where safely possible.
Usage:
flynt .
Related #2372
2024-03-13 11:02:50 -04:00
MattHag
574a95da50
cleanup: Remove unnecessary calls of del
...
Related #2273
2024-03-02 10:48:06 -05:00
Matthias Hagmann
7ef3059b69
clean up: Remove editor specific marks
...
Related #2273
2024-02-29 10:10:46 -05:00
Peter F. Patel-Schneider
069f96fe48
hidapi: make hid_parser optional, but add it to setup
2024-02-23 13:30:52 -05:00
Matthias Hagmann
eb937fcc3a
Manually fix linter issues
...
Related #2295
2024-02-20 15:41:10 -05:00
Matthias Hagmann
7774569971
Apply ruff format
...
Run ruff auto formatting using:
ruff format .
Related #2295
2024-02-20 15:41:10 -05:00
Peter F. Patel-Schneider
50ddb54466
hidapi: upgrade debugging in udev
2024-02-19 09:16:56 -05:00
Peter F. Patel-Schneider
d1c899d6da
solaar: improve imports and guard Gtk, etc imports with correct version
...
solaar: move imports to top of files
solaar: move more imports to top of files
solaar: guard Gtk, etc imports with correct version
2024-02-18 06:21:35 -05:00
MattHag
87658fb189
logging: Simplify logger instantiation
...
* logging: Simplify logger instantiation
Relates #2254
* logging: Remove aliases
Relates #2254
* logging: Replace deprecated warn with warning
Related #2254
* logging: Fix mistake
Related #2257
2024-02-10 13:55:27 -05:00
Peter F. Patel-Schneider
05ec439ec0
udev: report hidraw node in debugging messages
2024-01-20 11:23:01 -05:00
markopy
29ff35d553
Partial support for macOS and Windows ( #1971 )
...
* Add support for macOS via hidapi
* Style fixes
* Ignore keyboard and mouse input devices
* Don't require pyudev on mac and windows
* Fix debug log format error
* More logging for failed hidpp checks
* Don't try to load hid_darwin_set_open_exclusive on windows
* Bring back button for rule editor since some rules will work
---------
Co-authored-by: markopy <(none)>
Co-authored-by: Peter F. Patel-Schneider <pfpschneider@gmail.com>
2023-11-28 16:25:17 -05:00
Peter F. Patel-Schneider
485596cbf3
tools: permit BT devices for hidconsole with hidpp
2023-09-17 10:39:48 -04:00
Peter F. Patel-Schneider
253930d628
tools: fix bug in scan-registers
2023-09-16 10:35:26 -04:00
Peter F. Patel-Schneider
8dd8c8b76f
tools: allow device 0 in hidconsole
2023-08-12 14:51:31 -04:00
Peter F. Patel-Schneider
c86d4be0fe
hidapi: retry open several times with short wait to allow for delay in setting up permissions
2023-06-29 14:13:57 -04:00
Peter F. Patel-Schneider
fd9653fa33
tools: update scan-registers.sh to fix a bug and scan pairing registers
2023-05-19 07:14:10 -04:00
ejsc1
5656f90cdb
misc: update yapf version
...
* misc: update yapf version v2
* Update .pre-commit-config.yaml
Co-authored-by: Peter F. Patel-Schneider <pfpschneider@gmail.com>
2022-11-26 22:37:32 -05:00
ejsc1
0c7a9dd0a7
misc: update isort to current version
...
* Update .pre-commit-config.yaml
* Update solaar
* Update udev.py
* Update __init__.py
* Update gtk.py
* Update i18n.py
* Update listener.py
* Update icons.py
* Update notify.py
* Update hidconsole
* Update gtk.py
* Update icons.py
Co-authored-by: Peter F. Patel-Schneider <pfpschneider@gmail.com>
2022-11-26 13:58:46 -05:00
Peter F. Patel-Schneider
925172d030
hidapi: be more permissive when recognizing HID++ report descriptors
2022-10-27 11:11:19 -04:00
Peter F. Patel-Schneider
8d0795af53
solaar: make hid-parser an optional dependency
2022-10-25 10:51:23 -04:00
Peter F. Patel-Schneider
d1572b0c02
hidapi: rationalize DeviceInfo structure
2022-10-13 16:14:30 -04:00
Peter F. Patel-Schneider
3e90c3bc8a
hidapi: process hid report descriptors to identify devices
2022-10-13 16:14:30 -04:00
Peter F. Patel-Schneider
bb20631a27
misc: remove support for Python 2 unicode
2022-04-11 13:20:42 -04:00
Hugo Osvaldo Barrera
d6ba8e0b29
Stop using aliased Exception
...
IOError is now OSError. The old name is merely a legacy compatibility
alias.
2021-10-30 16:49:41 -04:00
Hugo Osvaldo Barrera
22bf4fafff
Drop unnecessary __future__ imports
...
These are all active by default on all recent Python versions.
2021-10-30 16:49:41 -04:00
Hugo Osvaldo Barrera
b96d16672b
Drop obsolete encoding declaration
...
This was only parsed in Python 2.
Python 3 only supports UTF-8 for source files, and that's what it uses.
2021-10-30 16:49:41 -04:00
Peter F. Patel-Schneider
4e76c99e0f
hid: add debug message when potential device found
2021-08-18 09:40:23 -04:00
Peter F. Patel-Schneider
3cd76aa191
tools: fix up call to udev matching in hidconsole
2021-03-02 19:02:08 -05:00
Peter F. Patel-Schneider
b19006104f
device: support unknown USB-connected and Bluetooth devices
2020-10-12 08:05:13 -04:00