diff --git a/light/Light.cpp b/light/Light.cpp index d914e55..366dc68 100644 --- a/light/Light.cpp +++ b/light/Light.cpp @@ -48,32 +48,12 @@ static T get(const std::string& path, const T& def) { return file.fail() ? def : result; } -static int rgbToBrightness(const LightState& state) { - int color = state.color & 0x00ffffff; - return ((77 * ((color >> 16) & 0x00ff)) - + (150 * ((color >> 8) & 0x00ff)) - + (29 * (color & 0x00ff))) >> 8; -} - Light::Light() { mLights.emplace(Type::ATTENTION, std::bind(&Light::handleRgb, this, std::placeholders::_1, 0)); - mLights.emplace(Type::BACKLIGHT, std::bind(&Light::handleBacklight, this, std::placeholders::_1)); mLights.emplace(Type::BATTERY, std::bind(&Light::handleRgb, this, std::placeholders::_1, 2)); mLights.emplace(Type::NOTIFICATIONS, std::bind(&Light::handleRgb, this, std::placeholders::_1, 1)); } -void Light::handleBacklight(const LightState& state) { - int maxBrightness = get("/sys/class/backlight/panel0-backlight/max_brightness", -1); - if (maxBrightness < 0) { - maxBrightness = 255; - } - int sentBrightness = rgbToBrightness(state); - int brightness = sentBrightness * maxBrightness / 255; - LOG(DEBUG) << "Writing backlight brightness " << brightness - << " (orig " << sentBrightness << ")"; - set("/sys/class/backlight/panel0-backlight/brightness", brightness); -} - void Light::handleRgb(const LightState& state, size_t index) { mLightStates.at(index) = state; diff --git a/light/Light.h b/light/Light.h index 27a701a..bf8e59e 100644 --- a/light/Light.h +++ b/light/Light.h @@ -44,7 +44,6 @@ class Light : public ILight { Return getSupportedTypes(getSupportedTypes_cb _hidl_cb) override; private: - void handleBacklight(const LightState& state); void handleRgb(const LightState& state, size_t index); std::mutex mLock;