Skip to content

Instantly share code, notes, and snippets.

@sudhackar
Last active December 13, 2024 11:10
Show Gist options
  • Save sudhackar/13727248dcfae0098d78187751f09240 to your computer and use it in GitHub Desktop.
Save sudhackar/13727248dcfae0098d78187751f09240 to your computer and use it in GitHub Desktop.
DeepCool CH510 Digital - usb write with hid
SUBSYSTEM=="input", GROUP="input", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="34d3", ATTRS{idProduct}=="1100", MODE="666", GROUP="plugdev"
KERNEL=="hidraw*", ATTRS{idVendor}=="34d3", ATTRS{idProduct}=="1100", MODE="0666", GROUP="plugdev"
import hid
import time
vid = 0x34d3
pid = 0x1100
# to read/write as a normal user - be in the plugdev rules
# sudo udevadm control --reload-rules
# sudo udevadm trigger
percent = 0
temp = 0
with hid.Device(vid, pid) as h:
while True:
percent = (percent + 1) % 100
temp = (temp + 1) % 1000
msg = "HLXDATA({},{},0,0,{})\r\n".format(percent, temp, "C")
h.write(msg.encode("utf-8"))
time.sleep(0.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment