PowerStatus: give the locker a name.
* Plus minor cleanup.
This commit is contained in:
@@ -17,13 +17,15 @@
|
|||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
|
|
||||||
|
|
||||||
|
static const char* kDriverDir = "/dev/power";
|
||||||
|
|
||||||
|
|
||||||
RateBuffer::RateBuffer()
|
RateBuffer::RateBuffer()
|
||||||
:
|
:
|
||||||
fPosition(0),
|
fPosition(0),
|
||||||
fSize(kRateBufferSize),
|
fSize(kRateBufferSize),
|
||||||
fCurrentSize(0)
|
fCurrentSize(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -55,6 +57,9 @@ RateBuffer::GetMeanRate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
Battery::Battery(int driverHandler)
|
Battery::Battery(int driverHandler)
|
||||||
:
|
:
|
||||||
fDriverHandler(driverHandler)
|
fDriverHandler(driverHandler)
|
||||||
@@ -148,6 +153,10 @@ ACPIDriverInterface::~ACPIDriverInterface()
|
|||||||
for (int i = 0; i < fDriverList.CountItems(); i++)
|
for (int i = 0; i < fDriverList.CountItems(); i++)
|
||||||
delete fDriverList.ItemAt(i);
|
delete fDriverList.ItemAt(i);
|
||||||
|
|
||||||
|
ACPIDriverInterface::ACPIDriverInterface()
|
||||||
|
:
|
||||||
|
fInterfaceLocker("acpi interface")
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009, Haiku, Inc. All Rights Reserved.
|
* Copyright 2009-2015, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -19,15 +19,15 @@ const int8 kRateBufferSize = 10;
|
|||||||
|
|
||||||
class RateBuffer {
|
class RateBuffer {
|
||||||
public:
|
public:
|
||||||
RateBuffer();
|
RateBuffer();
|
||||||
void AddRate(int32 rate);
|
void AddRate(int32 rate);
|
||||||
int32 GetMeanRate();
|
int32 GetMeanRate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int32 fRateBuffer[kRateBufferSize];
|
int32 fRateBuffer[kRateBufferSize];
|
||||||
int8 fPosition;
|
int8 fPosition;
|
||||||
int8 fSize;
|
int8 fSize;
|
||||||
int8 fCurrentSize;
|
int8 fCurrentSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
void _Init();
|
void _Init();
|
||||||
|
|
||||||
|
private:
|
||||||
int fDriverHandler;
|
int fDriverHandler;
|
||||||
status_t fInitStatus;
|
status_t fInitStatus;
|
||||||
|
|
||||||
@@ -60,7 +60,8 @@ private:
|
|||||||
|
|
||||||
class ACPIDriverInterface : public PowerStatusDriverInterface {
|
class ACPIDriverInterface : public PowerStatusDriverInterface {
|
||||||
public:
|
public:
|
||||||
virtual ~ACPIDriverInterface();
|
ACPIDriverInterface();
|
||||||
|
virtual ~ACPIDriverInterface();
|
||||||
|
|
||||||
virtual status_t Connect();
|
virtual status_t Connect();
|
||||||
virtual status_t GetBatteryInfo(battery_info* info, int32 index);
|
virtual status_t GetBatteryInfo(battery_info* info, int32 index);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009, Haiku, Inc. All Rights Reserved.
|
* Copyright 2009-2015, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -53,7 +53,8 @@ PowerStatusDriverInterface::PowerStatusDriverInterface()
|
|||||||
:
|
:
|
||||||
fIsWatching(0),
|
fIsWatching(0),
|
||||||
fWaitSem(-1),
|
fWaitSem(-1),
|
||||||
fThread(-1)
|
fThread(-1),
|
||||||
|
fListLocker("driver list")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user