Skip to content

crashes on 16bpp systems #17

@gtoal

Description

@gtoal

Almost all the examples crash with a segfault if you run the code on a display with 16 bits per pixel rather than the expected 32. Adding the code below at the foot of the init call will at least give the programmer a heads up although obviously the preferred solution would be to support writing to those displays.

Also the example test programs have lots of hard-wired dimensions and coordinates and don't fit their drawings to the display limits.
The test programs also explicitly initialise for "/dev/fb0" rather than specifying NULL to get the default framebuffer.

        if ((8 * fb->screen_size)/(fb_get_width(fb)*fb_get_height(fb)) != 32) {
                fprintf(stderr, "This is not a 32-bit per pixel frame buffer.\n"); // and the code has not yet been modified to handle 16 bit pixels
                close(fb->fd);
                exit(1);
                return -1;
        }

(I called exit() above because the examples don't check the return code and crash if the init call returns -1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions