Commit Graph

74 Commits

Author SHA1 Message Date
MattHag 90c41dbe32 base: Add find_paired_node functions
Avoid the need for hidapi imports and add them to the base API module.
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 0481950324 base: Add type hints 2024-10-08 14:35:16 -04:00
MattHag aa354dc4c4 Replace global sw_id with function call
Add test for it.
2024-10-08 14:35:16 -04:00
MattHag 2442299539 base: Simplify receiver info retrieval
- Remove comments with unused receivers
- Simplify receiver hardcoded info
2024-10-08 14:35:16 -04:00
MattHag 8fb087be14 logitech_receiver: Remove GDK dependency 2024-09-15 09:18:51 -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
Peter F. Patel-Schneider 4578f5f6f1 device: cycle sw_id to better guard against duplication of messages 2024-08-23 19:41:10 -04:00
MattHag 86b55b9c25 Introduce Enum BusID
Distinguishes Bluetooth and USB devices.
2024-06-03 08:37:02 -04:00
MattHag 7f5e156fa1 Introduce constant for Logitech vendor ID
The Vendor ID for Logitech is 0x46D = 1133.
2024-06-03 08:37:02 -04:00
MattHag 9726b93a78 Improve base module
Use clearer names and type hints.
2024-06-03 08:37:02 -04:00
MattHag a5ded24057 Convert HIDPPNotification to dataclass
Replaces the very last namedtuple.
2024-06-03 08:37:02 -04:00
MattHag 5a63e44d58 Remove empty comment lines
Remove hashtags solely used for structuring.

Related #2273
2024-06-02 09:54:21 -04:00
MattHag 815dce07be Unify imports in logitech package
Related #2273
2024-05-23 16:42:18 -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 0d225f6cb1
test: Test base product information
* test: Test base product information

Related #1097

* Fix dependencies for gi
2024-03-10 10:11:02 -04:00
Matthias Hagmann 7d127ff068 fix: Use exception from exception module 2024-03-02 12:25:13 -05:00
Matthias Hagmann 9c76a6c5ba refactor: Introduce Hidpp20 class
Related #1097
2024-03-02 10:56:41 -05: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
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 476f41f8ae logitech_receiver: style fixes 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 0b6b98e0a7 device: add connection request failed error to expected ping responses 2023-10-07 11:36:00 -04:00
Peter F. Patel-Schneider 37e303163c device: allow return device 00 for BT device ff 2023-09-17 10:39:48 -04:00
Peter F. Patel-Schneider 1447b15ef4 device: remove assertion on last byte of ping responses 2023-05-19 07:14:10 -04:00
Peter F. Patel-Schneider 0905ed5f43 device: clean up pinging code 2023-01-16 08:44:56 -05:00
Peter F. Patel-Schneider 2462d1aad7 receiver: allow for unknown receivers 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 0ce2fe8302 receiver: don't show normal DJ messages in debug log 2022-09-26 09:37:14 -04:00
Peter F. Patel-Schneider f1e2a0c449 receiver: use built-ins for conversions between int and byte string 2022-06-21 18:39:37 -04:00
Peter F. Patel-Schneider bb20631a27 misc: remove support for Python 2 unicode 2022-04-11 13:20:42 -04:00
Peter F. Patel-Schneider 862fd9c110 device: cut off noops even earlier 2022-03-02 05:30:22 -05:00
Peter F. Patel-Schneider b7a1b81181 device: push settings when device requests software reconfiguration 2021-12-20 08:06:03 -05:00
Peter F. Patel-Schneider 885cefb5b6 cli: add pairing for Bolt receivers 2021-11-11 10:48:12 -05:00
Hugo Osvaldo Barrera cf28308a9f Simplify yield syntax 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 585a3b901a receiver: lock on actual handle, not just on handle number 2021-09-24 21:55:15 -04:00
Peter F. Patel-Schneider c02a1b820b device: pass protocol to base request so that SW ID can be done right 2021-08-31 19:05:57 -04:00
Peter F. Patel-Schneider 30f56a1c0f device: use 0xFF instead of 0 for direct-connected devices 2021-08-22 11:16:41 -04:00
Peter F. Patel-Schneider 538ab9c947 receiver: serialize requests per handle so that threads do not receive response for a different request 2021-07-17 13:58:20 -04:00
Peter F. Patel-Schneider 66f3d5d02b receiver: gracefully handle more receiver and device disconnects 2020-11-21 12:32:33 -05:00
Peter F. Patel-Schneider ade9c816c7 receiver: add report_id to notifications and use where appropriate 2020-11-13 08:46:04 -05:00
Peter F. Patel-Schneider b19006104f device: support unknown USB-connected and Bluetooth devices 2020-10-12 08:05:13 -04:00