vibrator: cs40l26: Implement braking duration for haptic effects

1. Add sysfs nodes for querying braking duration
   - braking_time_bank
   - braking_time_index
   - braking_time_ms
2. Set delay time between effects to include the whole braking duration
3. Add braking effect durations in HAL dumpsys logs

Bug: 325121485
Test: Plotted acceleration
Test: Checked HAL dumpsys
Test: atest VibratorHalCs40l26TestSuite
Flag: EXEMPT bugfix
Change-Id: Ifacc94db4224adbab971e8d2c01c54422838760c
Signed-off-by: leonardian <leonardian@google.com>
This commit is contained in:
leonardian 2024-05-20 03:58:21 +00:00
parent 7eeceadfac
commit 0dcee74707
7 changed files with 67 additions and 16 deletions

View file

@ -110,10 +110,12 @@ inline bool getProperty<bool>(const std::string &key, const bool def) {
template <typename T>
static void openNoCreate(const std::string &file, T *outStream) {
auto mode = std::is_base_of_v<std::ostream, T> ? std::ios_base::out : std::ios_base::in;
if (!std::filesystem::exists(file)) {
ALOGE("File does not exist: %s", file.c_str());
return;
}
// Force 'in' mode to prevent file creation
outStream->open(file, mode | std::ios_base::in);
outStream->open(file);
if (!*outStream) {
ALOGE("Failed to open %s (%d): %s", file.c_str(), errno, strerror(errno));
}