linuxfb 0.2.0

Interface to the Linux Framebuffer API
Documentation

Rust interface to the Linux Framebuffer API

Crate version

Crate license

Build

Provides a safe, rusty wrapper around the Linux Framebuffer API (linux/fb.h).

Online Documentation

Features & Scope

  • Discover & open framebuffer devices
  • Read useful information from the device, such as:
    • Size of the display, in pixels and millimeters
    • Pixel-level layout (color channels, bytes per pixel)
    • Virtual display size, to use for panning, double-buffering, etc.
  • Modify virtual size, panning offset and bytes-per-pixel (for some drivers this allows switching between 32-bit and 16-bit mode)
  • Set blanking mode (turns the screen on and off)
  • Map the device into memory (provides you with a &mut [u8] slice to write to)
  • Optional wrapper providing a double-buffered surface, that can be "flipped"

This package does NOT deal with:

  • Drawing of any kind
  • Color representation and conversion
  • Terminal mode setting. If a tty is bound to your framebuffer, you need to set it to graphics mode, to prevent a cursor and other output to be written on top of your image. The usual way to do this is with ioctl(..., KDSETMODE, KD_GRAPHICS) on the current TTY device. Doing this is out of scope for this crate, since it's not strictly part of the framebuffer API.

Getting started

First of all, make sure you have access to your framebuffer device. You can usually do that by running as root (definitely not recommended), or by adding yourself to the video group.

There are two examples provided in the documentation:

  1. Accessing, configuring and using the framebuffer in the linuxfb::Framebuffer documentation
  2. Using the optional double-buffering implementation in the linuxfb::double::Buffer documentation

Contributing

  • The upstream source can be found here
  • Pull requests are generally accepted, if they fit the scope of the package