简体   繁体   中英

Turn on vibration on Android by terminal command

Since long I am modifying Android kernels, but now I am stuck to find prompt while starting the Android. I am adding recovery inside the kernel image. For this there will be a prompt like vibration, LED or flash light for entering the recovery as there is recovery for Sony Xperia devices. I have now migrated to LG mobile. But here I can not find vibration trigger as I used before.

echo 200 > /sys/class/timed_output/vibrator/enable
echo 1 > /sys/class/leds/red
echo 1 > /sys/class/leds/green
echo 1 > /sys/class/leds/blue

None of above mentioned trigger is available. Can anybody help me out that how can I run vibrator or flashlight for prompt by terminal command. I am using LG V30 with Android Oreo and kernel version is 4.4.

/sys/class/timed_output/vibrator/enable exists at least on Qualcomm devices which have vibrator a part of PMIC, connected to SoC via SPMI bus. Timed-output was a class driver (vibrator appeared as a virtual device) in staging tree available up to Android kernel 3.18. On later devices AOSP treats vibrator as an LED module and vibrator HAL uses hardware/vendor specific kernel interfaces in /sys/class/leds/vibrator/ . On such a device you can do:

~# echo -n 200 >/sys/class/leds/vibrator/duration
~# echo -n 1 >/sys/class/leds/vibrator/activate

References: 1 , 2 , 3 , 4 , 5

In order to make LEDs blink do:

~# echo -n 1 >/sys/class/leds/red/blink
~# echo -n 1 >/sys/class/leds/green/blink
~# echo -n 1 >/sys/class/leds/blue/blink

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM