TeamWin / android_bootable_recovery

1.27k stars 399 forks source link

Allow custom haptics activation file path #321

Open Shivelight opened 10 months ago

Shivelight commented 10 months ago

I'm building TWRP for my Infinix Note 30 (X6833B) [tree] and I found that the vibrator/haptics is not working because, for some reason, my device haptic driver is using /sys/class/leds/vibrator_single instead of /sys/class/leds/vibrator. It would be nice if these paths are customizable.

https://github.com/TeamWin/android_bootable_recovery/blob/bc8dce77076b7d9e4ec078ee8023870f4ddc8873/minuitwrp/events.cpp#L63-L64

Device sysfs:

X6833B:/ # ls -lah /sys/class/leds/                                            
total 0
drwxr-xr-x  2 root root 0 2023-09-12 23:42 .
drwxr-xr-x 86 root root 0 2023-09-12 23:42 ..
lrwxrwxrwx  1 root root 0 2023-09-12 23:42 lcd-backlight -> ../../devices/platform/soc/soc:mtk_leds/leds/lcd-backlight
lrwxrwxrwx  1 root root 0 2023-09-12 23:42 vibrator_single -> ../../devices/platform/soc/1101a000.i2c/i2c-6/6-0058/leds/vibrator_single
X6833B:/ # ls -lah /sys/class/leds/vibrator_single/                                                                                                                                   
total 0
drwxr-xr-x 3 root root    0 2023-09-12 23:42 .
drwxr-xr-x 3 root root    0 2023-09-12 23:42 ..
-rw-r--r-- 1 root root 4.0K 2023-09-12 23:48 activate
-rw-r--r-- 1 root root 4.0K 2023-09-12 23:54 activate_mode
-rw-rw-r-- 1 root root 4.0K 2023-09-12 23:54 awrw
-rw-r--r-- 1 root root 4.0K 2023-09-12 23:54 brightness
-rw-rw-r-- 1 root root 4.0K 2023-09-12 23:54 bullet_nr
-rw-r--r-- 1 root root 4.0K 2023-09-12 23:54 cali
-rw-r--r-- 1 root root 4.0K 2023-09-12 23:54 cont
-rw-rw-r-- 1 root root 4.0K 2023-09-12 23:54 cont_brk_time
-rw-rw-r-- 1 root root 4.0K 2023-09-12 23:54 cont_drv_lvl
-rw-rw-r-- 1 root root 4.0K 2023-09-12 23:54 cont_drv_time
-rw-rw-r-- 1 root root 4.0K 2023-09-12 23:54 cont_wait_num
lrwxrwxrwx 1 root root    0 2023-09-12 23:54 device -> ../../../6-0058
-rw-rw-r-- 1 root root 4.0K 2023-09-12 23:48 duration
...

Device with similar configuration: https://github.com/TrebleDroid/treble_experimentations/issues/21

Shivelight commented 10 months ago

For those with similar issue this is how I solved it https://github.com/Shivelight/recovery_device_infinix_X6833B/commit/d4af99003b88c040c81ae886e33aafc1dd8c6dc9 Which is inspired by https://github.com/sfX-android/android_device_oneplus_hotdog/commit/404d8806010775e9da32225b4142ec10e5cc7ed8