Skip to content(if available)orjump to list(if available)

Fui: C library for interacting with the framebuffer in a TTY context

markisus

Can someone explain what “the framebuffer” is? I’m familiar with OpenGL programming where the OS can provide a framebuffer for an application but I’m confused about whether there is a global framebuffer for the entire desktop. Is this a Linux specific concept?

Bhulapi

As far as I know, a framebuffer can mean a lot of things depending on hardware and implementation, but it was used to refer to actual memory that would contain pixel values that would eventually be written to the screen. In Linux, this is abstracted by the framebuffer device, which is hardware independent (you can actually have several fbdevices, which if I'm not mistaken end up referring to different monitors usually). What's convenient about the implementation is that these devices still work as normal memory devices, which means you can read/write as you would any other memory. Some more info: https://www.kernel.org/doc/html/latest/fb/framebuffer.html

mouse_

Don't type commands from the Internet, especially as root, especially when dd is involved. That being said,

If you're ever bored, from a TTY, type

sudo dd if=/dev/urandom of=/dev/fb0

This provides a nifty demonstration of how both the framebuffer and urandom works.

you can also take a sort of "screenshot" in a tty by typing dd if=/dev/fb0 of=./shot.fb

and then you can view it by flipping those filenames around, so that the shot.fb is now the input and /dev/fb0 is now the output.

Bhulapi

Writing urandom to the framebuffer is a joy in and of itself. You actually reminded me to have users add themselves to the video and input group (which does require root privileges usually), but this way they can then run the library without sudo.

null

[deleted]