diff options
author | Max Bridgland <34947910+M4cs@users.noreply.github.com> | 2021-02-16 13:10:07 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-16 10:10:07 -0800 |
commit | ac33dc12dacee480eba67462d985cb4dc7589c7f (patch) | |
tree | 636a8d72d6c56aa02dd0a16bca9f06e9dc994035 /keyboards/dekunukem/duckypad/keymaps/m4cs/sysinfo.py | |
parent | 9a2b0a5db15a48a0297a4b82665d462361261600 (diff) |
[Keyboard] Add VIA keymap to duckyPad, update M4cs keymap for duckyPad (#11703)
Co-authored-by: M4cs <mabridgland@protonmail.com>
Diffstat (limited to 'keyboards/dekunukem/duckypad/keymaps/m4cs/sysinfo.py')
-rw-r--r-- | keyboards/dekunukem/duckypad/keymaps/m4cs/sysinfo.py | 78 |
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 0000000000..04cf343ea6 --- /dev/null +++ b/keyboards/dekunukem/duckypad/keymaps/m4cs/sysinfo.py @@ -0,0 +1,78 @@ + +### +# M4cs Keymap for dekuNukem/duckyPad QMK firmware + +# Copyright (C) 2020 Max Bridgland + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +### + + +import hid +import time +import string +import psutil +import GPUtil +import datetime + +vendor_id = 0x444E +product_id = 0x4450 + +usage_page = 0xFF60 +usage = 0x61 + +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: + print('Couldnt find any interfaces') + exit() + +interface = hid.device() +interface.open_path(raw_hid_interfaces[0]['path']) +print("Manufacturer: %s" % interface.get_manufacturer_string()) +print("Product: %s" % interface.get_product_string()) +time.sleep(0.05) +while True: + time.sleep(0.75) + cpufreq = psutil.cpu_freq() + currFreq = int(cpufreq.current) + svmem = psutil.virtual_memory() + memPerc = int(svmem.percent * 10) + gpus = GPUtil.getGPUs() + gpu = gpus[0] + load = int(gpu.load*100) + temp = int(gpu.temperature) + data = [0] + for x in str(currFreq): + data.append(int(x)) + data.append(13) + for x in str(memPerc): + data.append(int(x)) + data.append(13) + for x in str(load): + data.append(int(x)) + data.append(13) + for x in str(temp): + data.append(int(x)) + data.append(13) + now_hour = datetime.datetime.now().strftime("%I") + now_min = datetime.datetime.now().strftime("%M") + data.append(int(now_hour[0])) + data.append(int(now_hour[1])) + data.append(13) + data.append(int(now_min[0])) + data.append(int(now_min[1])) + data.append(13) + interface.write(data) |