aboutsummaryrefslogtreecommitdiff
path: root/keyboards/dekunukem/duckypad/keymaps/m4cs/sysinfo.py
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/dekunukem/duckypad/keymaps/m4cs/sysinfo.py')
-rw-r--r--keyboards/dekunukem/duckypad/keymaps/m4cs/sysinfo.py78
1 files changed, 78 insertions, 0 deletions
diff --git a/keyboards/dekunukem/duckypad/keymaps/m4cs/sysinfo.py b/keyboards/dekunukem/duckypad/keymaps/m4cs/sysinfo.py
new file mode 100644
index 000000000..04cf343ea
--- /dev/null
+++ b/keyboards/dekunukem/duckypad/keymaps/m4cs/sysinfo.py
@@ -0,0 +1,78 @@
1
2###
3# M4cs Keymap for dekuNukem/duckyPad QMK firmware
4
5# Copyright (C) 2020 Max Bridgland
6
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16
17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19###
20
21
22import hid
23import time
24import string
25import psutil
26import GPUtil
27import datetime
28
29vendor_id = 0x444E
30product_id = 0x4450
31
32usage_page = 0xFF60
33usage = 0x61
34
35device_interfaces = hid.enumerate(vendor_id, product_id)
36raw_hid_interfaces = [i for i in device_interfaces if i['usage_page'] == usage_page and i['usage'] == usage]
37
38if len(raw_hid_interfaces) == 0:
39 print('Couldnt find any interfaces')
40 exit()
41
42interface = hid.device()
43interface.open_path(raw_hid_interfaces[0]['path'])
44print("Manufacturer: %s" % interface.get_manufacturer_string())
45print("Product: %s" % interface.get_product_string())
46time.sleep(0.05)
47while True:
48 time.sleep(0.75)
49 cpufreq = psutil.cpu_freq()
50 currFreq = int(cpufreq.current)
51 svmem = psutil.virtual_memory()
52 memPerc = int(svmem.percent * 10)
53 gpus = GPUtil.getGPUs()
54 gpu = gpus[0]
55 load = int(gpu.load*100)
56 temp = int(gpu.temperature)
57 data = [0]
58 for x in str(currFreq):
59 data.append(int(x))
60 data.append(13)
61 for x in str(memPerc):
62 data.append(int(x))
63 data.append(13)
64 for x in str(load):
65 data.append(int(x))
66 data.append(13)
67 for x in str(temp):
68 data.append(int(x))
69 data.append(13)
70 now_hour = datetime.datetime.now().strftime("%I")
71 now_min = datetime.datetime.now().strftime("%M")
72 data.append(int(now_hour[0]))
73 data.append(int(now_hour[1]))
74 data.append(13)
75 data.append(int(now_min[0]))
76 data.append(int(now_min[1]))
77 data.append(13)
78 interface.write(data)