Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f93515fd authored by TARKZiM's avatar TARKZiM
Browse files

kitakami-common: light: Remove unsupported RGB Blink feature

parent e708587b
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -65,8 +65,7 @@ Light::Light(std::pair<std::ofstream, uint32_t>&& lcd_backlight,
             std::ofstream&& red_pause_lo, std::ofstream&& green_pause_lo, std::ofstream&& blue_pause_lo,
             std::ofstream&& red_pause_hi, std::ofstream&& green_pause_hi, std::ofstream&& blue_pause_hi,
             std::ofstream&& red_ramp_step_ms, std::ofstream&& green_ramp_step_ms, std::ofstream&& blue_ramp_step_ms,
             std::ofstream&& red_blink, std::ofstream&& green_blink, std::ofstream&& blue_blink,
             std::ofstream&& rgb_blink)
             std::ofstream&& red_blink, std::ofstream&& green_blink, std::ofstream&& blue_blink)
    : mLcdBacklight(std::move(lcd_backlight)),
      mRedLed(std::move(red_led)),
      mGreenLed(std::move(green_led)),
@@ -88,8 +87,7 @@ Light::Light(std::pair<std::ofstream, uint32_t>&& lcd_backlight,
      mBlueRampStepMs(std::move(blue_ramp_step_ms)),
      mRedBlink(std::move(red_blink)),
      mGreenBlink(std::move(green_blink)),
      mBlueBlink(std::move(blue_blink)),
      mRgbBlink(std::move(rgb_blink)) {
      mBlueBlink(std::move(blue_blink)) {
    auto attnFn(std::bind(&Light::setAttentionLight, this, std::placeholders::_1));
    auto backlightFn(std::bind(&Light::setLcdBacklight, this, std::placeholders::_1));
    auto batteryFn(std::bind(&Light::setBatteryLight, this, std::placeholders::_1));
@@ -210,9 +208,6 @@ void Light::setSpeakerLightLocked(const LightState& state) {
    }
    blink = onMs > 0 && offMs > 0;

    // Disable all blinking to start
    mRgbBlink << 0 << std::endl;

    if (blink) {
        stepDuration = RAMP_STEP_DURATION;
        pauseHi = onMs - (stepDuration * RAMP_SIZE * 2);
@@ -242,9 +237,6 @@ void Light::setSpeakerLightLocked(const LightState& state) {
        mBluePauseLo << offMs << std::endl;
        mBluePauseHi << pauseHi << std::endl;
        mBlueRampStepMs << stepDuration << std::endl;

        // Start the party
        mRgbBlink << 1 << std::endl;
    } else {
        if (red == 0 && green == 0 && blue == 0) {
            mRedBlink << 0 << std::endl;
+1 −3
Original line number Diff line number Diff line
@@ -38,8 +38,7 @@ struct Light : public ILight {
          std::ofstream&& red_pause_lo, std::ofstream&& green_pause_lo, std::ofstream&& blue_pause_lo,
          std::ofstream&& red_pause_hi, std::ofstream&& green_pause_hi, std::ofstream&& blue_pause_hi,
          std::ofstream&& red_ramp_step_ms, std::ofstream&& green_ramp_step_ms, std::ofstream&& blue_ramp_step_ms,
          std::ofstream&& red_blink, std::ofstream&& green_blink, std::ofstream&& blue_blink,
          std::ofstream&& rgb_blink);
          std::ofstream&& red_blink, std::ofstream&& green_blink, std::ofstream&& blue_blink);

    // Methods from ::android::hardware::light::V2_0::ILight follow.
    Return<Status> setLight(Type type, const LightState& state) override;
@@ -75,7 +74,6 @@ struct Light : public ILight {
    std::ofstream mRedBlink;
    std::ofstream mGreenBlink;
    std::ofstream mBlueBlink;
    std::ofstream mRgbBlink;

    LightState mAttentionState;
    LightState mBatteryState;
+0 −3
Original line number Diff line number Diff line
@@ -12,8 +12,6 @@ on init
    chown system system /sys/class/leds/green/blink
    chown system system /sys/class/leds/blue/blink

    chown system system /sys/class/leds/rgb/rgb_blink

    chown system system /sys/class/leds/red/ramp_step_ms
    chown system system /sys/class/leds/green/ramp_step_ms
    chown system system /sys/class/leds/blue/ramp_step_ms
@@ -33,7 +31,6 @@ on init
    chmod 660 /sys/class/leds/red/start_idx
    chmod 660 /sys/class/leds/green/start_idx
    chmod 660 /sys/class/leds/blue/start_idx
    chmod 660 /sys/class/leds/rgb/rgb_blink

service vendor.light-hal-2-0 /vendor/bin/hw/android.hardware.light@2.0-service.kitakami
    class hal
+1 −10
Original line number Diff line number Diff line
@@ -53,7 +53,6 @@ const static std::string kBlueRampStepMsPath = "/sys/class/leds/blue/ramp_step_m
const static std::string kRedBlinkPath = "/sys/class/leds/red/blink";
const static std::string kGreenBlinkPath = "/sys/class/leds/green/blink";
const static std::string kBlueBlinkPath = "/sys/class/leds/blue/blink";
const static std::string kRgbBlinkPath = "/sys/class/leds/rgb/rgb_blink";

int main() {
    uint32_t lcdMaxBrightness = 255;
@@ -221,13 +220,6 @@ int main() {
        return -errno;
    }

    std::ofstream rgbBlink(kRgbBlinkPath);
    if (!rgbBlink) {
        LOG(ERROR) << "Failed to open " << kRgbBlinkPath << ", error=" << errno
                   << " (" << strerror(errno) << ")";
        return -errno;
    }

    android::sp<ILight> service = new Light(
            {std::move(lcdBacklight), lcdMaxBrightness},
            std::move(redLed), std::move(greenLed), std::move(blueLed),
@@ -236,8 +228,7 @@ int main() {
            std::move(redPauseLo), std::move(greenPauseLo), std::move(bluePauseLo),
            std::move(redPauseHi), std::move(greenPauseHi), std::move(bluePauseHi),
            std::move(redRampStepMs), std::move(greenRampStepMs), std::move(blueRampStepMs),
            std::move(redBlink), std::move(greenBlink), std::move(blueBlink),
            std::move(rgbBlink));
            std::move(redBlink), std::move(greenBlink), std::move(blueBlink));

    configureRpcThreadpool(1, true);