mirror of
https://github.com/Evolution-X-Devices/device_google_wahoo
synced 2026-02-01 07:50:47 +00:00
Merge "haptics: enable low-power trigger mode for edge sense" into oc-dr1-dev
am: ca62fc7d12
Change-Id: I448d8d4cd9bd0d54d1154f6e86e5ca3dcee24381
This commit is contained in:
@@ -410,6 +410,7 @@ on early-boot
|
||||
chown system system /sys/class/leds/vibrator/device/ctrl_loop
|
||||
chown system system /sys/class/leds/vibrator/device/ol_lra_period
|
||||
chown system system /sys/class/leds/vibrator/device/autocal
|
||||
chown system system /sys/class/leds/vibrator/device/lp_trigger_effect
|
||||
|
||||
# Permission for LED driver
|
||||
chown system system /sys/class/leds/red/on_off_ms
|
||||
|
||||
@@ -63,7 +63,7 @@ using EffectStrength = ::android::hardware::vibrator::V1_0::EffectStrength;
|
||||
Vibrator::Vibrator(std::ofstream&& activate, std::ofstream&& duration,
|
||||
std::ofstream&& state, std::ofstream&& rtpinput,
|
||||
std::ofstream&& mode, std::ofstream&& sequencer,
|
||||
std::ofstream&& scale, std::ofstream&& ctrlloop) :
|
||||
std::ofstream&& scale, std::ofstream&& ctrlloop, std::ofstream&& lptrigger) :
|
||||
mActivate(std::move(activate)),
|
||||
mDuration(std::move(duration)),
|
||||
mState(std::move(state)),
|
||||
@@ -71,10 +71,18 @@ Vibrator::Vibrator(std::ofstream&& activate, std::ofstream&& duration,
|
||||
mMode(std::move(mode)),
|
||||
mSequencer(std::move(sequencer)),
|
||||
mScale(std::move(scale)),
|
||||
mCtrlLoop(std::move(ctrlloop)) {
|
||||
mCtrlLoop(std::move(ctrlloop)),
|
||||
mLpTriggerEffect(std::move(lptrigger)) {
|
||||
|
||||
mClickDuration = property_get_int32("ro.vibrator.hal.click.duration", WAVEFORM_CLICK_EFFECT_MS);
|
||||
mTickDuration = property_get_int32("ro.vibrator.hal.tick.duration", WAVEFORM_TICK_EFFECT_MS);
|
||||
|
||||
// This enables effect #1 from the waveform library to be triggered by SLPI
|
||||
// while the AP is in suspend mode
|
||||
mLpTriggerEffect << 1 << std::endl;
|
||||
if (!mLpTriggerEffect) {
|
||||
ALOGW("Failed to set LP trigger mode (%d): %s", errno, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
Return<Status> Vibrator::on(uint32_t timeoutMs, bool forceOpenLoop, bool isWaveform) {
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
Vibrator(std::ofstream&& activate, std::ofstream&& duration,
|
||||
std::ofstream&& state, std::ofstream&& rtpinput,
|
||||
std::ofstream&& mode, std::ofstream&& sequencer,
|
||||
std::ofstream&& scale, std::ofstream&& ctrlloop);
|
||||
std::ofstream&& scale, std::ofstream&& ctrlloop, std::ofstream&& lptrigger);
|
||||
|
||||
// Methods from ::android::hardware::vibrator::V1_0::IVibrator follow.
|
||||
using Status = ::android::hardware::vibrator::V1_0::Status;
|
||||
@@ -56,6 +56,7 @@ private:
|
||||
std::ofstream mSequencer;
|
||||
std::ofstream mScale;
|
||||
std::ofstream mCtrlLoop;
|
||||
std::ofstream mLpTriggerEffect;
|
||||
int32_t mClickDuration;
|
||||
int32_t mTickDuration;
|
||||
};
|
||||
|
||||
@@ -39,6 +39,7 @@ static constexpr char MODE_PATH[] = "/sys/class/leds/vibrator/device/mode";
|
||||
static constexpr char SEQUENCER_PATH[] = "/sys/class/leds/vibrator/device/set_sequencer";
|
||||
static constexpr char SCALE_PATH[] = "/sys/class/leds/vibrator/device/scale";
|
||||
static constexpr char CTRL_LOOP_PATH[] = "/sys/class/leds/vibrator/device/ctrl_loop";
|
||||
static constexpr char LP_TRIGGER_PATH[] = "/sys/class/leds/vibrator/device/lp_trigger_effect";
|
||||
|
||||
// File path to the calibration file
|
||||
static constexpr char CALIBRATION_FILEPATH[] = "/persist/haptics/drv2624.cal";
|
||||
@@ -178,13 +179,19 @@ status_t registerVibratorService() {
|
||||
ALOGW("Failed to open %s (%d): %s", CTRL_LOOP_PATH, error, strerror(error));
|
||||
}
|
||||
|
||||
std::ofstream lptrigger{LP_TRIGGER_PATH};
|
||||
if (!lptrigger) {
|
||||
int error = errno;
|
||||
ALOGW("Failed to open %s (%d): %s", LP_TRIGGER_PATH, error, strerror(error));
|
||||
}
|
||||
|
||||
if (!loadCalibrationData()) {
|
||||
ALOGW("Failed load calibration data");
|
||||
}
|
||||
|
||||
sp<IVibrator> vibrator = new Vibrator(std::move(activate), std::move(duration),
|
||||
std::move(state), std::move(rtpinput), std::move(mode),
|
||||
std::move(sequencer), std::move(scale), std::move(ctrlloop));
|
||||
std::move(sequencer), std::move(scale), std::move(ctrlloop), std::move(lptrigger));
|
||||
|
||||
vibrator->registerAsService();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user