Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

[linux] only query OnLowBattery property query if needed #4996

merged 1 commit into from Jul 10, 2014


None yet
4 participants

mkortstiege commented Jul 10, 2014

Cosmetic.. get rid of the useless error log line caused by querying non-existing hardware props.

@jmarshallnz jmarshallnz commented on the diff Jul 10, 2014

m_batteryLevel = (int)(batteryLevelSum / (double)batteryCount);
- m_lowBattery = CDBusUtil::GetVariant("org.freedesktop.UPower", "/org/freedesktop/UPower", "org.freedesktop.UPower", "OnLowBattery").asBoolean();
+ m_lowBattery = CDBusUtil::GetVariant("org.freedesktop.UPower", "/org/freedesktop/UPower", "org.freedesktop.UPower", "OnLowBattery").asBoolean();
+ }

jmarshallnz Jul 10, 2014


I'm guessing it defaults to false otherwise?


mkortstiege Jul 10, 2014


Not entirely sure. Made it default to false as we do in the UPowerSyscall to be on the safe side.


topfs2 commented Jul 10, 2014

CDBusUtil::GetVariant returns a null variant in case of failure, and a null variant as boolean is false (due to fallback being false)


mkortstiege commented Jul 10, 2014

Not in case it's not called ;) Hence defaulting to false and moving the query inside the battery condition.

@jmarshallnz jmarshallnz added a commit that referenced this pull request Jul 10, 2014

@jmarshallnz jmarshallnz Merge pull request #4996 from mkortstiege/battery
[linux] only query OnLowBattery property query if needed

@jmarshallnz jmarshallnz merged commit 348dcf5 into xbmc:master Jul 10, 2014

@MartijnKaijser MartijnKaijser added this to the Helix 14.0-alpha1 milestone Jul 16, 2014

@mkortstiege mkortstiege deleted the mkortstiege:battery branch Aug 5, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment