aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorJack Sangdahl <[email protected]>2025-01-15 13:50:29 -0700
committerJack Sangdahl <[email protected]>2025-01-15 13:50:29 -0700
commit5304ab5f84f130b7ff61dd5ad4d91ce9303a7608 (patch)
tree0fcf879a07db10743d54919e969d8226604cf7c3 /util
parent42fc0e65c572ff1cb258ec750a45d34ee5ba0049 (diff)
downloadqmk_me-master.tar.gz
qmk_me-master.zip
Various updates across userspace and keymapsHEADmaster
* Add clang-format configuration * Autocorrect dictionary updates * Remove RGB Colour implementation * Tidy combos code * More space saving techniques * OLED byte array pretty-ing * Remove uneeded OLED shutdown code * Remove and rearrange keyboards/keymaps * Custom async tap code implementation * Update license years * ...and more
Diffstat (limited to 'util')
-rw-r--r--util/raw.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/util/raw.py b/util/raw.py
new file mode 100644
index 0000000..fe63d49
--- /dev/null
+++ b/util/raw.py
@@ -0,0 +1,49 @@
+# Copyright 2025 [email protected]
+# SPDX-License-Identifier: GPL-2.0-or-later
+import hid
+import sys
+import psutil
+import math
+import time
+import datetime
+
+vendor_id = 0x6A73
+product_id = 0x6B62
+usage_page = 0xFF60
+usage = 0x61
+
+
+def get_raw_hid_interface():
+ device_interfaces = hid.enumerate(vendor_id, product_id)
+ raw_hid_interfaces = [
+ i
+ for i in device_interfaces
+ if i["usage_page"] == usage_page and i["usage"] == usage
+ ]
+ if len(raw_hid_interfaces) == 0:
+ return None
+ interface = hid.Device(path=raw_hid_interfaces[0]["path"])
+ return interface
+
+
+def send_packet(data):
+ interface = get_raw_hid_interface()
+ if interface is None:
+ print("no device found")
+ sys.exit(1)
+ request_data = [0x00] * 32
+ request_data[1 : len(data) + 1] = data
+ request_packet = bytes(request_data)
+ try:
+ interface.write(request_packet)
+ finally:
+ interface.close()
+
+
+if __name__ == "__main__":
+ while True:
+ time.sleep(30)
+ cpu_temp = psutil.sensors_temperatures()["gigabyte_wmi"][2]
+ cur_hour = datetime.datetime.now().strftime("%H")
+ cur_minute = datetime.datetime.now().strftime("%M")
+ send_packet([math.trunc(cpu_temp.current), int(cur_hour), int(cur_minute)])