7 releases

0.3.1 Sep 21, 2023
0.3.0 Sep 21, 2023
0.2.1 Sep 19, 2023
0.2.0 May 11, 2020
0.1.2 May 10, 2020

#252 in Operating systems

Download history 4/week @ 2024-02-19 35/week @ 2024-02-26 23/week @ 2024-03-04 10/week @ 2024-03-11 28/week @ 2024-03-25

62 downloads per month

MIT license

34KB
483 lines

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 (you get a buffer, it's up to you to fill it)
  • Color representation and conversion

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

Dependencies

~0–2MB
~38K SLoC