Last active
December 13, 2024 11:10
-
-
Save sudhackar/13727248dcfae0098d78187751f09240 to your computer and use it in GitHub Desktop.
DeepCool CH510 Digital - usb write with hid
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 characters
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" |
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 characters
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