Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 18 Nov 2018, 21:23
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
LittlevGL, uGFX, create GUI apps for Linux framebuffer
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [13 Posts]  
Author Message
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 8710
Location: Perth, Western Australia

PostPosted: Sun 19 Aug 2018, 20:40    Post subject:  LittlevGL, uGFX, create GUI apps for Linux framebuffer  

Perhaps this topic is not "off topic", as my intention is to be able to create a GUI app, statically compiled, that will run in the initramfs. An example would be a keyboard-layout selector and/or a password-entry app, in the initramfs before the main Puppy filesystem starts up.

On the desktop, LittlevGL and uGFX use SDL2, so perhaps, not really sure, but it might be possible to create reasonably small static apps for the desktop.

I had some feedback from technosaurus about what is out there, for creating GUI apps that will run on the framebuffer:

http://bkhome.org/news/201808/gui-creation-for-the-linux-framebuffer.html

I have started to evaluate LittlevGL:

http://bkhome.org/news/201808/first-go-at-evaluating-littlevgl.html

http://bkhome.org/news/201808/tentative-first-step-framebuffer-with-littlevgl.html

regarding uGFX, have not yet done a hands-on, but have posted info:

http://bkhome.org/news/201808/considering-ugfx.html

I think that this is a very interesting topic, and perhaps others who hang out on this forum will also find it interesting, so have started this thread...

_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 8710
Location: Perth, Western Australia

PostPosted: Mon 20 Aug 2018, 08:38    Post subject: Re: LittlevGL, uGFX, create GUI apps for Linux framebuffer  

BarryK wrote:
On the desktop, LittlevGL and uGFX use SDL2, so perhaps, not really sure, but it might be possible to create reasonably small static apps for the desktop.


Disregard that paragraph. It is just wishful thinking. I don't see how a "reasonably sized" statically-linked GUI app can be created for the desktop.

But, direct to the framebuffer in the initramfs, or anywhere you want to run just one small GUI app, no X.

_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 8710
Location: Perth, Western Australia

PostPosted: Tue 21 Aug 2018, 21:36    Post subject:  

Regarding LittlevGL, I couldn't see how to add mouse support, without SDL, running without X, so posted a question to the developer's github:

https://github.com/littlevgl/lvgl/issues/374

Helpful responses. 'kisvegabor' is the main developer guy.

His comment:

Quote:
Keep in mind, AFAIK, in command line mode (if you kill Xorg) the evdev's are not working by default.


...I will need to think about that.

_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
torm


Joined: 07 Mar 2015
Posts: 168

PostPosted: Thu 23 Aug 2018, 00:08    Post subject:  

Would be great to have something more atractive than terminal output in/from gfxboot to desktop timeline .. maybe to select savefile/folder etc. Rolling Eyes

Well at least to have that option, with some Puppy versions.
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 8710
Location: Perth, Western Australia

PostPosted: Thu 23 Aug 2018, 05:09    Post subject:  

With help from a couple of guys at the LVGL developer site, got it figured out. Now have mouse working, see photo.

Have posted review part 3:

http://bkhome.org/news/201808/littlevgl-evaluation-part-3.html
lvgl-demo3.jpg
 Description   
 Filesize   46.36 KB
 Viewed   372 Time(s)

lvgl-demo3.jpg


_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
rufwoof

Joined: 24 Feb 2014
Posts: 2643

PostPosted: Thu 23 Aug 2018, 16:27    Post subject:  

Why not use a ncurses type interface. Along with gpm so that the mouse works in the console ... and its not too bad. For instance with gpm server loaded in FatDog, running mc in a console window and using the mouse to navigate around the menus/files ... works well.
_________________
( ͡° ͜ʖ ͡°) :wq
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 8710
Location: Perth, Western Australia

PostPosted: Thu 23 Aug 2018, 20:42    Post subject:  

rufwoof wrote:
Why not use a ncurses type interface. Along with gpm so that the mouse works in the console ... and its not too bad. For instance with gpm server loaded in FatDog, running mc in a console window and using the mouse to navigate around the menus/files ... works well.


Yes, that is the alternative, but of course is a text-mode UI.

With LittlevGL we have all the graphical goodies, such as images, translucency, antialiased fonts, well, it does about everything you are able to do in a gtk/qt app.

So I guess it is a question of how you want to present your product.

_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
rufwoof

Joined: 24 Feb 2014
Posts: 2643

PostPosted: Fri 24 Aug 2018, 13:14    Post subject:  

Simple example of adding a fb image to the console i.e. gcc it and run it under a ctrl-alt-Fn console terminal. This just draws a box with colour scaling, but could be any size/location/image ...

Merged with a basic mouse pointer position/click detection within a while loop ...etc. and potentially lightweight

Compiles to a 7.6K sized binary under FatDog.
Code:
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>
#include <sys/ioctl.h>

