How to run libsvga program at ubuntu?

2019-08-01 08:57发布

I am trying to use the following program given in the libsvga tutorial.

    #include <stdlib.h>
    #include <vga.h>

    int main(void)
    {
       vga_init();
       vga_setmode(vga_getdefaultmode());
       vga_setcolor(4);
       vga_drawpixel(10, 10);

       sleep(5);
       vga_setmode(TEXT);

       return EXIT_SUCCESS;
    }

I am using following command to compile it

   gcc -O3 -o sample sample.c -lvga

The output is the following

    Using EGA driver
    svgalib 1.4.3

and after that nothing happens. I am using ubuntu. I am wondering if someone can help me in figuring out the problem.

1条回答
成全新的幸福
2楼-- · 2019-08-01 09:54

I just tried this and it didn't work either. I looked around in /proc/fb (for the "framebuffer" device) and it mentioned VESA.

So, I edited the file /etc/vga/libvga.config and removed the # at the start of the line for VESA chipsets, so it now looks like this:

chipset VESA # nicely behaved VESA bioses

and libsvga seems to work fine.

查看更多
登录 后发表回答