check battery status file
This commit is contained in:
1 parent
bb9426038f
commit
df57c19b99
1 file changed
+8
-4
@@ -27,10 +27,14 @@ function BasePowerD:suspendHW() end
|
||||
function BasePowerD:wakeUpHW() end
|
||||
|
||||
function BasePowerD:read_int_file(file)
|
||||
local f = io.open(file, "r")
|
||||
local sysint = tonumber(f:read("*all"):match("%d+"))
|
||||
f:close()
|
||||
return sysint
|
||||
local fd = io.open(file, "r")
|
||||
if fd then
|
||||
local int = fd:read("*all"):match("%d+")
|
||||
fd:close()
|
||||
return int and tonumber(int) or 0
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
function BasePowerD:setIntensity(intensity)
|
||||
|
||||
Reference in new issue
Block a user