简体   繁体   English

通过终端命令在Android上打开振动

[英]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.长期以来,我一直在修改 Android 内核,但现在我在启动 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.为此,由于索尼 Xperia 设备有恢复功能,因此会有振动、LED 或闪光灯等提示进入恢复状态。 I have now migrated to LG mobile.我现在已经迁移到 LG 手机了。 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.我在 Android Oreo 上使用 LG V30,内核版本为 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. /sys/class/timed_output/vibrator/enable至少存在于 Qualcomm 设备上,这些设备的振动器是 PMIC 的一部分,通过 SPMI 总线连接到 SoC。 Timed-output was a class driver (vibrator appeared as a virtual device) in staging tree available up to Android kernel 3.18.定时输出是 Android 内核 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/ .在以后的设备上,AOSP 将振动器视为 LED 模块,而振动器 HAL 使用/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参考文献: 1 , 2 , 3 , 4 , 5

In order to make LEDs blink do:为了使 LED 闪烁,请执行以下操作:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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