[英]Raspberry Pi: Enable or disable touch screen from Python script
我正在使用 Raspberry Pi 4 B、8 GB RAM 和 Raspbian OS。 我将 7" 触摸屏连接到 PI。在我的项目中,如果 Python 脚本 5 分钟内没有检测到任何活动,我想让触摸屏进入睡眠状态(只是为了节省一些电量)。有没有我可以使用的 shell 命令在 Python 脚本中使用?
config.txt 中有“disable_touchscreen=1”选项,这将停止 Pi 轮询控制器板以获取触摸输入。 它也不会启动触摸屏输入驱动程序的固件端,这也应该停止 Linux 端加载。 显示端将完全像以前一样工作。
这个文件通常可以从 raspbian 操作系统作为 /boot/config.txt 访问。
您可以阅读 config.txt 并使用以下 python 代码进行修改
import ConfigParser
config_parser = ConfigParser.ConfigParser()
config_parser.read('config.txt')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.