Commit Graph

48 Commits

Author SHA1 Message Date
MattHag 72c9dfc50c Remove NamedInts: Convert NotificationFlag to flag
Related #2273
2025-01-01 10:46:04 -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 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 815dce07be Unify imports in logitech package
Related #2273
2024-05-23 16:42:18 -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 dcd72b0178 device: fix bug in hidpp10 get_device_features 2024-03-16 16:20:39 -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
Peter F. Patel-Schneider b957217ea8 receiver: delay device sending first messages 2024-03-13 08:34:28 -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 d4702f0bf0 cleanup: Remove duplicated code to read register
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
Matthias Hagmann 7ef3059b69 clean up: Remove editor specific marks
Related #2273
2024-02-29 10:10:46 -05:00
Peter F. Patel-Schneider 646ef2f596 device: move battery constants common to HID++ 1.0 and 2.0 to common 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
Matthias Hagmann 5f487dd3b2 logitech_receiver: Move hidpp20 constants into new module
Related #1097
2024-02-20 05:58:33 -05:00
Matthias Hagmann 2fcab65486 logitech_receiver: Move hidpp10 constants into new module
Related #1097
2024-02-20 05:58:33 -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 6b1e8f8a99 device: fix processing of HID++ 1.0 battery reports 2022-10-13 07:57:57 -04:00
Peter F. Patel-Schneider 83eb836177 device: regularize and improve battery status gathering and reporting 2022-07-10 11:08:28 -04:00
Kian-Meng Ang 15b92a0f40
misc: Fix typos 2022-04-12 17:18:11 -04:00
Peter F. Patel-Schneider fa83e6ebb8 device: add descriptor for Logitech PRO X Wireless Gaming Headset 2021-12-20 09:17:07 -05:00
Peter F. Patel-Schneider 5acc216e12 receiver: use Bolt unique ID as serial number 2021-11-11 10:48:12 -05:00
Peter F. Patel-Schneider c32a6ca91c receiver: get device codename from Bolt receiver registers 2021-11-11 10:48:12 -05:00
Peter F. Patel-Schneider 885cefb5b6 cli: add pairing for Bolt receivers 2021-11-11 10:48:12 -05:00
Peter F. Patel-Schneider 886df1daaf receiver: add support for Bolt receiver (no pairing yet) 2021-11-11 10:48:12 -05:00
Peter F. Patel-Schneider 2c3578a776 receiver: move receiver pairing information code from device class to receiver class 2021-11-11 10:48:12 -05: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 67dbe5f4c8 device: convert HID++ 2.0 device kinds to enhanced HID++ 1.0 kinds 2021-06-04 08:59:39 -04:00
Peter F. Patel-Schneider 8c5800e536 receiver: use symbolic identifiers for sub-registers 2021-04-09 07:46:10 -04:00
Peter F. Patel-Schneider 52049af8e1 receiver: add remote device type 2020-11-30 08:18:09 -05:00
Peter F. Patel-Schneider 733bf913e6 device: implement UNIFIED_BATTERY feature
device: implement UNIFIED_BATTERY feature
2020-11-02 08:27:08 -05:00
effective-light 16823092bc device: add preliminary support for wired devices 2020-08-25 06:47:07 -04:00
Alex Cherkayev e436b1bd1d receiver: add support for EX100 keyboard/mouse and receiver (046d:c517)
docs: add EX100 keyboard/mouse combo
device: add EX100 keyboard and mouse
hidpp10: fix notification parsing, add device features flags, fix documentation links
notifications: fix wpid processing for 27 MHz protocol
cli: add display of device features flags for HID++ 1.0 devices
2020-07-20 11:55:59 -04:00
Filipe Laíns 27c90fa736 yapf: adjust style to not indent closing brackets
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-07-07 15:11:15 +01:00
Filipe Laíns 8e89aa0038 yapf: set max line lenght to 127
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-07-07 15:11:15 +01:00
Filipe Laíns 33521558ed pre-commit: initial fix
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-07-07 15:11:15 +01:00
Filipe Laíns e6369e0c3c isort: intial import fix
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-07-07 15:11:15 +01:00
Filipe Laíns 72a8d311bc yapf: change code style to yapf
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-07-07 15:11:15 +01:00
Peter F. Patel-Schneider aeb03df3f7 receiver: fix bug reporting hid++ 1.0 batteries 2020-06-17 09:53:16 -04:00
Peter F. Patel-Schneider 79947dca6c receiver: gather and show battery next level where available 2020-06-06 12:59:26 -04:00
Daniel Pavel 5d4d0c07ad use () instead of [] where possible 2013-07-19 11:48:40 +02:00
Daniel Pavel f7159e9338 properly mask flags when writing device settings; fixes #86 2013-07-18 20:33:52 +02:00
Daniel Pavel 61dfefde94 internationalized most strings; fixes #79
some might have slipped through the cracks
2013-07-17 19:53:21 +02:00
Daniel Pavel 38c76393b1 added copyright notices to all source files 2013-07-15 17:54:42 +02:00
Daniel Pavel 43ab629a26 moved logitech.unifying_receiver package to logitech_receiver 2013-07-12 22:48:09 +02:00