otter: vibrator: Adapt for drv26xx_haptic
Change-Id: I0ae3f65daca39c54ec97338b011d4acafb9c8a12
diff --git a/vibrator/Vibrator.cpp b/vibrator/Vibrator.cpp
index 04bc256..06d26e0 100644
--- a/vibrator/Vibrator.cpp
+++ b/vibrator/Vibrator.cpp
@@ -80,7 +80,7 @@
#define test_bit(bit, array) ((array)[(bit)/8] & (1<<((bit)%8)))
-static const char LED_DEVICE[] = "/sys/class/leds/vibrator";
+static const char LED_DEVICE[] = "/sys/class/leds/drv26xx_haptic";
static const char HAPTICS_SYSFS[] = "/sys/class/qcom-haptics";
static constexpr int32_t ComposeDelayMaxMs = 1000;
@@ -387,7 +387,7 @@
mDetected = false;
- snprintf(devicename, sizeof(devicename), "%s/%s", LED_DEVICE, "activate");
+ snprintf(devicename, sizeof(devicename), "%s/%s", LED_DEVICE, "state");
fd = TEMP_FAILURE_RETRY(open(devicename, O_RDWR));
if (fd < 0) {
ALOGE("open %s failed, errno = %d", devicename, errno);
@@ -432,21 +432,11 @@
int ret;
snprintf(file, sizeof(file), "%s/%s", LED_DEVICE, "state");
- ret = write_value(file, "1");
- if (ret < 0)
- goto error;
-
- snprintf(file, sizeof(file), "%s/%s", LED_DEVICE, "duration");
snprintf(value, sizeof(value), "%u\n", timeoutMs);
ret = write_value(file, value);
if (ret < 0)
goto error;
- snprintf(file, sizeof(file), "%s/%s", LED_DEVICE, "activate");
- ret = write_value(file, "1");
- if (ret < 0)
- goto error;
-
return 0;
error:
@@ -459,7 +449,7 @@
char file[PATH_MAX];
int ret;
- snprintf(file, sizeof(file), "%s/%s", LED_DEVICE, "activate");
+ snprintf(file, sizeof(file), "%s/%s", LED_DEVICE, "state");
ret = write_value(file, "0");
return ret;
}