From 6239d950fc31f6c697fcff8c0bf5f6ccced6db08 Mon Sep 17 00:00:00 2001 From: Guillaume BOEHM Date: Tue, 16 Apr 2024 11:24:59 +0200 Subject: [PATCH 01/12] Build fixes --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index 259148f..22d8993 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,10 @@ *.exe *.out *.app + +# Generated files +src/i18n/* + +# Generated build files +compile_commands.json +build/ From 6ec71c9479e23acd23b63db06c13f2cc7ff6bd0d Mon Sep 17 00:00:00 2001 From: Guillaume BOEHM Date: Tue, 16 Apr 2024 15:50:04 +0200 Subject: [PATCH 02/12] Add CLI Options - Only the CoolerBoost for now as a POC - Modified some lines that static analyzer was complaining about - Add Options class to handle arg parsing and different option values --- CMakeLists.txt | 2 + src/cli.cpp | 58 ++++++++++++++++++++++ src/cli.h | 33 +++++++++++++ src/i18n/MControlCenter_de_DE.ts | 72 +++++++++++++++++++++++++++ src/i18n/MControlCenter_en.ts | 72 +++++++++++++++++++++++++++ src/i18n/MControlCenter_es.ts | 74 ++++++++++++++++++++++++++- src/i18n/MControlCenter_eu.ts | 74 ++++++++++++++++++++++++++- src/i18n/MControlCenter_fi_FI.ts | 74 ++++++++++++++++++++++++++- src/i18n/MControlCenter_fr.ts | 72 +++++++++++++++++++++++++++ src/i18n/MControlCenter_hu.ts | 74 ++++++++++++++++++++++++++- src/i18n/MControlCenter_it.ts | 74 ++++++++++++++++++++++++++- src/i18n/MControlCenter_nb.ts | 74 ++++++++++++++++++++++++++- src/i18n/MControlCenter_nl_NL.ts | 74 ++++++++++++++++++++++++++- src/i18n/MControlCenter_pt_BR.ts | 74 ++++++++++++++++++++++++++- src/i18n/MControlCenter_pt_PT.ts | 74 ++++++++++++++++++++++++++- src/i18n/MControlCenter_ru.ts | 72 +++++++++++++++++++++++++++ src/i18n/MControlCenter_tr.ts | 74 ++++++++++++++++++++++++++- src/i18n/MControlCenter_vi.ts | 74 ++++++++++++++++++++++++++- src/i18n/MControlCenter_zh_CN.ts | 74 ++++++++++++++++++++++++++- src/main.cpp | 40 +++++++++++++-- src/mainwindow.cpp | 16 ++++-- src/mainwindow.h | 1 + src/options.cpp | 85 ++++++++++++++++++++++++++++++++ src/options.h | 53 ++++++++++++++++++++ 24 files changed, 1444 insertions(+), 20 deletions(-) create mode 100644 src/cli.cpp create mode 100644 src/cli.h create mode 100644 src/options.cpp create mode 100644 src/options.h diff --git a/CMakeLists.txt b/CMakeLists.txt index ac961e2..f4c7289 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,9 +20,11 @@ set(PROJECT_SOURCES src/mainwindow.ui src/mainwindow.cpp src/mainwindow.h src/operate.cpp src/operate.h + src/cli.cpp src/cli.h src/helper.cpp src/helper.h src/msi-ec_helper.cpp src/msi-ec_helper.h src/settings.cpp src/settings.h + src/options.cpp src/options.h src/resources.qrc ) diff --git a/src/cli.cpp b/src/cli.cpp new file mode 100644 index 0000000..fd46be1 --- /dev/null +++ b/src/cli.cpp @@ -0,0 +1,58 @@ +/* Copyright (C) 2022 Dmitry Serov + * + * This file is part of MControlCenter. + * + * MControlCenter 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. + * + * MControlCenter 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 MControlCenter. If not, see . + */ + +#include "cli.h" +#include "operate.h" + +static Operate operate; + +CLI::CLI() { + if (!operate.isEcSysModuleLoaded() && !operate.loadEcSysModule()){ + fprintf(stderr, "Failed to load the ec_sys kernel module\n"); + exit(1); + } + + if(!operate.updateEcData() || operate.getEcVersion().empty()){ + fprintf(stderr, "Failed to update EC data\n"); + exit(1); + } + + if (!operate.doProbe()) { + fprintf(stderr, "Failed probing devices\n"); + exit(1); + } +} + +CLI::~CLI() { +} + +void CLI::setCoolerBoost(Options::State state){ + bool on = false; + if(state == Options::State::TOGGLE){ // TOGGLE + on = !operate.getCoolerBoostState(); + } + else{ + on = state; + } + + if(operate.getCoolerBoostState() != on){ + fprintf(stdout, "%s Cooler Boost\n", ( on ? "Enabling" : "Disabling" )); + operate.setCoolerBoostState(on); + operate.updateEcData(); + } +} diff --git a/src/cli.h b/src/cli.h new file mode 100644 index 0000000..6613afb --- /dev/null +++ b/src/cli.h @@ -0,0 +1,33 @@ +/* Copyright (C) 2022 Dmitry Serov + * + * This file is part of MControlCenter. + * + * MControlCenter 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. + * + * MControlCenter 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 MControlCenter. If not, see . + */ + +#ifndef CLI_H +#define CLI_H + +#include "options.h" + +class CLI { + +public: + CLI(); + ~CLI(); + + void setCoolerBoost(Options::State on); +}; + +#endif // CLI_H diff --git a/src/i18n/MControlCenter_de_DE.ts b/src/i18n/MControlCenter_de_DE.ts index f14d7cd..e5cd9a5 100644 --- a/src/i18n/MControlCenter_de_DE.ts +++ b/src/i18n/MControlCenter_de_DE.ts @@ -297,5 +297,77 @@ Weitere Informationen finden Sie auf der Seite <Über>. If you mainly use your laptop with the charger plugged most of the time, it is recommended to set the charge capacity at a lower percentage (60% or 80%) to prolong your battery lifecycle. Wenn Sie Ihren Laptop überwiegend mit angeschlossenem Ladegerät verwenden, empfiehlt es sich, die Ladekapazität auf einen niedrigeren Prozentsatz (60 % oder 80 %) einzustellen, um die Lebensdauer Ihres Akkus zu verlängern. + + Fan 1: + + + + Fan 2: + + + + Fan Mode: + + + + Info + + + + Choose the mode that best suits your use case + + + + A mode that provides the best system performance for multi-tasking and heavy duty + + + + A mode that brings a balance between performance and battery live + + + + A quiet mode that lowers the fan noise + + + + A power-saving mode that lowers the power consumption for basic needs + + + + If you mainly use your laptop with adaptor plugged, we suggest you set the charge capacity at a lower percentage (60% or 80%) to prolong your battery lifecycle + + + + Charge the battery to 100% all the time + + + + Keyboard Backlit + + + + FN ⇄ Super + + + + USB Power Share + + + + Settings + + + + GitHub: + + + + Bug tracker: + + + + An application that allows you to change the settings of MSI laptops running Linux + + diff --git a/src/i18n/MControlCenter_en.ts b/src/i18n/MControlCenter_en.ts index 6c95fa6..28e08c7 100644 --- a/src/i18n/MControlCenter_en.ts +++ b/src/i18n/MControlCenter_en.ts @@ -296,5 +296,77 @@ Check the <About> page for more info. Failed to load both msi-ec/ec_sys + + Fan 1: + + + + Fan 2: + + + + Fan Mode: + + + + Info + + + + Choose the mode that best suits your use case + + + + A mode that provides the best system performance for multi-tasking and heavy duty + + + + A mode that brings a balance between performance and battery live + + + + A quiet mode that lowers the fan noise + + + + A power-saving mode that lowers the power consumption for basic needs + + + + If you mainly use your laptop with adaptor plugged, we suggest you set the charge capacity at a lower percentage (60% or 80%) to prolong your battery lifecycle + + + + Charge the battery to 100% all the time + + + + Keyboard Backlit + + + + FN ⇄ Super + + + + USB Power Share + + + + Settings + + + + GitHub: + + + + Bug tracker: + + + + An application that allows you to change the settings of MSI laptops running Linux + + diff --git a/src/i18n/MControlCenter_es.ts b/src/i18n/MControlCenter_es.ts index 7a96233..b23c17d 100644 --- a/src/i18n/MControlCenter_es.ts +++ b/src/i18n/MControlCenter_es.ts @@ -249,7 +249,7 @@ Charge the battery when under 90%, stop at 100% - + Carga la batería cuando esta por debajo del 50% hasta llegar al 60% {90%?} {100%?} Keyboard Backlight @@ -296,5 +296,77 @@ Check the <About> page for more info. Failed to load both msi-ec/ec_sys + + Fan 1: + + + + Fan 2: + + + + Fan Mode: + + + + Info + + + + Choose the mode that best suits your use case + + + + A mode that provides the best system performance for multi-tasking and heavy duty + + + + A mode that brings a balance between performance and battery live + + + + A quiet mode that lowers the fan noise + + + + A power-saving mode that lowers the power consumption for basic needs + + + + If you mainly use your laptop with adaptor plugged, we suggest you set the charge capacity at a lower percentage (60% or 80%) to prolong your battery lifecycle + + + + Charge the battery to 100% all the time + + + + Keyboard Backlit + + + + FN ⇄ Super + + + + USB Power Share + + + + Settings + + + + GitHub: + + + + Bug tracker: + + + + An application that allows you to change the settings of MSI laptops running Linux + + diff --git a/src/i18n/MControlCenter_eu.ts b/src/i18n/MControlCenter_eu.ts index 081a1c3..3dbc381 100644 --- a/src/i18n/MControlCenter_eu.ts +++ b/src/i18n/MControlCenter_eu.ts @@ -249,7 +249,7 @@ Charge the battery when under 90%, stop at 100% - + Kargatu bateria %50-tik behera dagoenean, %60-ra iristean gelditu {90%?} {100%?} Keyboard Backlight @@ -296,5 +296,77 @@ Check the <About> page for more info. Failed to load both msi-ec/ec_sys + + Fan 1: + + + + Fan 2: + + + + Fan Mode: + + + + Info + + + + Choose the mode that best suits your use case + + + + A mode that provides the best system performance for multi-tasking and heavy duty + + + + A mode that brings a balance between performance and battery live + + + + A quiet mode that lowers the fan noise + + + + A power-saving mode that lowers the power consumption for basic needs + + + + If you mainly use your laptop with adaptor plugged, we suggest you set the charge capacity at a lower percentage (60% or 80%) to prolong your battery lifecycle + + + + Charge the battery to 100% all the time + + + + Keyboard Backlit + + + + FN ⇄ Super + + + + USB Power Share + + + + Settings + + + + GitHub: + + + + Bug tracker: + + + + An application that allows you to change the settings of MSI laptops running Linux + + diff --git a/src/i18n/MControlCenter_fi_FI.ts b/src/i18n/MControlCenter_fi_FI.ts index fe92032..07f0c5e 100644 --- a/src/i18n/MControlCenter_fi_FI.ts +++ b/src/i18n/MControlCenter_fi_FI.ts @@ -249,7 +249,7 @@ Charge the battery when under 90%, stop at 100% - + Lataa akkua kun varaustaso on alle 50, lopeta lataaminen 60% {90%?} {100%?} Keyboard Backlight @@ -296,5 +296,77 @@ Check the <About> page for more info. Failed to load both msi-ec/ec_sys + + Fan 1: + + + + Fan 2: + + + + Fan Mode: + + + + Info + + + + Choose the mode that best suits your use case + + + + A mode that provides the best system performance for multi-tasking and heavy duty + + + + A mode that brings a balance between performance and battery live + + + + A quiet mode that lowers the fan noise + + + + A power-saving mode that lowers the power consumption for basic needs + + + + If you mainly use your laptop with adaptor plugged, we suggest you set the charge capacity at a lower percentage (60% or 80%) to prolong your battery lifecycle + + + + Charge the battery to 100% all the time + + + + Keyboard Backlit + + + + FN ⇄ Super + + + + USB Power Share + + + + Settings + + + + GitHub: + + + + Bug tracker: + + + + An application that allows you to change the settings of MSI laptops running Linux + + diff --git a/src/i18n/MControlCenter_fr.ts b/src/i18n/MControlCenter_fr.ts index d9c6c0a..9eb6318 100644 --- a/src/i18n/MControlCenter_fr.ts +++ b/src/i18n/MControlCenter_fr.ts @@ -297,5 +297,77 @@ Regardez la page <À propos> pour plus d'informations. Failed to load both msi-ec/ec_sys Impossible de détecter msi-ec ou ec_sys + + Fan 1: + + + + Fan 2: + + + + Fan Mode: + + + + Info + + + + Choose the mode that best suits your use case + + + + A mode that provides the best system performance for multi-tasking and heavy duty + + + + A mode that brings a balance between performance and battery live + + + + A quiet mode that lowers the fan noise + + + + A power-saving mode that lowers the power consumption for basic needs + + + + If you mainly use your laptop with adaptor plugged, we suggest you set the charge capacity at a lower percentage (60% or 80%) to prolong your battery lifecycle + + + + Charge the battery to 100% all the time + + + + Keyboard Backlit + + + + FN ⇄ Super + + + + USB Power Share + + + + Settings + + + + GitHub: + + + + Bug tracker: + + + + An application that allows you to change the settings of MSI laptops running Linux + + diff --git a/src/i18n/MControlCenter_hu.ts b/src/i18n/MControlCenter_hu.ts index b51c11a..840e725 100644 --- a/src/i18n/MControlCenter_hu.ts +++ b/src/i18n/MControlCenter_hu.ts @@ -249,7 +249,7 @@ Charge the battery when under 90%, stop at 100% - + Töltse fel az akkumulátort ha 50% alatt van és állítsa le a töltést 60%-on {90%?} {100%?} Keyboard Backlight @@ -296,5 +296,77 @@ Check the <About> page for more info. Failed to load both msi-ec/ec_sys + + Fan 1: + + + + Fan 2: + + + + Fan Mode: + + + + Info + + + + Choose the mode that best suits your use case + + + + A mode that provides the best system performance for multi-tasking and heavy duty + + + + A mode that brings a balance between performance and battery live + + + + A quiet mode that lowers the fan noise + + + + A power-saving mode that lowers the power consumption for basic needs + + + + If you mainly use your laptop with adaptor plugged, we suggest you set the charge capacity at a lower percentage (60% or 80%) to prolong your battery lifecycle + + + + Charge the battery to 100% all the time + + + + Keyboard Backlit + + + + FN ⇄ Super + + + + USB Power Share + + + + Settings + + + + GitHub: + + + + Bug tracker: + + + + An application that allows you to change the settings of MSI laptops running Linux + + diff --git a/src/i18n/MControlCenter_it.ts b/src/i18n/MControlCenter_it.ts index 497f65c..956d429 100644 --- a/src/i18n/MControlCenter_it.ts +++ b/src/i18n/MControlCenter_it.ts @@ -249,7 +249,7 @@ Charge the battery when under 90%, stop at 100% - + Carica la batteria quando sotto 50%, ferma al 60% {90%?} {100%?} Keyboard Backlight @@ -296,5 +296,77 @@ Check the <About> page for more info. Failed to load both msi-ec/ec_sys + + Fan 1: + + + + Fan 2: + + + + Fan Mode: + + + + Info + + + + Choose the mode that best suits your use case + + + + A mode that provides the best system performance for multi-tasking and heavy duty + + + + A mode that brings a balance between performance and battery live + + + + A quiet mode that lowers the fan noise + + + + A power-saving mode that lowers the power consumption for basic needs + + + + If you mainly use your laptop with adaptor plugged, we suggest you set the charge capacity at a lower percentage (60% or 80%) to prolong your battery lifecycle + + + + Charge the battery to 100% all the time + + + + Keyboard Backlit + + + + FN ⇄ Super + + + + USB Power Share + + + + Settings + + + + GitHub: + + + + Bug tracker: + + + + An application that allows you to change the settings of MSI laptops running Linux + + diff --git a/src/i18n/MControlCenter_nb.ts b/src/i18n/MControlCenter_nb.ts index 973c679..608e4ef 100644 --- a/src/i18n/MControlCenter_nb.ts +++ b/src/i18n/MControlCenter_nb.ts @@ -249,7 +249,7 @@ Charge the battery when under 90%, stop at 100% - + Lad batteriet når under 50%, stopp ved 60% {90%?} {100%?} Keyboard Backlight @@ -296,5 +296,77 @@ Check the <About> page for more info. Failed to load both msi-ec/ec_sys + + Fan 1: + + + + Fan 2: + + + + Fan Mode: + + + + Info + + + + Choose the mode that best suits your use case + + + + A mode that provides the best system performance for multi-tasking and heavy duty + + + + A mode that brings a balance between performance and battery live + + + + A quiet mode that lowers the fan noise + + + + A power-saving mode that lowers the power consumption for basic needs + + + + If you mainly use your laptop with adaptor plugged, we suggest you set the charge capacity at a lower percentage (60% or 80%) to prolong your battery lifecycle + + + + Charge the battery to 100% all the time + + + + Keyboard Backlit + + + + FN ⇄ Super + + + + USB Power Share + + + + Settings + + + + GitHub: + + + + Bug tracker: + + + + An application that allows you to change the settings of MSI laptops running Linux + + diff --git a/src/i18n/MControlCenter_nl_NL.ts b/src/i18n/MControlCenter_nl_NL.ts index 19e2df6..a7b1cf6 100644 --- a/src/i18n/MControlCenter_nl_NL.ts +++ b/src/i18n/MControlCenter_nl_NL.ts @@ -249,7 +249,7 @@ Charge the battery when under 90%, stop at 100% - + Laad de accu wanneer deze onder de 50% is, stop bij 60% {90%?} {100%?} Keyboard Backlight @@ -296,5 +296,77 @@ Check the <About> page for more info. Failed to load both msi-ec/ec_sys + + Fan 1: + + + + Fan 2: + + + + Fan Mode: + + + + Info + + + + Choose the mode that best suits your use case + + + + A mode that provides the best system performance for multi-tasking and heavy duty + + + + A mode that brings a balance between performance and battery live + + + + A quiet mode that lowers the fan noise + + + + A power-saving mode that lowers the power consumption for basic needs + + + + If you mainly use your laptop with adaptor plugged, we suggest you set the charge capacity at a lower percentage (60% or 80%) to prolong your battery lifecycle + + + + Charge the battery to 100% all the time + + + + Keyboard Backlit + + + + FN ⇄ Super + + + + USB Power Share + + + + Settings + + + + GitHub: + + + + Bug tracker: + + + + An application that allows you to change the settings of MSI laptops running Linux + + diff --git a/src/i18n/MControlCenter_pt_BR.ts b/src/i18n/MControlCenter_pt_BR.ts index 62bbc3d..101c6ae 100644 --- a/src/i18n/MControlCenter_pt_BR.ts +++ b/src/i18n/MControlCenter_pt_BR.ts @@ -249,7 +249,7 @@ Charge the battery when under 90%, stop at 100% - + Carregar a bateria quando estiver abaixo de 50%, parar a 60% {90%?} {100%?} Keyboard Backlight @@ -296,5 +296,77 @@ Check the <About> page for more info. Failed to load both msi-ec/ec_sys + + Fan 1: + + + + Fan 2: + + + + Fan Mode: + + + + Info + + + + Choose the mode that best suits your use case + + + + A mode that provides the best system performance for multi-tasking and heavy duty + + + + A mode that brings a balance between performance and battery live + + + + A quiet mode that lowers the fan noise + + + + A power-saving mode that lowers the power consumption for basic needs + + + + If you mainly use your laptop with adaptor plugged, we suggest you set the charge capacity at a lower percentage (60% or 80%) to prolong your battery lifecycle + + + + Charge the battery to 100% all the time + + + + Keyboard Backlit + + + + FN ⇄ Super + + + + USB Power Share + + + + Settings + + + + GitHub: + + + + Bug tracker: + + + + An application that allows you to change the settings of MSI laptops running Linux + + diff --git a/src/i18n/MControlCenter_pt_PT.ts b/src/i18n/MControlCenter_pt_PT.ts index f11302c..58cdd48 100644 --- a/src/i18n/MControlCenter_pt_PT.ts +++ b/src/i18n/MControlCenter_pt_PT.ts @@ -249,7 +249,7 @@ Charge the battery when under 90%, stop at 100% - + Carregar a bateria quando estiver abaixo de 50%, parar a 60% {90%?} {100%?} Keyboard Backlight @@ -296,5 +296,77 @@ Check the <About> page for more info. Failed to load both msi-ec/ec_sys + + Fan 1: + + + + Fan 2: + + + + Fan Mode: + + + + Info + + + + Choose the mode that best suits your use case + + + + A mode that provides the best system performance for multi-tasking and heavy duty + + + + A mode that brings a balance between performance and battery live + + + + A quiet mode that lowers the fan noise + + + + A power-saving mode that lowers the power consumption for basic needs + + + + If you mainly use your laptop with adaptor plugged, we suggest you set the charge capacity at a lower percentage (60% or 80%) to prolong your battery lifecycle + + + + Charge the battery to 100% all the time + + + + Keyboard Backlit + + + + FN ⇄ Super + + + + USB Power Share + + + + Settings + + + + GitHub: + + + + Bug tracker: + + + + An application that allows you to change the settings of MSI laptops running Linux + + diff --git a/src/i18n/MControlCenter_ru.ts b/src/i18n/MControlCenter_ru.ts index 13f8bb7..1820045 100644 --- a/src/i18n/MControlCenter_ru.ts +++ b/src/i18n/MControlCenter_ru.ts @@ -297,5 +297,77 @@ Check the <About> page for more info. Failed to load both msi-ec/ec_sys + + Fan 1: + + + + Fan 2: + + + + Fan Mode: + + + + Info + + + + Choose the mode that best suits your use case + + + + A mode that provides the best system performance for multi-tasking and heavy duty + + + + A mode that brings a balance between performance and battery live + + + + A quiet mode that lowers the fan noise + + + + A power-saving mode that lowers the power consumption for basic needs + + + + If you mainly use your laptop with adaptor plugged, we suggest you set the charge capacity at a lower percentage (60% or 80%) to prolong your battery lifecycle + + + + Charge the battery to 100% all the time + + + + Keyboard Backlit + + + + FN ⇄ Super + + + + USB Power Share + + + + Settings + + + + GitHub: + + + + Bug tracker: + + + + An application that allows you to change the settings of MSI laptops running Linux + + diff --git a/src/i18n/MControlCenter_tr.ts b/src/i18n/MControlCenter_tr.ts index 1dd5d81..d63aec4 100644 --- a/src/i18n/MControlCenter_tr.ts +++ b/src/i18n/MControlCenter_tr.ts @@ -252,7 +252,7 @@ Charge the battery when under 90%, stop at 100% - + Pili %50'nin altındayken şarj et, %60'a ulaşınca dur {90%?} {100%?} Keyboard Backlight @@ -299,5 +299,77 @@ Check the <About> page for more info. Failed to load both msi-ec/ec_sys + + Fan 1: + + + + Fan 2: + + + + Fan Mode: + + + + Info + + + + Choose the mode that best suits your use case + + + + A mode that provides the best system performance for multi-tasking and heavy duty + + + + A mode that brings a balance between performance and battery live + + + + A quiet mode that lowers the fan noise + + + + A power-saving mode that lowers the power consumption for basic needs + + + + If you mainly use your laptop with adaptor plugged, we suggest you set the charge capacity at a lower percentage (60% or 80%) to prolong your battery lifecycle + + + + Charge the battery to 100% all the time + + + + Keyboard Backlit + + + + FN ⇄ Super + + + + USB Power Share + + + + Settings + + + + GitHub: + + + + Bug tracker: + + + + An application that allows you to change the settings of MSI laptops running Linux + + diff --git a/src/i18n/MControlCenter_vi.ts b/src/i18n/MControlCenter_vi.ts index ba73685..40b2c25 100644 --- a/src/i18n/MControlCenter_vi.ts +++ b/src/i18n/MControlCenter_vi.ts @@ -249,7 +249,7 @@ Charge the battery when under 90%, stop at 100% - + Sạc khi pin dưới 50%, dừng khi đạt 60% {90%?} {100%?} Keyboard Backlight @@ -296,5 +296,77 @@ Check the <About> page for more info. Failed to load both msi-ec/ec_sys + + Fan 1: + + + + Fan 2: + + + + Fan Mode: + + + + Info + + + + Choose the mode that best suits your use case + + + + A mode that provides the best system performance for multi-tasking and heavy duty + + + + A mode that brings a balance between performance and battery live + + + + A quiet mode that lowers the fan noise + + + + A power-saving mode that lowers the power consumption for basic needs + + + + If you mainly use your laptop with adaptor plugged, we suggest you set the charge capacity at a lower percentage (60% or 80%) to prolong your battery lifecycle + + + + Charge the battery to 100% all the time + + + + Keyboard Backlit + + + + FN ⇄ Super + + + + USB Power Share + + + + Settings + + + + GitHub: + + + + Bug tracker: + + + + An application that allows you to change the settings of MSI laptops running Linux + + diff --git a/src/i18n/MControlCenter_zh_CN.ts b/src/i18n/MControlCenter_zh_CN.ts index 8f51274..b677369 100644 --- a/src/i18n/MControlCenter_zh_CN.ts +++ b/src/i18n/MControlCenter_zh_CN.ts @@ -249,7 +249,7 @@ Charge the battery when under 90%, stop at 100% - + 电量低于 50% 开始充电,充至 60% 停止 {90%?} {100%?} Keyboard Backlight @@ -296,5 +296,77 @@ Check the <About> page for more info. Failed to load both msi-ec/ec_sys + + Fan 1: + + + + Fan 2: + + + + Fan Mode: + + + + Info + + + + Choose the mode that best suits your use case + + + + A mode that provides the best system performance for multi-tasking and heavy duty + + + + A mode that brings a balance between performance and battery live + + + + A quiet mode that lowers the fan noise + + + + A power-saving mode that lowers the power consumption for basic needs + + + + If you mainly use your laptop with adaptor plugged, we suggest you set the charge capacity at a lower percentage (60% or 80%) to prolong your battery lifecycle + + + + Charge the battery to 100% all the time + + + + Keyboard Backlit + + + + FN ⇄ Super + + + + USB Power Share + + + + Settings + + + + GitHub: + + + + Bug tracker: + + + + An application that allows you to change the settings of MSI laptops running Linux + + diff --git a/src/main.cpp b/src/main.cpp index 04faa86..b487037 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,6 +17,8 @@ */ #include "mainwindow.h" +#include "cli.h" +#include "options.h" #include #include @@ -25,11 +27,34 @@ int main(int argc, char *argv[]) { + + Options options; + options.process_args(argc, argv); + const QString serverName = "MControlCenter"; - auto *socket = new QLocalSocket(); + QLocalSocket* socket = new QLocalSocket(); socket->connectToServer(serverName); + + if(options.cli){ + fprintf(stderr, "Executing CLI commands...\n"); + CLI cli; + if(options.cooler_boost.has_value()){ + cli.setCoolerBoost(options.cooler_boost.value()); + } + + if (socket->isOpen()) { + socket->write("update"); + socket->flush(); + socket->close(); + } + socket->deleteLater(); + return 0; + } + if (socket->isOpen()) { fprintf(stderr, "Another instance of the application is already running\n"); + socket->write("show"); + socket->flush(); socket->close(); socket->deleteLater(); return 0; @@ -51,8 +76,17 @@ int main(int argc, char *argv[]) { MainWindow w; QLocalServer server; - QObject::connect(&server, &QLocalServer::newConnection, [&w]() { - w.show(); + QObject::connect(&server, &QLocalServer::newConnection, [&w, &server]() { + QLocalSocket* socket = server.nextPendingConnection(); + if(socket->waitForConnected() && socket->waitForReadyRead()){ + QByteArray data = socket->readAll(); + if(std::strcmp(data.data(), "show") == 0){ + w.show(); + } + else if(std::strcmp(data.data(), "update") == 0){ + w.externalUpdate(); + } + } }); bool serverListening = server.listen(serverName); if (!serverListening && (server.serverError() == QAbstractSocket::AddressInUseError)) { diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5fbaf3d..2b023fc 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -23,7 +23,7 @@ #include #include -Operate operate; +static Operate operate; bool isActive = false; bool isUpdateDataError = false; @@ -215,6 +215,11 @@ void MainWindow::realtimeUpdate() { updateData(); } +void MainWindow::externalUpdate() { + if(operate.updateEcData()) + updateData(); +} + void MainWindow::updateData() { if (!isUpdateDataError && (operate.isMsiEcLoaded() || operate.isEcSysModuleLoaded())) { if (!isActive) { @@ -232,6 +237,7 @@ void MainWindow::updateData() { updateFan2Speed(); updateKeyboardBrightness(); updateWebCamState(); + updateCoolerBoostState(); if (operate.isMsiEcLoaded()) { ui->MsiEcStatusLabel->setText(tr("Loaded")); @@ -467,10 +473,10 @@ void MainWindow::updateFanMode() { void MainWindow::updateFanSpeedSettings() { ui->advancedFanControlCheckBox->setChecked(operate.getFanMode() == fan_mode::advanced_fan_mode); - QVector fan1SpeedSettings = operate.getFan1SpeedSettings(); - QVector fan1TempSettings = operate.getFan1TempSettings(); - QVector fan2SpeedSettings = operate.getFan2SpeedSettings(); - QVector fan2TempSettings = operate.getFan2TempSettings(); + QVector fan1SpeedSettings = operate.getFan1SpeedSettings(); + QVector fan1TempSettings = operate.getFan1TempSettings(); + QVector fan2SpeedSettings = operate.getFan2SpeedSettings(); + QVector fan2TempSettings = operate.getFan2TempSettings(); ui->fan1Speed1Slider->setValue(fan1SpeedSettings[0]); ui->fan1Speed2Slider->setValue(fan1SpeedSettings[1]); diff --git a/src/mainwindow.h b/src/mainwindow.h index 7707139..17893a9 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -35,6 +35,7 @@ Q_OBJECT public: explicit MainWindow(QWidget *parent = nullptr); ~MainWindow(); + void externalUpdate(); void updateData(); static void setUpdateDataError(bool error); diff --git a/src/options.cpp b/src/options.cpp new file mode 100644 index 0000000..727adf0 --- /dev/null +++ b/src/options.cpp @@ -0,0 +1,85 @@ +/* Copyright (C) 2022 Dmitry Serov + * + * This file is part of MControlCenter. + * + * MControlCenter 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. + * + * MControlCenter 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 MControlCenter. If not, see . + */ +#include "options.h" + +#include + +Options::Options() + :cli(false), cooler_boost(std::nullopt) +{} + +void Options::print_help(std::string program_name) +{ + fprintf(stdout, R"(Description +Syntax: %s [options] + + -B, --coolerboost STATE toggle fan cooler boost + -h show help + +Arguments: + STATE: can be 'ON', 'OFF' or 'TOGGLE' +)", program_name.c_str()); + exit(1); +} + +void Options::process_args(int argc, char** argv) +{ + int option_index; + while (true) + { + const auto opt = getopt_long(argc, argv, short_opts.data(), long_opts, &option_index); + + if (-1 == opt){ + break; + } + + switch (opt) + { + case 0: + cli = true; + // long option without short equivalent + break; + + case 'B': + cli = true; + + if(std::strcmp(optarg,"ON") == 0){ + cooler_boost = std::optional{Options::State::ON}; + } + else if(std::strcmp(optarg,"OFF") == 0) + { + cooler_boost = std::optional{Options::State::OFF}; + } + else if(std::strcmp(optarg,"TOGGLE") == 0) + { + cooler_boost = std::optional{Options::State::TOGGLE}; + } + else{ + fprintf(stderr, "Wrong TOGGLE value for coolerboost option.\n"); + print_help(argv[0]); + } + break; + + case 'h': // -h or --help + case '?': // Unrecognized option + default: + print_help(argv[0]); + break; + } + } +} diff --git a/src/options.h b/src/options.h new file mode 100644 index 0000000..27644dc --- /dev/null +++ b/src/options.h @@ -0,0 +1,53 @@ +/* Copyright (C) 2022 Dmitry Serov + * + * This file is part of MControlCenter. + * + * MControlCenter 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. + * + * MControlCenter 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 MControlCenter. If not, see . + */ + +#ifndef OPTIONS_H +#define OPTIONS_H + +#include +#include +#include + +class Options{ +public: + Options(); + ~Options() = default; + + enum State { + OFF = 0, + ON = 1, + TOGGLE = 2 + }; + + bool cli; + std::optional cooler_boost; + + void process_args(int argc, char** argv); + +private: + static constexpr std::string_view const short_opts = "B:h"; + static constexpr option long_opts[] = { + {"coolerboost", required_argument, nullptr, 'B'}, + {"help", no_argument, nullptr, 'h'}, + {nullptr, no_argument, nullptr, 0} + }; + + void print_help(std::string program_name); +}; + +#endif // OPTIONS_H From daf9352de77c1eb067c32f76b6aed8ba60f1185a Mon Sep 17 00:00:00 2001 From: Guillaume BOEHM Date: Fri, 15 Aug 2025 11:55:13 +0200 Subject: [PATCH 03/12] Replace strcmp uses with string operators Less performant but more readable --- src/main.cpp | 5 ++--- src/options.cpp | 8 +++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index b487037..4d90238 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -25,7 +25,6 @@ #include #include - int main(int argc, char *argv[]) { Options options; @@ -80,10 +79,10 @@ int main(int argc, char *argv[]) { QLocalSocket* socket = server.nextPendingConnection(); if(socket->waitForConnected() && socket->waitForReadyRead()){ QByteArray data = socket->readAll(); - if(std::strcmp(data.data(), "show") == 0){ + if(std::string(data.data()) == "show"){ w.show(); } - else if(std::strcmp(data.data(), "update") == 0){ + else if(std::string(data.data()) == "update"){ w.externalUpdate(); } } diff --git a/src/options.cpp b/src/options.cpp index 727adf0..c361a28 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -17,8 +17,6 @@ */ #include "options.h" -#include - Options::Options() :cli(false), cooler_boost(std::nullopt) {} @@ -58,14 +56,14 @@ void Options::process_args(int argc, char** argv) case 'B': cli = true; - if(std::strcmp(optarg,"ON") == 0){ + if(std::string(optarg) =="ON"){ cooler_boost = std::optional{Options::State::ON}; } - else if(std::strcmp(optarg,"OFF") == 0) + else if(std::string(optarg) == "OFF") { cooler_boost = std::optional{Options::State::OFF}; } - else if(std::strcmp(optarg,"TOGGLE") == 0) + else if(std::string(optarg) == "TOGGLE") { cooler_boost = std::optional{Options::State::TOGGLE}; } From d1de766cd400df8e422883f74894cbae07dc6faf Mon Sep 17 00:00:00 2001 From: Guillaume BOEHM Date: Fri, 15 Aug 2025 11:59:39 +0200 Subject: [PATCH 04/12] Print error on update ec data fail --- src/cli.cpp | 4 +++- src/cli.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cli.cpp b/src/cli.cpp index fd46be1..df93c3a 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -53,6 +53,8 @@ void CLI::setCoolerBoost(Options::State state){ if(operate.getCoolerBoostState() != on){ fprintf(stdout, "%s Cooler Boost\n", ( on ? "Enabling" : "Disabling" )); operate.setCoolerBoostState(on); - operate.updateEcData(); + if(!operate.updateEcData()) { + fprintf(stderr, "Failed to update EC data for Cooler Boost\n"); + } } } diff --git a/src/cli.h b/src/cli.h index 6613afb..742bf97 100644 --- a/src/cli.h +++ b/src/cli.h @@ -27,7 +27,7 @@ class CLI { CLI(); ~CLI(); - void setCoolerBoost(Options::State on); + void setCoolerBoost(Options::State state); }; #endif // CLI_H From e857eb18099e3d4c94c11b9776833295dea37a14 Mon Sep 17 00:00:00 2001 From: Guillaume BOEHM Date: Fri, 15 Aug 2025 12:01:56 +0200 Subject: [PATCH 05/12] Add .cache to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 22d8993..2048cee 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ # Generated files src/i18n/* +.cache/ # Generated build files compile_commands.json From 4dc6f55b7919d48d32553f49b10f712e84b42a8f Mon Sep 17 00:00:00 2001 From: Guillaume BOEHM Date: Sat, 20 Apr 2024 12:10:31 +0200 Subject: [PATCH 06/12] fork msg --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 7c3019d..cfbc1ca 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # MControlCenter +## Temporary (hopefully) fork with CLI support until upstream merge + MControlCenter is a Free and Open Source GNU/Linux application that allows you to change the settings of MSI laptops. ![Screen Shot of MCC](https://github.com/user-attachments/assets/1e1dcb9b-aa8e-4410-8c77-f9554c1840cb) @@ -19,11 +21,13 @@ MControlCenter is a Free and Open Source GNU/Linux application that allows you t - Change the maximum battery level limit - Advanced Fan Speed Control (Since version 0.4) - Change other settings such as keyboard backlight mode, USB Power Share, etc. + - CLI support (Cooler Boost only) ## TODO - Saving multiple fan speed profiles - Automatically change performance mode on charger connect/disconnect +- Implement other CLI commands ## Supported devices From e34968a48896a6c0ce4ae428300ed3969a5b0133 Mon Sep 17 00:00:00 2001 From: Dexter2038 <116676321+Dexter2038@users.noreply.github.com> Date: Fri, 20 Dec 2024 15:58:14 +0300 Subject: [PATCH 07/12] Add user mode CLI command --- src/cli.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ src/cli.h | 1 + src/main.cpp | 3 +++ src/options.cpp | 32 +++++++++++++++++++++++++ src/options.h | 16 ++++++++++--- 5 files changed, 111 insertions(+), 3 deletions(-) diff --git a/src/cli.cpp b/src/cli.cpp index df93c3a..098ae0c 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -58,3 +58,65 @@ void CLI::setCoolerBoost(Options::State state){ } } } + +void CLI::changeUserMode(Options::Mode mode){ + bool mode_found = true; + Options::Mode change_mode = mode; + + if(mode == Options::Mode::NEXT){ + user_mode cur_mode = operate.getUserMode(); + switch (cur_mode) { + case user_mode::performance_mode: + change_mode = Options::Mode::BALANCED; + break; + + case user_mode::balanced_mode: + change_mode = Options::Mode::SILENT; + break; + + case user_mode::silent_mode: + change_mode = Options::Mode::BATTERY; + break; + + case user_mode::super_battery_mode: + change_mode = Options::Mode::PERFORMANCE; + break; + + default: + change_mode = Options::Mode::PERFORMANCE; + mode_found = false; + } + } + + user_mode user_mode = user_mode::performance_mode; + std::string text_mode; + + switch (change_mode){ + case Options::Mode::PERFORMANCE: + user_mode = user_mode::performance_mode; + text_mode = "performance"; + break; + + case Options::Mode::BALANCED: + user_mode = user_mode::balanced_mode; + text_mode = "balanced"; + break; + + case Options::Mode::SILENT: + user_mode = user_mode::silent_mode; + text_mode = "silent"; + break; + + case Options::Mode::BATTERY: + user_mode = user_mode::super_battery_mode; + text_mode = "super battery"; + break; + } + + if (!mode_found) { + fprintf(stdout, "Can't get current mode.."); + } + fprintf(stdout, "Changing user mode to %s mode\n", ( text_mode.c_str() )); + operate.setUserMode(user_mode); + operate.updateEcData(); +} \ No newline at end of file diff --git a/src/cli.h b/src/cli.h index 742bf97..b80b1e4 100644 --- a/src/cli.h +++ b/src/cli.h @@ -28,6 +28,7 @@ class CLI { ~CLI(); void setCoolerBoost(Options::State state); + void changeUserMode(Options::Mode mode); }; #endif // CLI_H diff --git a/src/main.cpp b/src/main.cpp index 4d90238..b5413cc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -40,6 +40,9 @@ int main(int argc, char *argv[]) { if(options.cooler_boost.has_value()){ cli.setCoolerBoost(options.cooler_boost.value()); } + if(options.user_mode.has_value()){ + cli.changeUserMode(options.user_mode.value()); + } if (socket->isOpen()) { socket->write("update"); diff --git a/src/options.cpp b/src/options.cpp index c361a28..2a52db2 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -27,10 +27,12 @@ void Options::print_help(std::string program_name) Syntax: %s [options] -B, --coolerboost STATE toggle fan cooler boost + -M, --usermode MODE change user mode -h show help Arguments: STATE: can be 'ON', 'OFF' or 'TOGGLE' + MODE: can be 'PERFORMANCE', 'BALANCED', 'SILENT', 'BATTERY', 'NEXT' )", program_name.c_str()); exit(1); } @@ -71,6 +73,36 @@ void Options::process_args(int argc, char** argv) fprintf(stderr, "Wrong TOGGLE value for coolerboost option.\n"); print_help(argv[0]); } + + break; + + case 'M': + cli = true; + + if(std::strcmp(optarg, "BALANCED") == 0){ + user_mode = std::optional{Options::Mode::BALANCED}; + } + else if(std::strcmp(optarg, "PERFORMANCE") == 0) + { + user_mode = std::optional{Options::Mode::PERFORMANCE}; + } + else if(std::strcmp(optarg, "SILENT") == 0) + { + user_mode = std::optional{Options::Mode::SILENT}; + } + else if(std::strcmp(optarg, "BATTERY") == 0) + { + user_mode = std::optional{Options::Mode::BATTERY}; + } + else if(std::strcmp(optarg, "NEXT") == 0) + { + user_mode = std::optional{Options::Mode::NEXT}; + } + else{ + fprintf(stderr, "Wrong MODE value for usermode option.\n"); + print_help(argv[0]); + } + break; case 'h': // -h or --help diff --git a/src/options.h b/src/options.h index 27644dc..aa3d723 100644 --- a/src/options.h +++ b/src/options.h @@ -34,17 +34,27 @@ class Options{ TOGGLE = 2 }; + enum Mode { + PERFORMANCE = 0, + BALANCED = 1, + SILENT = 2, + BATTERY = 3, + NEXT = 4 + }; + bool cli; std::optional cooler_boost; + std::optional user_mode; void process_args(int argc, char** argv); private: - static constexpr std::string_view const short_opts = "B:h"; + static constexpr std::string_view const short_opts = "B:M:h"; static constexpr option long_opts[] = { {"coolerboost", required_argument, nullptr, 'B'}, - {"help", no_argument, nullptr, 'h'}, - {nullptr, no_argument, nullptr, 0} + {"usermode", required_argument, nullptr, 'M'}, + {"help", no_argument, nullptr, 'h'}, + {nullptr, no_argument, nullptr, 0} }; void print_help(std::string program_name); From 385c3bf5d4d1bb55e3128e388cdbb98cccbc8e74 Mon Sep 17 00:00:00 2001 From: Dexter2038 <116676321+Dexter2038@users.noreply.github.com> Date: Thu, 8 May 2025 00:30:42 +0300 Subject: [PATCH 08/12] Fix incompatible functions --- src/options.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/options.cpp b/src/options.cpp index 2a52db2..254cf5b 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -79,22 +79,22 @@ void Options::process_args(int argc, char** argv) case 'M': cli = true; - if(std::strcmp(optarg, "BALANCED") == 0){ + if(strcmp(optarg, "BALANCED") == 0){ user_mode = std::optional{Options::Mode::BALANCED}; } - else if(std::strcmp(optarg, "PERFORMANCE") == 0) + else if(strcmp(optarg, "PERFORMANCE") == 0) { user_mode = std::optional{Options::Mode::PERFORMANCE}; } - else if(std::strcmp(optarg, "SILENT") == 0) + else if(strcmp(optarg, "SILENT") == 0) { user_mode = std::optional{Options::Mode::SILENT}; } - else if(std::strcmp(optarg, "BATTERY") == 0) + else if(strcmp(optarg, "BATTERY") == 0) { user_mode = std::optional{Options::Mode::BATTERY}; } - else if(std::strcmp(optarg, "NEXT") == 0) + else if(strcmp(optarg, "NEXT") == 0) { user_mode = std::optional{Options::Mode::NEXT}; } From 50ef30a29efcf8778bd5a2b909d1026ca8e21d9e Mon Sep 17 00:00:00 2001 From: Dexter2038 <116676321+Dexter2038@users.noreply.github.com> Date: Fri, 15 Aug 2025 14:17:17 +0300 Subject: [PATCH 09/12] Replace strcmp with string operators --- src/options.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/options.cpp b/src/options.cpp index 254cf5b..6102753 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -79,22 +79,22 @@ void Options::process_args(int argc, char** argv) case 'M': cli = true; - if(strcmp(optarg, "BALANCED") == 0){ + if(std::string(optarg) == "BALANCED"){ user_mode = std::optional{Options::Mode::BALANCED}; } - else if(strcmp(optarg, "PERFORMANCE") == 0) + else if(std::string(optarg) == "PERFORMANCE") { user_mode = std::optional{Options::Mode::PERFORMANCE}; } - else if(strcmp(optarg, "SILENT") == 0) + else if(std::string(optarg) == "SILENT") { user_mode = std::optional{Options::Mode::SILENT}; } - else if(strcmp(optarg, "BATTERY") == 0) + else if(std::string(optarg) == "BATTERY") { user_mode = std::optional{Options::Mode::BATTERY}; } - else if(strcmp(optarg, "NEXT") == 0) + else if(std::string(optarg) == "NEXT") { user_mode = std::optional{Options::Mode::NEXT}; } From 0ec9931f4ab7873b4f46b4cd2be21a1a358d4cd2 Mon Sep 17 00:00:00 2001 From: Dexter2038 <116676321+Dexter2038@users.noreply.github.com> Date: Fri, 15 Aug 2025 15:15:39 +0300 Subject: [PATCH 10/12] Print error on fail of upate ec data --- src/cli.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/cli.cpp b/src/cli.cpp index 098ae0c..5cafc2a 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -60,7 +60,6 @@ void CLI::setCoolerBoost(Options::State state){ } void CLI::changeUserMode(Options::Mode mode){ - bool mode_found = true; Options::Mode change_mode = mode; if(mode == Options::Mode::NEXT){ @@ -82,9 +81,9 @@ void CLI::changeUserMode(Options::Mode mode){ change_mode = Options::Mode::PERFORMANCE; break; - default: + case user_mode::unknown_mode: change_mode = Options::Mode::PERFORMANCE; - mode_found = false; + fprintf(stderr, "Unknown user mode detected\n"); } } @@ -113,10 +112,9 @@ void CLI::changeUserMode(Options::Mode mode){ break; } - if (!mode_found) { - fprintf(stdout, "Can't get current mode.."); - } fprintf(stdout, "Changing user mode to %s mode\n", ( text_mode.c_str() )); operate.setUserMode(user_mode); - operate.updateEcData(); -} \ No newline at end of file + if(!operate.updateEcData()) { + fprintf(stderr, "Failed to update EC data for user mode\n"); + } +} From 862f74955d3e6e8692a40db6a251660e83d1f6dc Mon Sep 17 00:00:00 2001 From: Dexter2038 <116676321+Dexter2038@users.noreply.github.com> Date: Fri, 15 Aug 2025 15:36:09 +0300 Subject: [PATCH 11/12] Rename user mode to User Mode --- src/cli.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cli.cpp b/src/cli.cpp index 5cafc2a..32b2e06 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -83,7 +83,7 @@ void CLI::changeUserMode(Options::Mode mode){ case user_mode::unknown_mode: change_mode = Options::Mode::PERFORMANCE; - fprintf(stderr, "Unknown user mode detected\n"); + fprintf(stderr, "Unknown User Mode detected\n"); } } @@ -93,28 +93,28 @@ void CLI::changeUserMode(Options::Mode mode){ switch (change_mode){ case Options::Mode::PERFORMANCE: user_mode = user_mode::performance_mode; - text_mode = "performance"; + text_mode = "Performance"; break; case Options::Mode::BALANCED: user_mode = user_mode::balanced_mode; - text_mode = "balanced"; + text_mode = "Balanced"; break; case Options::Mode::SILENT: user_mode = user_mode::silent_mode; - text_mode = "silent"; + text_mode = "Silent"; break; case Options::Mode::BATTERY: user_mode = user_mode::super_battery_mode; - text_mode = "super battery"; + text_mode = "Super Battery"; break; } - fprintf(stdout, "Changing user mode to %s mode\n", ( text_mode.c_str() )); + fprintf(stdout, "Changing User Mode to %s Mode\n", ( text_mode.c_str() )); operate.setUserMode(user_mode); if(!operate.updateEcData()) { - fprintf(stderr, "Failed to update EC data for user mode\n"); + fprintf(stderr, "Failed to update EC data for User Mode\n"); } } From 97482443665126883712b6ed621cc5d52ca243a8 Mon Sep 17 00:00:00 2001 From: Guillaume BOEHM Date: Fri, 15 Aug 2025 14:53:23 +0200 Subject: [PATCH 12/12] Revert "fork msg" This reverts commit 4dc6f55b7919d48d32553f49b10f712e84b42a8f. --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index cfbc1ca..7c3019d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # MControlCenter -## Temporary (hopefully) fork with CLI support until upstream merge - MControlCenter is a Free and Open Source GNU/Linux application that allows you to change the settings of MSI laptops. ![Screen Shot of MCC](https://github.com/user-attachments/assets/1e1dcb9b-aa8e-4410-8c77-f9554c1840cb) @@ -21,13 +19,11 @@ MControlCenter is a Free and Open Source GNU/Linux application that allows you t - Change the maximum battery level limit - Advanced Fan Speed Control (Since version 0.4) - Change other settings such as keyboard backlight mode, USB Power Share, etc. - - CLI support (Cooler Boost only) ## TODO - Saving multiple fan speed profiles - Automatically change performance mode on charger connect/disconnect -- Implement other CLI commands ## Supported devices