int main()
{
    int fbfd = 0;
    struct fb_var_screeninfo vinfo;
    struct fb_fix_screeninfo finfo;
    long int screensize = 0;
    char *fbp = 0;
    int x = 0, y = 0;
    long int location = 0;

    // Open the file for reading and writing
    fbfd = open("/dev/fb0", O_RDWR);
    if (fbfd == -1) {
        perror("Error: cannot open framebuffer device");
        exit(1);
    }
    // printf("The framebuffer device was opened successfully.\n");

    // Get fixed screen information
    if (ioctl(fbfd, FBIOGET_FSCREENINFO, &finfo) == -1) {
        perror("Error reading fixed information");
        exit(2);
    }

    // Get variable screen information
    if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo) == -1) {
        perror("Error reading variable information");
        exit(3);
    }

    // printf("%dx%d, %dbpp\n", vinfo.xres, vinfo.yres, vinfo.bits_per_pixel);

    // Figure out the size of the screen in bytes
    // screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8;
    screensize = vinfo.xres_virtual * vinfo.yres_virtual * (vinfo.bits_per_pixel / 8);

    // Map the device to memory
    fbp = (char *)mmap(0, screensize, PROT_READ | PROT_WRITE, MAP_SHARED, fbfd, 0);
    if ((int)fbp == -1) {
        perror("Error: failed to map framebuffer device to memory");
        exit(4);
    }
    // printf("The framebuffer device was mapped to memory successfully.\n");

    x = 100; y = 100;       // Where we are going to put the pixel

    // Figure out where in memory to put the pixel
    for (y = 100; y < 300; y++)
        for (x = 100; x < 300; x++) {

            location = (x+vinfo.xoffset) * (vinfo.bits_per_pixel/8) +
                       (y+vinfo.yoffset) * finfo.line_length;

            if (vinfo.bits_per_pixel == 32) {
                *(fbp + location) = 100;                    // Some blue
                *(fbp + location + 1) = 15+(x-100)/2;         // A little green
                *(fbp + location + 2) = 200-(y-100)/5;        // A lot of red
                *(fbp + location + 3) = 0;                  // No transparency
        //location += 4;
            } else  {                                  //assume 16bpp
                int b = 10;
                int g = (x-100)/6;                          // A little green
                int r = 31-(y-100)/16;                      // A lot of red
                unsigned short int t = r<<11 | g << 5 | b;
                *((unsigned short int*)(fbp + location)) = t;
            }

        }
    munmap(fbp, screensize);
    close(fbfd);
    return 0;
}

_________________
( ͡° ͜ʖ ͡°) :wq
Back to top
View user's profile Send private message 
rufwoof

Joined: 24 Feb 2014
Posts: 2643

PostPosted: Fri 24 Aug 2018, 13:36    Post subject:  

Under-Pup is another option. In the past I've had a 70MB - 80MB or so thin pup that booted to a gui/X desktop that then dropped itself to be replaced with another fuller version. I was using that to pull down a larger puppy sfs over the net such that the main pup could be centrally managed/updated once, applied to many. IIRC I used X-vesa for that first layered pup for the greater simplicity/diversity of supported hardware.

IIRC got the idea from one of your older blog postings that I believe have since been lost/deleted. Not sure you called it Under-Pup, but was some name like that.

_________________
( ͡° ͜ʖ ͡°) :wq
Back to top
View user's profile Send private message 
rufwoof

Joined: 24 Feb 2014
Posts: 2643

PostPosted: Fri 24 Aug 2018, 14:06    Post subject:  

Just tried running vlc to watch a mp4 in a console session (under FatDog) and surprised to see it work so well, sound played OK also.
_________________
( ͡° ͜ʖ ͡°) :wq
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 8710
Location: Perth, Western Australia

PostPosted: Sun 26 Aug 2018, 10:24    Post subject:  

rufwoof wrote:
Under-Pup is another option. In the past I've had a 70MB - 80MB or so thin pup that booted to a gui/X desktop that then dropped itself to be replaced with another fuller version. I was using that to pull down a larger puppy sfs over the net such that the main pup could be centrally managed/updated once, applied to many. IIRC I used X-vesa for that first layered pup for the greater simplicity/diversity of supported hardware.

IIRC got the idea from one of your older blog postings that I believe have since been lost/deleted. Not sure you called it Under-Pup, but was some name like that.


That would be Underdog!

Mentioned here:
http://bkhome.org/archive/puppylinux/development/howpuppyworks.html

Mentioned on forum:
http://murga-linux.com/puppy/viewtopic.php?t=13750

The Underdog concept started in Jan. 2006:
http://bkhome.org/archive/blog1/news2006a.htm

_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 8710
Location: Perth, Western Australia

PostPosted: Sun 26 Aug 2018, 10:34    Post subject:  

rufwoof wrote:
Simple example of adding a fb image to the console i.e. gcc it and run it under a ctrl-alt-Fn console terminal. This just draws a box with colour scaling, but could be any size/location/image ...

Merged with a basic mouse pointer position/click detection within a while loop ...etc. and potentially lightweight

Compiles to a 7.6K sized binary under FatDog.


LittlevGL is really just the same, but with bells and whistles.

It has code like that for writing to the framebuffer.

For input, reads /dev/input/event# directly, gpm not needed.

I have hit a limitation, the developer has mostly designed LVGL for touch input, including for evdev. I have posted how he could expand that and include keyboard input:

https://github.com/littlevgl/lvgl/issues/377

What I am creating is a password entry app for the initrd. LVGL has a nice customizable on-screen keyboard, that works nice with a mouse, but I want it to work from a real keyboard also.

_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 8710
Location: Perth, Western Australia

PostPosted: Wed 29 Aug 2018, 07:45    Post subject:  

I posted about LVGL in technosaurus's thread "Unbloated coding resources", about a limitation of LVGL:

http://murga-linux.com/puppy/viewtopic.php?p=1003207#1003207

The limitation is that there is no keyboard support via evdev (only mouse and touchpad).

_________________
http://bkhome.org/news/
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 1 [13 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0609s ][ Queries: 12 (0.0086s) ][ GZIP on ]