How to access to framebuffer to use linuxfb

Hello, I have a problem accessing the framebuffer. My QT application needs the linuxfb platform to run correctly, but for that I need to be able to access the host’s framebuffer.
When I run my application I get the following errors

Then in balena HOST terminal I do an ls from /dev/fb* and I got the error

I get the exact same error if I run the ls command in my app container.
My application deployment looks like this

  qt-secure-entry:
    image: x.x.x.x
    privileged: true
    devices:
      - "/dev/fb0:/dev/fb0"
    environment:
      - DISPLAY=host.docker.internal:0
      - DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket

Thank You

Hi Firat, could you please provide us with details about the device type you are using and the balenaOS version? Do you see the framebuffer device in the hostOS?

Hi @alexgg ,
I work on a raspberry pi4 with balenaOS host version 2.115.1+rev3. How can I do to see the framebuffer device in the hostOS?
To provide you with a bit more information, my project involves reading input from a keyboard plugged into my raspberry pi. I go through the linuxfb platform because my application has no graphical interface and therefore no x11

Hello @firat, if you don’t need the FB for another purpose besides reading the keyboard input, have you looked into reading the raw keyboard events with something like evtest? https://raspberry-projects.com/pi/programming-in-c/keyboard-programming-in-c/reading-raw-keyboard-input
(or evdev in Python: Introduction — Python-evdev )
I used evdev to directly read a bar code scanner (keyboard wedge) on a Pi 4 with good results.

Hello @alanb128 ,
thank you for your answer, it is indeed simpler, here is an example of a solution in c++ for people who will have the same problem.

#include <iostream>
#include <fstream>
#include <cstring>
#include <linux/input.h>

int main() {
    std::ifstream input("/dev/input/eventX", std::ios::binary); // Replace X with the event number of the keyboard

    if (!input) {
        std::cerr << "Failed to open the input file." << std::endl;
        return 1;
    }

    struct input_event ev;

    while (input.read(reinterpret_cast<char*>(&ev), sizeof(struct input_event))) {
        if (ev.type == EV_KEY && ev.value == 1) {
            std::cout << "Key code: " << ev.code << std::endl;
            std::cout << "Value: " << ev.value << std::endl;
            std::cout << "Timestamp: " << ev.time.tv_sec << "." << ev.time.tv_usec << std::endl;
            std::cout << std::endl;
        }
    }

    input.close();

    return 0;
}