diff --git a/src/apps/powerstatus/ACPIDriverInterface.cpp b/src/apps/powerstatus/ACPIDriverInterface.cpp index 5fe318793e..e66567c8a9 100644 --- a/src/apps/powerstatus/ACPIDriverInterface.cpp +++ b/src/apps/powerstatus/ACPIDriverInterface.cpp @@ -17,13 +17,15 @@ #include +static const char* kDriverDir = "/dev/power"; + + RateBuffer::RateBuffer() : fPosition(0), fSize(kRateBufferSize), fCurrentSize(0) { - } @@ -55,6 +57,9 @@ RateBuffer::GetMeanRate() } +// #pragma mark - + + Battery::Battery(int driverHandler) : fDriverHandler(driverHandler) @@ -148,6 +153,10 @@ ACPIDriverInterface::~ACPIDriverInterface() for (int i = 0; i < fDriverList.CountItems(); i++) delete fDriverList.ItemAt(i); +ACPIDriverInterface::ACPIDriverInterface() + : + fInterfaceLocker("acpi interface") +{ } diff --git a/src/apps/powerstatus/ACPIDriverInterface.h b/src/apps/powerstatus/ACPIDriverInterface.h index 17285bca24..ca285998d4 100644 --- a/src/apps/powerstatus/ACPIDriverInterface.h +++ b/src/apps/powerstatus/ACPIDriverInterface.h @@ -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. * * Authors: @@ -19,15 +19,15 @@ const int8 kRateBufferSize = 10; class RateBuffer { public: - RateBuffer(); - void AddRate(int32 rate); - int32 GetMeanRate(); + RateBuffer(); + void AddRate(int32 rate); + int32 GetMeanRate(); private: - int32 fRateBuffer[kRateBufferSize]; - int8 fPosition; - int8 fSize; - int8 fCurrentSize; + int32 fRateBuffer[kRateBufferSize]; + int8 fPosition; + int8 fSize; + int8 fCurrentSize; }; @@ -47,7 +47,7 @@ public: private: void _Init(); - +private: int fDriverHandler; status_t fInitStatus; @@ -60,7 +60,8 @@ private: class ACPIDriverInterface : public PowerStatusDriverInterface { public: - virtual ~ACPIDriverInterface(); + ACPIDriverInterface(); + virtual ~ACPIDriverInterface(); virtual status_t Connect(); virtual status_t GetBatteryInfo(battery_info* info, int32 index); diff --git a/src/apps/powerstatus/DriverInterface.cpp b/src/apps/powerstatus/DriverInterface.cpp index c10cea9484..2fab52866f 100644 --- a/src/apps/powerstatus/DriverInterface.cpp +++ b/src/apps/powerstatus/DriverInterface.cpp @@ -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. * * Authors: @@ -53,7 +53,8 @@ PowerStatusDriverInterface::PowerStatusDriverInterface() : fIsWatching(0), fWaitSem(-1), - fThread(-1) + fThread(-1), + fListLocker("driver list") { }