Skip to content

Commit 7384690

Browse files
committed
Merge branch 'arroyo-pl-arroyo-pl-dell-g16'
2 parents 9a609d7 + a69f134 commit 7384690

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A simple GUI app written in PyQt to control keyboard backlight, power mode and f
88
| G15 5520 | :white_check_mark: | :white_check_mark: |
99
| G15 5511 | :white_check_mark: | :white_check_mark: |
1010
| G16 7620 | :white_check_mark: | :white_check_mark: |
11-
| G16 7630 | :white_check_mark: | :grey_question: |
11+
| G16 7630 | :white_check_mark: | :white_check_mark: |
1212
| Alienware M16 R1 | :white_check_mark: | :grey_question: |
1313

1414

awelc.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,19 @@
1515
ZONES_KB = [0, 1, 2]
1616
ZONES_NP = [3]
1717

18+
def init_device():
19+
supportedProducts = [0x0550, 0x0551]
20+
vid = 0x187C
1821

22+
# Find supported device
23+
device = None
24+
for pid in supportedProducts:
25+
device = usb.core.find(idVendor=vid, idProduct=pid)
26+
if device:
27+
break
1928

20-
def init_device():
21-
# So that we don't get an USB device busy error
22-
device = usb.core.find(idVendor=0x187c, idProduct=0x0550)
2329
if not device:
24-
raise Exception('no such device was found. Do you have a RGB keyboard 187c:0550?')
30+
raise Exception('No supported device was found. Do you have an RGB keyboard 187c:0550 or 187c:0551?')
2531

2632
ep = device[0].interfaces()[0].endpoints()[0]
2733
i = device[0].interfaces()[0].bInterfaceNumber
@@ -30,9 +36,7 @@ def init_device():
3036
device.detach_kernel_driver(i)
3137

3238
# Create the elc object
33-
vid = 0x187C
34-
pid = 0x0550
35-
elc = Elc(vid, pid, debug=0)
39+
elc = Elc(vid, device.idProduct, debug=0)
3640
return (elc, device)
3741

3842
def apply_action(elc, red, green, blue, duration, tempo, animation=AC_CHARGING, effect=COLOR, zones=ZONES):
@@ -164,4 +168,4 @@ def remove_animation():
164168
def set_dim(level):
165169
elc, device = init_device()
166170
elc.dim(ZONES,level)
167-
device.reset()
171+
device.reset()

0 commit comments

Comments
 (0)