aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2014-12-29 11:15:01 -0500
committerKen Moore <ken@pcbsd.org>2014-12-29 11:15:01 -0500
commitb42ae4785fc165762baaf8bdc70e9d7f1cd4a9df (patch)
tree08484d50b69f3efc57ab3cc4d8b2155221fad45c
parentQuick fix for the FreeBSD port makefile: corelib -> core for Qt5 (diff)
downloadlumina-b42ae4785fc165762baaf8bdc70e9d7f1cd4a9df.tar.gz
lumina-b42ae4785fc165762baaf8bdc70e9d7f1cd4a9df.tar.bz2
lumina-b42ae4785fc165762baaf8bdc70e9d7f1cd4a9df.zip
Add a quick check to the FreeBSD screen brightness functions for not allowing screen brightness controls within a virtualbox VM (does not work since not host system).
-rw-r--r--libLumina/LuminaOS-FreeBSD.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/libLumina/LuminaOS-FreeBSD.cpp b/libLumina/LuminaOS-FreeBSD.cpp
index 97f465e2..87be7937 100644
--- a/libLumina/LuminaOS-FreeBSD.cpp
+++ b/libLumina/LuminaOS-FreeBSD.cpp
@@ -51,8 +51,12 @@ QStringList LOS::ExternalDevicePaths(){
//Read screen brightness information
int LOS::ScreenBrightness(){
//Returns: Screen Brightness as a percentage (0-100, with -1 for errors)
- if(screenbrightness==-1){
- if(QFile::exists(QDir::homePath()+"/.lumina/.currentxbrightness")){
+ //Make sure we are not running in VirtualBox (does not work in a VM)
+ QStringList info = LUtils::getCmdOutput("pciconf -lv");
+ if( !info.filter("VirtualBox", Qt::CaseInsensitive).isEmpty() ){ return -1; }
+ //Now perform the standard brightness checks
+ if(screenbrightness==-1){ //memory value
+ if(QFile::exists(QDir::homePath()+"/.lumina/.currentxbrightness")){ //saved file value
int val = LUtils::readFile(QDir::homePath()+"/.lumina/.currentxbrightness").join("").simplified().toInt();
screenbrightness = val;
}
bgstack15