在 Linux 中查询帧缓冲分辨率
问题:
你想查询连接为帧缓冲设备(例如 /dev/fb0)的屏幕的当前分辨率。
解决方案
/sys 虚拟文件系统在 /sys/class/graphics/<devicename> 中包含有关帧缓冲设备的所有信息。
要获取大小,使用
query_fb.sh
cat /sys/class/graphics/fb0/virtual_size将 fb0 替换为要查询的帧缓冲设备名称。这将打印一行如
fb_size.txt
1280,1024要以数字形式获取宽度/高度,你可以使用这些命令:
get_fb_dimensions.sh
cat /sys/class/graphics/fb0/virtual_size | cut -d, -f1 # 获取宽度
cat /sys/class/graphics/fb0/virtual_size | cut -d, -f2 # 获取高度Check out similar posts by category:
Linux
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow