Last active
May 28, 2020 09:36
-
-
Save cornernote/82972cc307985df29f3ddca214a4dc39 to your computer and use it in GitHub Desktop.
Revisions
-
cornernote revised this gist
Jan 11, 2020 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,8 @@ # G815 Notes Data Dumps: * https://github.com/cornernote/gseries-tools/tree/master/g815/info * https://github.com/cornernote/g815-wireshark Resources: -
cornernote revised this gist
Jan 10, 2020 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,7 @@ Wireshark Dumps: Resources: * https://github.com/signal11/hidapi/blob/master/linux/hid.c * https://github.com/MatMoul/g810-led-python * https://github.com/CReimer/g910-gkey-uinput/blob/master/g910-gkey-uinput.py * https://github.com/JSubelj/g910-gkey-macro-support/ -
cornernote revised this gist
Jan 10, 2020 . 2 changed files with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,12 @@ # G815 Notes Wireshark Dumps: * https://github.com/cornernote/g815-wireshark Resources: * https://github.com/MatMoul/g810-led-python * https://github.com/CReimer/g910-gkey-uinput/blob/master/g910-gkey-uinput.py * https://github.com/JSubelj/g910-gkey-macro-support/ * https://github.com/MatMoul/g810-led/issues/39 File renamed without changes. -
cornernote revised this gist
Jan 10, 2020 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,10 @@ Based on https://github.com/MatMoul/g810-led-python - altered to work for G815 Wireshark Dumps: * https://github.com/cornernote/g815-wireshark Resources: * https://github.com/CReimer/g910-gkey-uinput/blob/master/g910-gkey-uinput.py -
cornernote revised this gist
Jan 8, 2020 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -44,8 +44,11 @@ def send(data): def main(): send('11ff111b02000000000000000000000000000000') # run this before enable/disable m-keys, keyboard goes black after running send('11ff0a2b01000000000000000000000000000000') # enable m-keys # send('11ff0a2b00000000000000000000000000000000') # disable m-keys # send('11ff111a01000000000000000000000000000000') # reset to non-g-keys, keyboard goes back into color mode, M1-M3 change colours # send('11ff0b1c01000000000000000000000000000000') # M1 light # sleep(1) # send('11ff0b1c02000000000000000000000000000000') # M2 light -
cornernote revised this gist
Jan 7, 2020 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -23,6 +23,7 @@ command format: [prefix][command] ``` - `111b02` - run before enable g-keys - `0a2b00` - disable g-keys - `0a2b01` - enable g-keys - `111a01` - reset to saved state (disable g-keys) -
cornernote revised this gist
Jan 7, 2020 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -23,7 +23,8 @@ command format: [prefix][command] ``` - `0a2b00` - disable g-keys - `0a2b01` - enable g-keys - `111a01` - reset to saved state (disable g-keys) -
cornernote revised this gist
Jan 7, 2020 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,6 +7,7 @@ Resources: * https://github.com/CReimer/g910-gkey-uinput/blob/master/g910-gkey-uinput.py * https://github.com/JSubelj/g910-gkey-macro-support/ * https://github.com/MatMoul/g810-led/issues/39 * https://github.com/tolga9009/sidewinderd ## Info Derived from Wireshark -
cornernote revised this gist
Jan 6, 2020 . 2 changed files with 49 additions and 319 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,6 +14,18 @@ Resources: Prefix: `11ff` ### Setup Commands command format: ``` [prefix][command] ``` - `111b02` - enable g-keys - `111a01` - reset to saved state (disable g-keys) ### Macro Key Inputs input format: @@ -93,80 +105,3 @@ keys: - `01` - A - `1b` - 1 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,256 +11,51 @@ intf = None def attach(): global dev global intf dev = usb.core.find(idVendor=0x046d, idProduct=0xc33f) if dev is None: print 'Device not found, exiting...' sys.exit() intf = 1 if dev.is_kernel_driver_active(intf) is True: dev.detach_kernel_driver(intf) usb.util.claim_interface(dev, intf) def detach(): global dev global intf if intf is not None: usb.util.release_interface(dev, intf) dev.attach_kernel_driver(intf) dev = None intf = None def send(data): attach() print data data = [int(''.join([data[i], data[i + 1]]), base=16) for i in range(0, len(data), 2)] dev.ctrl_transfer(0x21, 0x09, 0x0211, 1, data) sleep(0.01) detach() def main(): # send('11ff111a01000000000000000000000000000000') # reset to non-g-keys send('11ff111b02000000000000000000000000000000') # enable to g-keys # send('11ff0b1c01000000000000000000000000000000') # M1 light # sleep(1) # send('11ff0b1c02000000000000000000000000000000') # M2 light # sleep(1) # send('11ff0b1c04000000000000000000000000000000') # M3 light # sleep(1) # send('11ff0c0c01000000000000000000000000000000') # MR on # sleep(1) # send('11ff0c0c00000000000000000000000000000000') # MR off # sleep(1) main() -
cornernote revised this gist
Jan 6, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -166,7 +166,7 @@ command format: [prefix][command] ``` - `111b02` - enable g-keys - `111a01` - reset to saved state (disable g-keys) -
cornernote revised this gist
Jan 6, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -166,7 +166,7 @@ command format: [prefix][command] ``` - `11ff111b02` - enable g-keys - `111a01` - reset to saved state (disable g-keys) -
cornernote revised this gist
Jan 6, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ Resources: Prefix: `11ff` ### Macro Key Inputs input format: @@ -40,7 +40,7 @@ eg: - `0c0001` mr - press ### Macro Key Lights command format: -
cornernote revised this gist
Jan 6, 2020 . 1 changed file with 21 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,20 +16,28 @@ Prefix: `11ff` ### Keyboard Inputs input format: ``` [prefix][input] eg: 11ff0a0000000000000000000000000000000000 - gX release ``` - `0a0000` gX - release - `0a0001` g1 - press - `0a0002` g2 - press - `0a0004` g3 - press - `0a0008` g4 - press - `0a0010` g5 - press - `0b0000` mX - release - `0b0001` m1 - press - `0b0002` m2 - press - `0b0004` m3 - press - `0c0000` mr - release - `0c0001` mr - press ### Mode Commands @@ -39,7 +47,7 @@ command format: ``` [prefix][command] eg: 11ff0b1c01000000000000000000000000000000 - M1 on ``` M1-M3 lights: -
cornernote revised this gist
Jan 6, 2020 . 1 changed file with 19 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,6 +13,25 @@ Resources: Prefix: `11ff` ### Keyboard Inputs - `11ff0a0000` gX - release - `11ff0a0001` g1 - press - `11ff0a0002` g2 - press - `11ff0a0004` g3 - press - `11ff0a0008` g4 - press - `11ff0a0010` g5 - press - `11ff0b0000` mX - release - `11ff0b0001` m1 - press - `11ff0b0002` m2 - press - `11ff0b0004` m3 - press - `11ff0c0000` mr - release - `11ff0c0001` mr - press ### Mode Commands command format: -
cornernote revised this gist
Jan 6, 2020 . 1 changed file with 31 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,22 @@ Prefix: `11ff` ### Mode Commands command format: ``` [prefix][command] eg: 11ff0b1c01000000000000000000000000000000 ``` M1-M3 lights: - `0b1c01` - M1 on - `0b1c02` - M2 on - `0b1c04` - M3 on MR lights: - `0c0c00` - MR off - `0c0c01` - MR on ### RGB Commands @@ -113,3 +128,18 @@ MR with software: - `0c 0b 01` out - `0f 10 00` in - `0f 5b 01 0303` out ### Misc Commands command format: ``` [prefix][command] ``` Restore Saved State: - `111a01` - reset and disable gkeys -
cornernote revised this gist
Jan 6, 2020 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,6 +13,11 @@ Resources: Prefix: `11ff` ### Mode Commands `[prefix]111a01` - reset and disable gkeys - eg: `11ff111a01000000000000000000000000000000` ### RGB Commands command format: -
cornernote revised this gist
Jan 6, 2020 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,12 @@ Based on https://github.com/MatMoul/g810-led-python - altered to work for G815 Resources: * https://github.com/CReimer/g910-gkey-uinput/blob/master/g910-gkey-uinput.py * https://github.com/JSubelj/g910-gkey-macro-support/ * https://github.com/MatMoul/g810-led/issues/39 ## Info Derived from Wireshark -
cornernote revised this gist
Dec 20, 2019 . 1 changed file with 31 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,16 +5,18 @@ Based on https://github.com/MatMoul/g810-led-python - altered to work for G815 ## Info Derived from Wireshark Prefix: `11ff` ### RGB Commands command format: ``` [prefix][option][command][extra] ``` option: - `10` - set RBG values commands: - `7f`/`7a` - commit - after each line @@ -41,12 +43,31 @@ keys: ### Macro Key Commands GX no software: - `same as F1` G1 - `same as F2` G2 - `same as F3` G3 - `same as F4` G4 - `same as F5` G5 GX with software: - `0a 00 01` G1 - `0a 00 02` G2 - `0a 00 04` G3 - `0a 00 08` G4 - `0a 00 10` G5 MX no software: - `11 00 00 01` M1 - `11 00 00 02` M2 - `11 00 00 03` M3 - `empty` MR MX with software: - `0b 00 01` M1 - `0b 00 02` M2 - `0b 00 04` M3 - `0c 00 01` MR was M1, press M2 with software: - `0b 00 02` in @@ -73,19 +94,11 @@ was M3, press M1 with software: - `0b 1e 01` out MR with software: - `0c 00 01` in - `0c 0b 01` out - `0f 10 01` in - `0f 5b 01 0305` out - `0c 00 00` in - `0c 0b 01` out - `0f 10 00` in - `0f 5b 01 0303` out -
cornernote revised this gist
Dec 20, 2019 . 1 changed file with 53 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,6 +5,7 @@ Based on https://github.com/MatMoul/g810-led-python - altered to work for G815 ## Info Derived from Wireshark ### RGB Commands command format: @@ -36,3 +37,55 @@ keys: - `b8` - G5 - `01` - A - `1b` - 1 ### Macro Key Commands Global Prefix: `11ff` MX no software: - `11 00 00 01` M1 - `11 00 00 02` M2 - `11 00 00 03` M3 was M1, press M2 with software: - `0b 00 02` in - `0b 1d 02` out - `0f 10 01` in - `0f 5d 01 0305` out - `0b 00 00` in - `0b 1d 02` out was M2, press M3 with software: - `0b 00 04` in - `0b 1e 04` out - `0f 10 01` in - `0f 5e 01 0305` out - `0b 00 00` in - `0b 1e 04` out was M3, press M1 with software: - `0b 00 01` in - `0b 1e 01` out - `0f 10 01` in - `0f 5e 01 0305` out - `0b 00 00` in - `0b 1e 01` out MR with software: - `0c 00 01 0000` in - `0c 0b 01 0000` out - `0f 10 01 0000` in - `0f 5b 01 0305` out - `0c 00 00 0000` in - `0c 0b 01 0000` out - `0f 10 00 0000` in - `0f 5b 01 0303` out GX with software: - `0a 00 01` G1 - `0a 00 02` G2 - `0a 00 04` G3 - `0a 00 08` G4 - `0a 00 10` G5 -
cornernote revised this gist
Dec 20, 2019 . No changes.There are no files selected for viewing
-
cornernote revised this gist
Dec 20, 2019 . 1 changed file with 35 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,38 @@ # G815-Led-Python Based on https://github.com/MatMoul/g810-led-python - altered to work for G815 ## Info Derived from Wireshark command format: ``` [prefix][command][extra] ``` prefix: - `11ff10` - everything seems to use this prefix commands: - `7f`/`7a` - commit - after each line - `1f`/`1a` - set keys RGB - `[extra] = [key1][color1][key2][color2]...` - `1b` - set logo RGB - `[extra] = [key][color]` - `6a` - multi keys - `[extra] = [color][key1][key2]...` keys: - `d2` - logo - `99` - backlight - `9b` - play/pause - `9c` - next - `9d` - mute - `9e` - prev - `b4` - G1 - `b5` - G2 - `b6` - G3 - `b7` - G4 - `b8` - G5 - `01` - A - `1b` - 1 -
cornernote created this gist
Dec 20, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ # G815-Led-Python Based on https://github.com/MatMoul/g810-led-python - altered to work for G815 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,266 @@ #!/usr/bin/python2 import sys import os.path import imp import usb.core import usb.util from time import sleep dev = None intf = None def help(): print 'Use :' print 'g810-led {key} {color}' print 'g810-led {profilefile}' def main(): if len(sys.argv) == 2: profilefile = sys.argv[1] if os.path.exists(profilefile) is True: try: g810profile = imp.load_source('g810profile', profilefile) except: print 'Error loading profile file, exiting...' sys.exit() if g810profile is None: print "Nothing to do, exiting..." sys.exit() applyProfile(g810profile) elif len(sys.argv) == 3: attachKeyboard() setKeyColor(sys.argv[1], sys.argv[2]) updateKeyboard() detachKeyboard() def applyProfile(profile): keys = dir(profile) attachKeyboard() for key in keys: color = eval('profile.'+key) if color is not None: if len(color) == 6: setKeyColor(key, color) updateKeyboard() detachKeyboard() def attachKeyboard(): global dev global intf dev = usb.core.find(idVendor=0x046d, idProduct=0xc33f) if dev is None: print 'Device not found, exiting...' sys.exit() intf = 1 if dev.is_kernel_driver_active(intf) is True: dev.detach_kernel_driver(intf) usb.util.claim_interface(dev, intf) def detachKeyboard(): global dev global intf if intf is not None: usb.util.release_interface(dev, intf) dev.attach_kernel_driver(intf) dev = None intf = None def updateKeyboard(): global dev try: data = '11ff107f00000000000000000000000000000000' print data data = [ int(''.join([data[i], data[i+1]]), base=16) for i in range(0, len(data), 2)] dev.ctrl_transfer(0x21,0x09,0x0211,1,data) except: print 'Error updating keyboard' def setKeyColor(key, color): ext = True key = key.lower() if key == 'logo': base = '11ff101b' key = 'd2' ext = False elif (key == 'backlight') or (key == 'light'): base = '11ff101f' key = '99' ext = False elif key == 'next': base = '11ff101f' key = '9d' ext = False elif key == 'prev': base = '11ff101f' key = '9e' ext = False elif (key == 'playpause') or (key == 'play' or (key == 'pause')): base = '11ff101f' key = '9b' ext = False elif key == 'mute': base = '11ff101f' key = '9c' ext = False elif key == 'g1': base = '11ff101f' key = 'b4' ext = False elif key == 'g2': base = '11ff101f' key = 'b5' ext = False elif key == 'g3': base = '11ff101f' key = 'b6' ext = False elif key == 'g4': base = '11ff101f' key = 'b7' ext = False elif key == 'g5': base = '11ff101f' key = 'b8' ext = False else: base = '12ff0c3a0001000e' if key == 'a': key = '04' elif key == 'b': key = '05' elif key == 'c': key = '06' elif key == 'd': key = '07' elif key == 'e': key = '08' elif key == 'f': key = '09' elif key == 'g': key = '0a' elif key == 'h': key = '0b' elif key == 'i': key = '0c' elif key == 'j': key = '0d' elif key == 'k': key = '0e' elif key == 'l': key = '0f' elif key == 'm': key = '10' elif key == 'n': key = '11' elif key == 'o': key = '12' elif key == 'p': key = '13' elif key == 'q': key = '14' elif key == 'r': key = '15' elif key == 's': key = '16' elif key == 't': key = '17' elif key == 'u': key = '18' elif key == 'v': key = '19' elif key == 'w': key = '1a' elif key == 'x': key = '1b' elif key == 'z': key = '1c' elif key == 'y': key = '1d' elif (key == 'one') or (key == '1') or (key == 'n1'): key = '1e' elif (key == 'two') or (key == '2') or (key == 'n2'): key = '1f' elif (key == 'three') or (key == '3') or (key == 'n3'): key = '20' elif (key == 'four') or (key == '4') or (key == 'n4'): key = '21' elif (key == 'five') or (key == '5') or (key == 'n5'): key = '22' elif (key == 'six') or (key == '6') or (key == 'n6'): key = '23' elif (key == 'seven') or (key == '7') or (key == 'n7'): key = '24' elif (key == 'eight') or (key == '8') or (key == 'n8'): key = '25' elif (key == 'nine') or (key == '9') or (key == 'n9'): key = '26' elif (key == 'zero') or (key == '0') or (key == 'n0'): key = '27' elif key == 'enter': key = '28' elif (key == 'escape') or (key == 'esc'): key = '29' elif (key == 'backspace') or (key == 'back'): key = '2a' elif key == 'tab': key = '2b' elif key == 'space': key = '2c' elif (key == 'apostrophe') or (key == '?') or (key == "'"): key = '2d' elif (key == 'tidle') or (key == '^'): key = '2e' elif (key == 'open_bracket') or (key == 'openbracket') or (key == 'egrave'): key = '2f' elif (key == 'close_bracket') or (key == 'closebracket') or (key == '!'): key = '30' elif (key == '$') or (key == 'dollar'): key = '32' elif key == 'eaigu': key = '33' elif key == 'agrave': key = '34' elif key == 'degre': key = '35' elif (key == 'comma') or (key == ','): key = '36' elif (key == 'dot') or (key == '.'): key = '37' elif (key == 'minus') or (key == '-'): key = '38' elif (key == 'caps_lock') or (key == 'capslock'): key = '39' elif key == 'f1': key = '3a' elif key == 'f2': key = '3b' elif key == 'f3': key = '3c' elif key == 'f4': key = '3d' elif key == 'f5': key = '3e' elif key == 'f6': key = '3f' elif key == 'f7': key = '40' elif key == 'f8': key = '41' elif key == 'f9': key = '42' elif key == 'f10': key = '43' elif key == 'f11': key = '44' elif key == 'f12': key = '45' elif (key == 'print_screen') or (key == 'printscreen') or (key == 'printscr') or (key == 'print'): key = '46' elif (key == 'scroll_lock') or (key == 'scrolllock'): key = '47' elif (key == 'pause_break') or (key == 'pausebreak') or (key == 'breack'): key = '48' elif key == 'insert': key = '49' elif key == 'home': key = '4a' elif (key == 'page_up') or (key == 'pageup'): key = '4b' elif (key == 'delete') or (key == 'del'): key = '4c' elif key == 'end': key = '4d' elif (key == 'page_down') or (key == 'pagedown'): key = '4e' elif (key == 'arrowright') or (key == 'right'): key = '4f' elif (key == 'arrowleft') or (key == 'left'): key = '50' elif (key == 'arrowbottom') or (key == 'bottom'): key = '51' elif (key == 'arrowtop') or (key == 'top'): key = '52' elif (key == 'num_lock') or (key == 'numlock'): key = '53' elif (key == 'num/') or (key == 'num_slash') or (key == 'numslash'): key = '54' elif (key == 'num*') or (key == 'num_asterisk') or (key == 'numasterisk'): key = '55' elif (key == 'num-') or (key == 'num_minus') or (key == 'numminus'): key = '56' elif (key == 'num+') or (key == 'num_plus') or (key == 'numplus'): key = '57' elif key == 'numenter': key = '58' elif key == 'num1': key = '59' elif key == 'num2': key = '5a' elif key == 'num3': key = '5b' elif key == 'num4': key = '5c' elif key == 'num5': key = '5d' elif key == 'num6': key = '5e' elif key == 'num7': key = '5f' elif key == 'num8': key = '60' elif key == 'num9': key = '61' elif key == 'num0': key = '62' elif (key == 'num.') or (key == 'numdot'): key = '63' elif (key == '<') or (key == '>') or (key == 'backslash'): key = '64' elif key == 'menu': key = '65' elif (key == 'ctrlleft') or (key == 'ctrll'): key = 'e0' elif (key == 'shiftleft') or (key == 'shiftl'): key = 'e1' elif (key == 'altleft') or (key == 'altl'): key = 'e2' elif (key == 'metaleft') or (key == 'metal') or (key == 'winleft') or (key == 'winl'): key = 'e3' elif (key == 'ctrlright') or (key == 'ctrlr'): key = 'e4' elif (key == 'shiftright') or (key == 'shiftr'): key = 'e5' elif (key == 'altgr') or (key == 'altr'): key = 'e6' elif (key == 'metaright') or (key == 'metar') or (key == 'winright') or (key == 'winr'): key = 'e7' else: return setKeyColorInternal(base, key, color, ext) def setKeyColorInternal(base, key, color, ext): global dev try: data = base+key+color+'000000000000000000000000' if ext is True: data = data + '0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' print data data = [ int(''.join([data[i], data[i+1]]), base=16) for i in range(0, len(data), 2)] dev.ctrl_transfer(0x21,0x09,0x0211,1,data) sleep(0.001) except: print 'Error setting color: key=' + key + " color=" + color if len(sys.argv) > 1: if sys.argv[1] == '--help': help() sys.exit() main()