From aeba6cb5554186478d15cbfc7a9ac580d3c52c72 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 16 Apr 2015 22:49:58 -0400 Subject: Fix the session chimes (and possible stability issue) by removing the special audio thread and using the QMediaPlayer within the main thread (no stuttering/delays in my initial tests so far). Add a PC-BSD specific routine for setting brightness so that hardware brightness controls are attempted (through pc-sysconfig) before the software brightness is modified (using xbrightness) --- libLumina/LuminaOS-FreeBSD.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'libLumina/LuminaOS-FreeBSD.cpp') diff --git a/libLumina/LuminaOS-FreeBSD.cpp b/libLumina/LuminaOS-FreeBSD.cpp index fc4135f0..73637048 100644 --- a/libLumina/LuminaOS-FreeBSD.cpp +++ b/libLumina/LuminaOS-FreeBSD.cpp @@ -72,12 +72,21 @@ void LOS::setScreenBrightness(int percent){ if(percent<0){percent=0;} else if(percent>100){ percent=100; } float pf = percent/100.0; //convert to a decimel - //Run the command - QString cmd = "xbrightness %1"; - cmd = cmd.arg( QString::number( int(65535*pf) ) ); - int ret = LUtils::runCmd(cmd); + //Run the command(s) + bool success = false; + // - try hardware setting first (PC-BSD only) + if(QFile::exists("/usr/local/bin/pc-sysconfig")){ + QString ret = LUtils::getCmdOutput("pc-sysconfig \"setscreenbrightness "+QString::number(percent)+"\"").join(""); + success = (ret.simplified() == "[SUCCESS]"); + } + // - if hardware brightness does not work, use software brightness + if(!success){ + QString cmd = "xbrightness %1"; + cmd = cmd.arg( QString::number( int(65535*pf) ) ); + success = (0 == LUtils::runCmd(cmd) ); + } //Save the result for later - if(ret!=0){ screenbrightness = -1; } + if(!success){ screenbrightness = -1; } else{ screenbrightness = percent; } LUtils::writeFile(QDir::homePath()+"/.lumina/.currentxbrightness", QStringList() << QString::number(screenbrightness), true); } -- cgit