bash 将字符串写入帧缓冲设备?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22511123/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Writing a string to a framebuffer device?
提问by Christian
This is on a Raspberry Pi, Linux 3.13, bash 4.2
这是在 Raspberry Pi、Linux 3.13、bash 4.2 上
Connected is a SPI 320x240 Display which is displaying a background image (I used fbi
to display the image, the cat /dev/fb1 > framebuffer.contents
, then whenever I need the image I do cat framebuffer.contents > /dev/fb1
to save the looong startup time of fbi
).
连接的是一个 SPI 320x240 显示器,它显示背景图像(我曾经fbi
显示图像cat /dev/fb1 > framebuffer.contents
,然后每当我需要图像时,我都会这样做cat framebuffer.contents > /dev/fb1
以节省 looong 的启动时间fbi
)。
Now I'd like to "amend" my image by a (changing) one-line text (a few word, the time, ...). Therefore I am looking for a way to write a string, from bash, to a specific location within the framebuffer. Eg. a tool is needed that a)converts a string given to some sort of framebuffer-redabe graphic (ppm
?), then b)inserts that resulting image into a given part of the framebuffer.
现在我想通过(更改)单行文本(几个字,时间,...)来“修改”我的图像。因此,我正在寻找一种将字符串从 bash 写入帧缓冲区内特定位置的方法。例如。需要一个工具,a)将给定的字符串转换为某种帧缓冲区-redabe 图形 ( ppm
?),然后b)将生成的图像插入到帧缓冲区的给定部分。
Any ideas? Or is my good old bash-and-unix-tools approach over it's head here and I need to look into .... ?
有任何想法吗?或者我的旧 bash-and-unix-tools 方法是否在这里过头了,我需要研究......?
回答by Saucier
I'm not quite sure in which situations you need to do what you do. But maybe you could "misuse" splashutils/fbsplashfor your needs? It's rather meant to display a framebuffer bootsplash but has some tools to tinker with a fb (testing tools for splashscreen development as an example). You can read about how to use it on the Gentoo wiki.
我不太确定在什么情况下你需要做你所做的。但也许您可以根据您的需要“误用” splashutils/fbsplash?它的目的是显示帧缓冲区引导画面,但有一些工具可以修改 fb(以用于启动画面开发的测试工具为例)。您可以在Gentoo wiki上阅读有关如何使用它的信息。
Aside from that maybe you can find some inspiration on a thread at Unix & Linux - How to use /dev/fb0 as a console from userspace, or output text to it.
除此之外,也许您可以在Unix 和 Linux 的一个线程上找到一些灵感- How to use /dev/fb0 as a console from userspace, or output text to it。