MattHag
0bf7a78553
Add type hints
...
Related #2273
2025-01-01 10:46:04 -05:00
MattHag
73c88210f7
Fix battery entry in device
...
Enforce use of enum value.
Fixes #2700
Related #2273
2024-12-23 10:50:43 -05:00
MattHag
1afcfe4b57
refactor: use IntEnum for firmware and cidgroup constances
...
* Refactor: test_named_ints_flag_names
Shorten test and clarify behavior using binary numbers.
* Introduce plain flag_names function
This replicates the NamedInts functionality as plain function.
* Refactor FeatureFlag to use IntFlag
Replace NamedInts implementation with IntFlag enum and plain flag_names
function.
Related #2273
* Refactor FirmwareKind to use IntEnum
- Move general FirmwareKind to common module.
- Replace NamedInts implementation with IntEnum.
- Harden related HIDPP 1.0 get_firmware test.
Related #2273
* Refactor CID_GROUP, CID_GROUP_BIT to use IntEnum
Related #2273
2024-10-23 16:25:35 -04:00
MattHag
0cd9c0c9b5
Refactor: Introduce Feature enum
...
Convert Feature NamedInts to SupportedFeature integer enum.
Related #2273
2024-10-14 07:28:09 -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
cba3533869
Remove factory wrapper classes
...
A module level function is sufficient, no wrapper needed.
2024-10-11 07:42:38 -04:00
MattHag
4e50e605a6
device: Remove hard dependency on base
2024-10-11 07:42:38 -04:00
MattHag
1729189981
base: Add find_paired_node functions
...
Avoid direct access to hidapi and use the base module as low-level API
instead. This change replaces the remaining calls to find_paired_node
and find_paired_node_wpid by exposing them via base module.
2024-10-11 07:42:38 -04:00
MattHag
615499dce2
device: Remove hard dependency on hidapi
2024-10-11 07:42:38 -04:00
MattHag
be83dac209
hid: Convert definition of HID registers to enum
...
* Refactor HID Register definitions
Use enums for distinct type hints, easy discovery of registers.
Make constants uppercase and benefit from enum auto-completion.
Related #2273
* Improve type hints: Registers
2024-06-02 10:34:00 -04:00
MattHag
c29231bc6b
refactor: Creation of devices ( #2493 )
...
* Refine interfaces for testability
* Reenable fixed device tests
2024-05-27 11:58:16 -04:00
MattHag
815dce07be
Unify imports in logitech package
...
Related #2273
2024-05-23 16:42:18 -04:00
Peter F. Patel-Schneider
90b0db6c3b
device: don't ping device when getting name or codename
2024-05-22 21:22:08 -04:00
Matthias Hagmann
c9dc232951
Refactor: Use dataclasses and enums
...
Replace unnecessary NamedInts in favour of default data types.
Simplify interfaces by reducing possible input from strings to members
of an enum.
2024-05-22 21:14:41 -04:00
Matthias Hagmann
469c04faaf
Introduce Device protocol and type hints
2024-05-22 21:14:41 -04:00
Matthias Hagmann
193dbfda21
hidpp10: Move independent functions to module level
2024-05-22 21:14:41 -04:00
Peter F. Patel-Schneider
c4e2a5683a
device: initialize device registers to empty list
2024-04-19 16:05:29 -04:00
Peter F. Patel-Schneider
e667d41c7b
solaar: use bluez dbus signals to disconnect and connect bluetooth devices
2024-04-18 20:32:40 -04:00
Peter F. Patel-Schneider
b616419f72
device: fix bug found in testing
2024-04-13 18:38:44 -04:00
Peter F. Patel-Schneider
269e970aa6
device: fix small bugs uncovered by testing
2024-04-13 18:38:44 -04:00
Peter F. Patel-Schneider
c81809bd39
device: add RGB EFFECTS feature version of LED COLOR EFFECTS data
2024-03-24 15:44:15 -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
ebc76bca24
tests: add tests for logitech_receiver device
2024-03-23 08:26:12 -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
Peter F. Patel-Schneider
b957217ea8
receiver: delay device sending first messages
2024-03-13 08:34:28 -04:00
Peter F. Patel-Schneider
4a89a79a4d
device: remove checks for status attributes
2024-03-12 13:11:49 -04:00
Peter F. Patel-Schneider
9c5ba6445e
device: remove status from Device and Receiver
2024-03-11 08:23:27 -04:00
Peter F. Patel-Schneider
a1418cd834
device: move changed method from status to Device and Receiver
2024-03-11 08:23:27 -04:00
Peter F. Patel-Schneider
1fe2eab1a4
device: move link_encrypted from status to Device
2024-03-11 08:23:27 -04:00
Peter F. Patel-Schneider
15d425c365
device: move battery information from status to Device
2024-03-11 08:23:27 -04:00
Peter F. Patel-Schneider
0805ecb511
device: move status string function to Device and Receiver
2024-03-11 08:23:27 -04:00
Peter F. Patel-Schneider
87285faf7f
receiver: move pairing status to new dataclass attached to receiver
2024-03-11 08:23:27 -04:00
Peter F. Patel-Schneider
64d8cad81a
device: change status battery fields to Battery objects
2024-03-09 10:36:40 -05:00
Matthias Hagmann
8f6e8eef4c
Refactor: Move Device instantiation to factory class
...
Related #2273
2024-03-03 09:32:42 -05:00
Matthias Hagmann
9c76a6c5ba
refactor: Introduce Hidpp20 class
...
Related #1097
2024-03-02 10:56:41 -05:00
Matthias Hagmann
85149a809e
refactor: Introduce Hidpp10 class
...
Related #1097
2024-03-02 10:56:41 -05:00
Peter F. Patel-Schneider
8744506259
solaar: add locks to prevent multiple persisters for device
2024-02-23 08:40:16 -05:00
Peter F. Patel-Schneider
3954bbd111
solaar: clean up configuration code
2024-02-23 08:40:16 -05:00
Peter F. Patel-Schneider
ce2de71b1b
device: clean up device and receiver code
2024-02-22 09:57:02 -05:00
Peter F. Patel-Schneider
24ae9bacaa
device: move mapping of device kind into hidpp20
2024-02-22 09:57:02 -05:00
Peter F. Patel-Schneider
4b33c119f6
device: move pairing information gathering to receiver
2024-02-22 09:57:02 -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
ed248c62b9
device: add callback to call when changing a setting
2024-02-20 06:19:23 -05:00
Matthias Hagmann
2fcab65486
logitech_receiver: Move hidpp10 constants into new module
...
Related #1097
2024-02-20 05:58:33 -05:00
Matthias Hagmann
e8fdbeee8e
logitech_receiver: Move exceptions into own module
...
Related #1097
2024-02-20 05:58:33 -05:00
Peter F. Patel-Schneider
31d795fcb8
device: improve imports in logitech_receiver
...
device: move some imports to top of modules
device: break up imports loop with device descriptors
device: break up imports loop by moving a function from notifications.py to setting_templates.py
device: break import loop between device.py and diversion.py by using device to access method
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
23517048d4
device: clean up data for LED effects
2024-02-09 08:36:36 -05:00
Peter F. Patel-Schneider
fb30f4ee41
device: support onboard profiles
2024-02-07 18:48:22 -05:00
Peter F. Patel-Schneider
72c5860a1e
device: support backlight levels and duration
2024-02-06 12:49:08 -05:00