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

Add support for Legion 5 Pro with product id 0x975 #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Add udev rule if you want to swith light as unprivileged user
```
# /etc/udev/rules.d/99-kblight.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="048d", ATTR{idProduct}=="c965", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="048d", ATTR{idProduct}=="c975", MODE="0666"
```

Reload rules
Expand Down
10 changes: 7 additions & 3 deletions l5p_kbl.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
# Add udev rule as "/etc/udev/rules.d/10-kblight.rules" if you want control light as user
# SUBSYSTEM=="usb", ATTR{idVendor}=="048d", ATTR{idProduct}=="c965", MODE="0666"
#
# SUBSYSTEM=="usb", ATTR{idVendor}=="048d", ATTR{idProduct}=="c975", MODE="0666"
# Payload description
#
# HEADER ........... cc
Expand Down Expand Up @@ -53,11 +53,15 @@ class LedController:
# Keyboard light device
# Integrated Technology Express, Inc. ITE Device(8295)
VENDOR = 0x048D
PRODUCT = 0xC965
PRODUCT_ID_LIST = [ 0xC965 , 0xC975 ]
EFFECT = {"static": 1, "breath": 3, "wave": 4, "hue": 6}

def __init__(self):
device = usb.core.find(idVendor=self.VENDOR, idProduct=self.PRODUCT)

for product in self.PRODUCT_ID_LIST:
device = usb.core.find(idVendor=self.VENDOR, idProduct=product)
if device is not None:
break;

if device is None:
raise ValueError("Light device not found")
Expand Down