From 824fc56ca2a1b3d9354fad92f4a98366f09c7666 Mon Sep 17 00:00:00 2001 From: GorouFlex <98001973+gorouflex@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:35:35 +0700 Subject: [PATCH 1/4] ver 0.0.96 --- UXTU4Mac/UXTU4Mac.py | 222 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 212 insertions(+), 10 deletions(-) diff --git a/UXTU4Mac/UXTU4Mac.py b/UXTU4Mac/UXTU4Mac.py index fb309c2..9abeb72 100644 --- a/UXTU4Mac/UXTU4Mac.py +++ b/UXTU4Mac/UXTU4Mac.py @@ -5,6 +5,7 @@ import getpass import webbrowser import logging +import re import urllib.request from configparser import ConfigParser @@ -15,6 +16,170 @@ "Auto": "--power-saving" } +# This list are not mean your CPU can support RyzenAdj/UXTU , it's depend on your CPU/APU, for more information please visit README.md in repo +amd_ryzen_cpus = { + # Zen (Summit Ridge) (WIP) + "Ryzen 7 1800X": "Summit Ridge", + "Ryzen 7 1700X": "Summit Ridge", + "Ryzen 7 1700": "Summit Ridge", + "Ryzen 5 1600X": "Summit Ridge", + "Ryzen 5 1600": "Summit Ridge", + "Ryzen 5 1500X": "Summit Ridge", + "Ryzen 5 1400": "Summit Ridge", + "Ryzen 3 1300X": "Summit Ridge", + "Ryzen 3 1200": "Summit Ridge", + + # Zen+ (Pinnacle Ridge) (WIP) + "Ryzen 7 2700X": "Pinnacle Ridge", + "Ryzen 7 2700": "Pinnacle Ridge", + "Ryzen 5 2600X": "Pinnacle Ridge", + "Ryzen 5 2600": "Pinnacle Ridge", + "Ryzen 5 2500X": "Pinnacle Ridge", + "Ryzen 3 2300X": "Pinnacle Ridge", + + # Zen 2 (Matisse) (WIP) + "Ryzen 9 3950X": "Matisse", + "Ryzen 9 3900X": "Matisse", + "Ryzen 9 3900": "Matisse", + "Ryzen 7 3800X": "Matisse", + "Ryzen 7 3700X": "Matisse", + "Ryzen 5 3600X": "Matisse", + "Ryzen 5 3600": "Matisse", + "Ryzen 5 3500X": "Matisse", + "Ryzen 5 3500": "Matisse", + + # Zen 3 (Vermeer) (WIP) + "Ryzen 9 5950X": "Vermeer", + "Ryzen 9 5900X": "Vermeer", + "Ryzen 7 5800X": "Vermeer", + "Ryzen 5 5600X": "Vermeer", + "Ryzen 5 5600": "Vermeer", + + # Zen (Raven Ridge) (Completed) + "Athlon 200GE": "Raven Ridge", + "Athlon 220GE": "Raven Ridge", + "Athlon 240GE": "Raven Ridge", + "Athlon 3000GE": "Raven Ridge", + "Athlon PRO 200GE": "Raven Ridge", + "Ryzen 3 2200G": "Raven Ridge", + "Ryzen 3 2200GE": "Raven Ridge", + "Ryzen 3 2200U": "Raven Ridge", + "Ryzen 3 2300U": "Raven Ridge", + "Ryzen 3 PRO 2200G": "Raven Ridge", + "Ryzen 3 PRO 2200GE": "Raven Ridge", + "Ryzen 3 PRO 2300U": "Raven Ridge", + "Ryzen 5 2400G": "Raven Ridge", + "Ryzen 5 2400GE": "Raven Ridge", + "Ryzen 5 2500U": "Raven Ridge", + "Ryzen 5 2600H": "Raven Ridge", + "Ryzen 5 PRO 2400G": "Raven Ridge", + "Ryzen 5 PRO 2400GE": "Raven Ridge", + "Ryzen 5 PRO 2500U": "Raven Ridge", + "Ryzen 7 2700U": "Raven Ridge", + "Ryzen 7 2800H": "Raven Ridge", + "Ryzen 7 PRO 2700U": "Raven Ridge", + + # Zen+ (Picasso) (Completed) + "Athlon 300U": "Picasso", + "Athlon PRO 300GE": "Picasso", + "Athlon PRO 300U": "Picasso", + "Ryzen 3 3200G": "Picasso", + "Ryzen 3 3200U": "Picasso", + "Ryzen 3 3300U": "Picasso", + "Ryzen 3 PRO 3200G": "Picasso", + "Ryzen 3 PRO 3200GE": "Picasso", + "Ryzen 3 PRO 3300U": "Picasso", + "Ryzen 5 3400G": "Picasso", + "Ryzen 5 3500U": "Picasso", + "Ryzen 5 3550H": "Picasso", + "Ryzen 5 3580U": "Picasso", + "Ryzen 5 PRO 3400G": "Picasso", + "Ryzen 5 PRO 3400GE": "Picasso", + "Ryzen 5 PRO 3500U": "Picasso", + "Ryzen 7 3700U": "Picasso", + "Ryzen 7 3750H": "Picasso", + "Ryzen 7 3780U": "Picasso", + "Ryzen 7 PRO 3700U": "Picasso", + + # N/A (Dali) (Completed) + "Athlon 3000G": "Dali", + "Athlon Gold 3150U": "Dali", + "Athlon Silver 3050U": "Dali", + "Ryzen 3 3250U": "Dali", + + # Zen 2 (Renoir) (Completed) + "Ryzen 3 4300U": "Renoir", + "Ryzen 3 4300G": "Renoir", + "Ryzen 3 4300GE": "Renoir", + "Ryzen 3 PRO 4350G": "Renoir", + "Ryzen 3 PRO 4350GE": "Renoir", + "Ryzen 3 PRO 4450U": "Renoir", + "Ryzen 5 4500U": "Renoir", + "Ryzen 5 4600U": "Renoir", + "Ryzen 5 4600G": "Renoir", + "Ryzen 5 4600GE": "Renoir", + "Ryzen 5 4600H": "Renoir", + "Ryzen 5 4600HS": "Renoir", + "Ryzen 5 4680U": "Renoir", + "Ryzen 5 PRO 4650G": "Renoir", + "Ryzen 5 PRO 4650GE": "Renoir", + "Ryzen 5 PRO 4650U": "Renoir", + "Ryzen 7 4700U": "Renoir", + "Ryzen 7 4700G": "Renoir", + "Ryzen 7 4700GE": "Renoir", + "Ryzen 7 4800U": "Renoir", + "Ryzen 7 4800H": "Renoir", + "Ryzen 7 4800HS": "Renoir", + "Ryzen 7 4980U": "Renoir", + "Ryzen 7 PRO 4750G": "Renoir", + "Ryzen 7 PRO 4750GE": "Renoir", + "Ryzen 7 PRO 4750U": "Renoir", + "Ryzen 9 4900H": "Renoir", + "Ryzen 9 4900HS": "Renoir", + + # Zen 3 (Cezanne) (Completed) + "Ryzen 3 5300G": "Cezanne", + "Ryzen 3 5300GE": "Cezanne", + "Ryzen 3 5400U": "Cezanne", + "Ryzen 3 PRO 5350G": "Cezanne", + "Ryzen 3 PRO 5350GE": "Cezanne", + "Ryzen 3 PRO 5450U": "Cezanne", + "Ryzen 5 5600G": "Cezanne", + "Ryzen 5 5600GE": "Cezanne", + "Ryzen 5 5600H": "Cezanne", + "Ryzen 5 5600HS": "Cezanne", + "Ryzen 5 5600U": "Cezanne", + "Ryzen 5 PRO 5650G": "Cezanne", + "Ryzen 5 PRO 5650GE": "Cezanne", + "Ryzen 5 PRO 5650U": "Cezanne", + "Ryzen 7 5700G": "Cezanne", + "Ryzen 7 5700GE": "Cezanne", + "Ryzen 7 5800H": "Cezanne", + "Ryzen 7 5800HS": "Cezanne", + "Ryzen 7 5800U": "Cezanne", + "Ryzen 7 PRO 5750G": "Cezanne", + "Ryzen 7 PRO 5750GE": "Cezanne", + "Ryzen 7 PRO 5850U": "Cezanne", + "Ryzen 9 5900HS": "Cezanne", + "Ryzen 9 5900HX": "Cezanne", + "Ryzen 9 5980HS": "Cezanne", + "Ryzen 9 5980HX": "Cezanne", + + # Zen 3 (Lucienne) (Completed) + "Ryzen 3 5300U": "Lucienne", + "Ryzen 7 5700U": "Lucienne", + "Ryzen 5 5500U": "Lucienne", + + # N/A (Van Gogh) founded on Steam Deck + "Aerith": "Van Gogh", + + # Zen 3+ (Rembrandt) (WIP) + "Ryzen 9 6980HX": "Rembrandt", + "Ryzen 9 6900HS": "Rembrandt", + "Ryzen 7 6800H": "Rembrandt", + "Ryzen 5 6600H": "Rembrandt", +} + CONFIG_PATH = 'config.ini' LATEST_VERSION_URL = "https://github.com/AppleOSX/UXTU4Mac/releases/latest" LOCAL_VERSION = "0.0.95" @@ -30,7 +195,7 @@ console_handler.setLevel(logging.INFO) logging.getLogger().addHandler(console_handler) - + def get_system_info(command): process = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True) output, error = process.communicate() @@ -39,33 +204,70 @@ def get_system_info(command): def print_system_info(): logging.info("Device Information:") logging.info(f' Name: {get_system_info("scutil --get ComputerName")}') - logging.info(f' Model: {get_system_info("sysctl -n hw.model")}') - logging.info(f' macOS version: {get_system_info("sysctl -n kern.osrelease")}') + logging.info(f' Model (SMBios): {get_system_info("sysctl -n hw.model")}') + logging.info(" {}".format(get_system_info("system_profiler SPHardwareDataType | grep 'Serial Number'"))) + logging.info(f' macOS: {get_system_info("sysctl -n kern.osproductversion")}') logging.info("\nProcessor Information:") logging.info( f' Processor: {get_system_info("sysctl -n machdep.cpu.brand_string")}' ) + cpu_string = get_system_info("sysctl -n machdep.cpu.brand_string") + + cpu_code_name = next((amd_ryzen_cpus[key] for key in amd_ryzen_cpus if key in cpu_string), None) + + logging.info(f' Code Name: {cpu_code_name}') + logging.info(f' Cores: {get_system_info("sysctl -n hw.physicalcpu")}') logging.info(f' Threads: {get_system_info("sysctl -n hw.logicalcpu")}') + logging.info(" {}".format(get_system_info("system_profiler SPHardwareDataType | grep 'L2'"))) + logging.info(" {}".format(get_system_info("system_profiler SPHardwareDataType | grep 'L3'"))) base_clock = float(get_system_info("sysctl -n hw.cpufrequency_max")) / (10**9) logging.info(" Base clock: {:.2f} GHz".format(base_clock)) + logging.info(f' Vendor: {get_system_info("sysctl -n machdep.cpu.vendor")}') + logging.info(f' Family: {get_system_info("sysctl -n machdep.cpu.family")}') logging.info( f' Features: {get_system_info("sysctl -a | grep machdep.cpu.features").split(": ")[1]}' ) - logging.info(f' Vendor: {get_system_info("sysctl -n machdep.cpu.vendor")}') - logging.info(f' Family: {get_system_info("sysctl -n machdep.cpu.family")}') - logging.info("\nMemory Information:") memory = float(get_system_info("sysctl -n hw.memsize")) / (1024**3) - logging.info(" Memory: {:.2f} GB".format(memory)) + logging.info(" Total Ram: {:.2f} GB".format(memory)) + ram_info = get_system_info("system_profiler SPMemoryDataType") + ram_info_lines = ram_info.split('\n') + ram_slot_names = ["BANK","SODIMM","DIMM"] + + slot_info = [] + try: + for i, line in enumerate(ram_info_lines): + if any(slot_name in line for slot_name in ram_slot_names): + slot_name = line.strip() + size = ram_info_lines[i+2].strip().split(":")[1].strip() + type = ram_info_lines[i+3].strip().split(":")[1].strip() + speed = ram_info_lines[i+4].strip().split(":")[1].strip() + manufacturer = ram_info_lines[i+5].strip().split(":")[1].strip() + part_number = ram_info_lines[i+6].strip().split(":")[1].strip() + serial_number = ram_info_lines[i+7].strip().split(":")[1].strip() + slot_info.append((slot_name, size, type, speed, manufacturer, part_number, serial_number)) + + for i in range(0, len(slot_info), 2): + logging.info(" Size: {}/{}".format(slot_info[i][1], slot_info[i+1][1] if i+1 < len(slot_info) else 'N/A')) + logging.info(" Type: {}/{}".format(slot_info[i][2], slot_info[i+1][2] if i+1 < len(slot_info) else 'N/A')) + logging.info(" Speed: {}/{}".format(slot_info[i][3], slot_info[i+1][3] if i+1 < len(slot_info) else 'N/A')) + logging.info(" Manufacturer: {}/{}".format(slot_info[i][5], slot_info[i+1][5] if i+1 < len(slot_info) else 'N/A')) + logging.info(" Serial Number: {}/{}".format(slot_info[i][6], slot_info[i+1][6] if i+1 < len(slot_info) else 'N/A')) + except: + logging.info("Pardon me for my horrible search for displaying RAM information") + if has_battery := get_system_info( "system_profiler SPPowerDataType | grep 'Battery Information'" ): logging.info("\nBattery Information:") - logging.info(" Health: {}".format(get_system_info("pmset -g batt | egrep '([0-9]+\\%).*' -o --colour=auto | cut -f1 -d';'"))) - logging.info(" Cycles: {}".format(get_system_info("system_profiler SPPowerDataType | grep 'Cycle Count' | awk '{print $3}'"))) - logging.info(" Capacity: {}".format(get_system_info("system_profiler SPPowerDataType | grep 'Full Charge Capacity' | awk '{print $5}'"))) + logging.info(" {}".format(get_system_info("system_profiler SPPowerDataType | grep 'Manufacturer'"))) + logging.info(" {}".format(get_system_info("system_profiler SPPowerDataType | grep 'Device'"))) + logging.info(" State of Charge (%): {}".format(get_system_info("pmset -g batt | egrep '([0-9]+\\%).*' -o --colour=auto | cut -f1 -d';'"))) + logging.info(" {}".format(get_system_info("system_profiler SPPowerDataType | grep 'Cycle Count'"))) + logging.info(" {}".format(get_system_info("system_profiler SPPowerDataType | grep 'Full Charge Capacity'"))) + logging.info(" {}".format(get_system_info("system_profiler SPPowerDataType | grep 'Condition'"))) def print_hardware_info(): clr_print_logo() From 938fed2c2b30a5289b5dfd3ddc6182994e0ec717 Mon Sep 17 00:00:00 2001 From: Sourcery AI <> Date: Wed, 14 Feb 2024 03:38:38 +0000 Subject: [PATCH 2/4] 'Refactored by Sourcery' --- UXTU4Mac/UXTU4Mac.py | 78 +++++++++++++++++++++++++++++--------------- 1 file changed, 52 insertions(+), 26 deletions(-) diff --git a/UXTU4Mac/UXTU4Mac.py b/UXTU4Mac/UXTU4Mac.py index 9abeb72..2bcf9c2 100644 --- a/UXTU4Mac/UXTU4Mac.py +++ b/UXTU4Mac/UXTU4Mac.py @@ -205,7 +205,9 @@ def print_system_info(): logging.info("Device Information:") logging.info(f' Name: {get_system_info("scutil --get ComputerName")}') logging.info(f' Model (SMBios): {get_system_info("sysctl -n hw.model")}') - logging.info(" {}".format(get_system_info("system_profiler SPHardwareDataType | grep 'Serial Number'"))) + logging.info( + f""" {get_system_info("system_profiler SPHardwareDataType | grep 'Serial Number'")}""" + ) logging.info(f' macOS: {get_system_info("sysctl -n kern.osproductversion")}') logging.info("\nProcessor Information:") @@ -220,8 +222,12 @@ def print_system_info(): logging.info(f' Cores: {get_system_info("sysctl -n hw.physicalcpu")}') logging.info(f' Threads: {get_system_info("sysctl -n hw.logicalcpu")}') - logging.info(" {}".format(get_system_info("system_profiler SPHardwareDataType | grep 'L2'"))) - logging.info(" {}".format(get_system_info("system_profiler SPHardwareDataType | grep 'L3'"))) + logging.info( + f""" {get_system_info("system_profiler SPHardwareDataType | grep 'L2'")}""" + ) + logging.info( + f""" {get_system_info("system_profiler SPHardwareDataType | grep 'L3'")}""" + ) base_clock = float(get_system_info("sysctl -n hw.cpufrequency_max")) / (10**9) logging.info(" Base clock: {:.2f} GHz".format(base_clock)) logging.info(f' Vendor: {get_system_info("sysctl -n machdep.cpu.vendor")}') @@ -238,36 +244,56 @@ def print_system_info(): slot_info = [] try: - for i, line in enumerate(ram_info_lines): - if any(slot_name in line for slot_name in ram_slot_names): - slot_name = line.strip() - size = ram_info_lines[i+2].strip().split(":")[1].strip() - type = ram_info_lines[i+3].strip().split(":")[1].strip() - speed = ram_info_lines[i+4].strip().split(":")[1].strip() - manufacturer = ram_info_lines[i+5].strip().split(":")[1].strip() - part_number = ram_info_lines[i+6].strip().split(":")[1].strip() - serial_number = ram_info_lines[i+7].strip().split(":")[1].strip() - slot_info.append((slot_name, size, type, speed, manufacturer, part_number, serial_number)) - - for i in range(0, len(slot_info), 2): - logging.info(" Size: {}/{}".format(slot_info[i][1], slot_info[i+1][1] if i+1 < len(slot_info) else 'N/A')) - logging.info(" Type: {}/{}".format(slot_info[i][2], slot_info[i+1][2] if i+1 < len(slot_info) else 'N/A')) - logging.info(" Speed: {}/{}".format(slot_info[i][3], slot_info[i+1][3] if i+1 < len(slot_info) else 'N/A')) - logging.info(" Manufacturer: {}/{}".format(slot_info[i][5], slot_info[i+1][5] if i+1 < len(slot_info) else 'N/A')) - logging.info(" Serial Number: {}/{}".format(slot_info[i][6], slot_info[i+1][6] if i+1 < len(slot_info) else 'N/A')) + for i, line in enumerate(ram_info_lines): + if any(slot_name in line for slot_name in ram_slot_names): + slot_name = line.strip() + size = ram_info_lines[i+2].strip().split(":")[1].strip() + type = ram_info_lines[i+3].strip().split(":")[1].strip() + speed = ram_info_lines[i+4].strip().split(":")[1].strip() + manufacturer = ram_info_lines[i+5].strip().split(":")[1].strip() + part_number = ram_info_lines[i+6].strip().split(":")[1].strip() + serial_number = ram_info_lines[i+7].strip().split(":")[1].strip() + slot_info.append((slot_name, size, type, speed, manufacturer, part_number, serial_number)) + + for i in range(0, len(slot_info), 2): + logging.info( + f" Size: {slot_info[i][1]}/{slot_info[i + 1][1] if i + 1 < len(slot_info) else 'N/A'}" + ) + logging.info( + f" Type: {slot_info[i][2]}/{slot_info[i + 1][2] if i + 1 < len(slot_info) else 'N/A'}" + ) + logging.info( + f" Speed: {slot_info[i][3]}/{slot_info[i + 1][3] if i + 1 < len(slot_info) else 'N/A'}" + ) + logging.info( + f" Manufacturer: {slot_info[i][5]}/{slot_info[i + 1][5] if i + 1 < len(slot_info) else 'N/A'}" + ) + logging.info( + f" Serial Number: {slot_info[i][6]}/{slot_info[i + 1][6] if i + 1 < len(slot_info) else 'N/A'}" + ) except: logging.info("Pardon me for my horrible search for displaying RAM information") - + if has_battery := get_system_info( "system_profiler SPPowerDataType | grep 'Battery Information'" ): logging.info("\nBattery Information:") - logging.info(" {}".format(get_system_info("system_profiler SPPowerDataType | grep 'Manufacturer'"))) - logging.info(" {}".format(get_system_info("system_profiler SPPowerDataType | grep 'Device'"))) + logging.info( + f""" {get_system_info("system_profiler SPPowerDataType | grep 'Manufacturer'")}""" + ) + logging.info( + f""" {get_system_info("system_profiler SPPowerDataType | grep 'Device'")}""" + ) logging.info(" State of Charge (%): {}".format(get_system_info("pmset -g batt | egrep '([0-9]+\\%).*' -o --colour=auto | cut -f1 -d';'"))) - logging.info(" {}".format(get_system_info("system_profiler SPPowerDataType | grep 'Cycle Count'"))) - logging.info(" {}".format(get_system_info("system_profiler SPPowerDataType | grep 'Full Charge Capacity'"))) - logging.info(" {}".format(get_system_info("system_profiler SPPowerDataType | grep 'Condition'"))) + logging.info( + f""" {get_system_info("system_profiler SPPowerDataType | grep 'Cycle Count'")}""" + ) + logging.info( + f""" {get_system_info("system_profiler SPPowerDataType | grep 'Full Charge Capacity'")}""" + ) + logging.info( + f""" {get_system_info("system_profiler SPPowerDataType | grep 'Condition'")}""" + ) def print_hardware_info(): clr_print_logo() From cb1e0b515c03e4a25ac7baf78e816255f63d7875 Mon Sep 17 00:00:00 2001 From: GorouFlex <98001973+gorouflex@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:42:55 +0700 Subject: [PATCH 3/4] Update Changelog.md --- Changelog.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Changelog.md b/Changelog.md index c83dae4..f106e29 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,10 @@ +## [0.0.96] + +- Support for more hardware information +- Fix a issue when no internet connection result a config override +### This will be the last update for `0.0.x` series + + ## [0.0.95] - Support Hardware Information reader From 63eb3b659d0f3315c715fc0cde18983862a7ed25 Mon Sep 17 00:00:00 2001 From: GorouFlex <98001973+gorouflex@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:43:53 +0700 Subject: [PATCH 4/4] bump --- UXTU4Mac/UXTU4Mac.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/UXTU4Mac/UXTU4Mac.py b/UXTU4Mac/UXTU4Mac.py index 2bcf9c2..b9c6268 100644 --- a/UXTU4Mac/UXTU4Mac.py +++ b/UXTU4Mac/UXTU4Mac.py @@ -9,6 +9,10 @@ import urllib.request from configparser import ConfigParser +CONFIG_PATH = 'config.ini' +LATEST_VERSION_URL = "https://github.com/AppleOSX/UXTU4Mac/releases/latest" +LOCAL_VERSION = "0.0.96" + PRESETS = { "Eco": "--tctl-temp=95 --apu-skin-temp=45 --stapm-limit=6000 --fast-limit=8000 --stapm-time=64 --slow-limit=6000 --slow-time=128 --vrm-current=180000 --vrmmax-current=180000 --vrmsoc-current=180000 --vrmsocmax-current=180000 --vrmgfx-current=180000", "Performance": "--tctl-temp=95 --apu-skin-temp=95 --stapm-limit=28000 --fast-limit=28000 --stapm-time=64 --slow-limit=28000 --slow-time=128 --vrm-current=180000 --vrmmax-current=180000 --vrmsoc-current=180000 --vrmsocmax-current=180000 --vrmgfx-current=180000 ", @@ -180,10 +184,6 @@ "Ryzen 5 6600H": "Rembrandt", } -CONFIG_PATH = 'config.ini' -LATEST_VERSION_URL = "https://github.com/AppleOSX/UXTU4Mac/releases/latest" -LOCAL_VERSION = "0.0.95" - if not os.path.exists('Logs'): os.mkdir('Logs')