Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix problem with lots of onboard profiles #2314

Merged
merged 5 commits into from
Feb 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -18,4 +18,3 @@ repos:
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
name: ruff format
args: [--diff]
17 changes: 1 addition & 16 deletions lib/logitech_receiver/__init__.py
Original file line number Diff line number Diff line change
@@ -15,27 +15,12 @@
## You should have received a copy of the GNU General Public License along
## with this program; if not, write to the Free Software Foundation, Inc.,
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
"""Low-level interface for devices connected through a Logitech Universal
Receiver (UR).
"""Low-level interface for devices using Logitech HID++ protocol.

Uses the HID api exposed through hidapi.py, a Python thin layer over a native
implementation.

Incomplete. Based on a bit of documentation, trial-and-error, and guesswork.

References:
http://julien.danjou.info/blog/2012/logitech-k750-linux-support
http://6xq.net/git/lars/lshidpp.git/plain/doc/
"""

import logging

logger = logging.getLogger(__name__)
logger.setLevel(logging.root.level)
# if logging.root.level > logging.DEBUG:
# logger.addHandler(logging.NullHandler())
# logger.propagate = 0

del logging

__version__ = "0.9"
2 changes: 1 addition & 1 deletion lib/logitech_receiver/descriptors.py
Original file line number Diff line number Diff line change
@@ -226,7 +226,7 @@ def get_btid(btid):
_D("Wireless Illuminated Keyboard K800 new", codename="K800 new", protocol=4.5, wpid="406E")
_D("Wireless Keyboard K470", codename="K470", protocol=4.5, wpid="4075")
_D("MX Keys Keyboard", codename="MX Keys", protocol=4.5, wpid="408A", btid=0xB35B)
_D("G915 TKL LIGHTSPEED Wireless RGB Mechanical Gaming Keyboard", codename="G915 TKL", protocol=4.2, wpid="408E", sbid=0xC343)
_D("G915 TKL LIGHTSPEED Wireless RGB Mechanical Gaming Keyboard", codename="G915 TKL", protocol=4.2, wpid="408E", usbid=0xC343)
_D("Illuminated Keyboard", codename="Illuminated", protocol=1.0, usbid=0xC318, interface=1)
_D("G213 Prodigy Gaming Keyboard", codename="G213", usbid=0xC336, interface=1)
_D("G512 RGB Mechanical Gaming Keyboard", codename="G512", usbid=0xC33C, interface=1)
5 changes: 3 additions & 2 deletions lib/logitech_receiver/settings_templates.py
Original file line number Diff line number Diff line change
@@ -498,8 +498,9 @@ class OnboardProfiles(_Setting):
description = _("Enable an onboard profile, which controls report rate, sensitivity, and button actions")
feature = _F.ONBOARD_PROFILES
choices_universe = _NamedInts(Disabled=0)
for i in range(1, 6):
for i in range(1, 16):
choices_universe[i] = f"Profile {i}"
choices_universe[i + 0x100] = f"Read-Only Profile {i}"
validator_class = _ChoicesV

class rw_class:
@@ -531,7 +532,7 @@ def build(cls, setting_class, device):
profiles_list = [setting_class.choices_universe[0]]
if headers:
for sector, enabled in headers:
if enabled:
if enabled and setting_class.choices_universe[sector]:
profiles_list.append(setting_class.choices_universe[sector])
return cls(choices=_NamedInts.list(profiles_list), byte_count=2) if len(profiles_list) > 1 else None