diff options
author | Ken Moore <moorekou@gmail.com> | 2015-11-26 08:34:22 -0500 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2015-11-26 08:34:22 -0500 |
commit | 82b49f3eb8667290b4c5ed6d3b9036fbe96a4de2 (patch) | |
tree | edc60505b8d82c0d70e8defd21ffe716af70588f /libLumina | |
parent | Merge pull request #167 from mike-pt/master (diff) | |
download | lumina-82b49f3eb8667290b4c5ed6d3b9036fbe96a4de2.tar.gz lumina-82b49f3eb8667290b4c5ed6d3b9036fbe96a4de2.tar.bz2 lumina-82b49f3eb8667290b4c5ed6d3b9036fbe96a4de2.zip |
Clean up the new intel_backlight support in LuminaOS-FreeBSD. Now it should work reliably.
Diffstat (limited to 'libLumina')
-rw-r--r-- | libLumina/LuminaOS-FreeBSD.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/libLumina/LuminaOS-FreeBSD.cpp b/libLumina/LuminaOS-FreeBSD.cpp index 2d19970f..99d20781 100644 --- a/libLumina/LuminaOS-FreeBSD.cpp +++ b/libLumina/LuminaOS-FreeBSD.cpp @@ -83,20 +83,19 @@ void LOS::setScreenBrightness(int percent){ //Run the command(s) bool success = false; // - try hardware setting first (PC-BSD || or intel_backlight) - if(QFile::exists("/usr/local/bin/intel_backlight")){ - qDebug() << "/usr/local/bin/intel_backlight" << "was found!"; - QString ret = LUtils::getCmdOutput("intel_backlight", QStringList() <<QString::number(percent) -).join(""); - success = ret.toLower().contains("set backlight to"); - qDebug() << "Set hardware brightness:" << percent << success; - // Check if percentage = intel_backlight - qDebug() << "intel_backlight:" << LUtils::getCmdOutput("intel_backlight"); - } - else if((QFile::exists("/usr/local/bin/pc-sysconfig")) && (!QFile::exists("/usr/local/bin/intel_backlight"))){ + if( LUtils::isValidBinary("pc-sysconfig") ){ + //Use PC-BSD tool (direct sysctl control) QString ret = LUtils::getCmdOutput("pc-sysconfig", QStringList() <<"setscreenbrightness "+QString::number(percent)).join(""); success = ret.toLower().contains("success"); qDebug() << "Set hardware brightness:" << percent << success; } + if( !success && LUtils::isValidBinary("intel_backlight")){ + //Use the intel_backlight utility (only for Intel mobo/hardware?) + if(0== LUtils::runCmd("intel_backlight", QStringList() <<QString::number(percent)) ){ + //This utility does not report success/failure - run it again to get the current value and ensure it was set properly + success = (percent == LUtils::getCmdOutput("intel_backlight").join("").section("%",0,0).section(":",1,1).simplified().toInt() ); + } + } // - if hardware brightness does not work, use software brightness if(!success){ QString cmd = "xbrightness %1"; |