Skip to content

Instantly share code, notes, and snippets.

@Darkhogg
Created January 19, 2018 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Darkhogg/a88a3b504cbb66561fbba526ec89e030 to your computer and use it in GitHub Desktop.
Save Darkhogg/a88a3b504cbb66561fbba526ec89e030 to your computer and use it in GitHub Desktop.
Set slow and dim color cycle for G203 Mouse
import usb.core
import usb.util
import binascii
VENDOR = 0x046d
PRODUCT = 0xc084
INDEX = 0x0001
REQUEST_TYPE = 0x21
REQUEST = 0x09
VALUE = 0x0210
# Find the device...
device = usb.core.find(idVendor=VENDOR, idProduct=PRODUCT)
# Detach kernel module...
if device.is_kernel_driver_active(INDEX):
device.detach_kernel_driver(INDEX)
# Send the appropriate data... SPEED BRG
data = '11ff0e3c 0002 0000000000 ffff 10 000000000000'.replace(' ', '')
device.ctrl_transfer(REQUEST_TYPE, REQUEST, VALUE, INDEX, binascii.unhexlify(data))
# Reattach kernel module...
usb.util.dispose_resources(device)
device.attach_kernel_driver(INDEX)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment