site  contact  subhomenews

Tentative first step framebuffer with LittleVGL

August 19, 2018 — BarryK

As posted earlier today, I have started to evaluate LittlevGL:

the "PC simulator" does look like a good starting point, though it is setup to create a binary named "demo" that is linked against SDL2. That's OK for learning, but I am aiming to talk directly to the Linux framebuffer.

For EasyOS, SDL2 packages are available here (libsdl2-*):

Download the pc-simulator zip file:
Direct link to version 5.1.1:

Expand the zip file, and this is what you see:


Open a terminal, and type "make". That's it, a binary named "demo" will be created. Run it "# ./demo", and you get a GUI:


There is another tutorial web page that explains how to create a simple "Hello World" app using the Linux framebuffere, so onto that...

Hello World with Linux framebuffer

There is an introduction and tutorial here:

I fiddled around for awhile. Like the "PC Simulator" tutorial page, there is a conceptual-gap in the instructions. Here:

2. Compile the code and go back to character terminal mode, how to compile it? For a beginner, this is an awkward step. A Makefile is needed. These are the steps that I followed:

  1. Run "make clean"
  2. In the 'pc-simulator' folder, I moved 'lv-conf.h', 'lv_drv_conf.h', 'lv_ex_conf.h', 'main.c' and 'Makefile' elsewhere.
  3. I then created new 'lv_drv.h', 'lv_conf.h' and 'main.c' as per instructions in the above URL.
  4. I copied-back the 'Makefile' that I had previously moved away, and edited it. Snapshot of the files, 'hide1' is where I moved the original files to:


Here is my edited Makefile:

# Makefile
CC = gcc
CFLAGS = -Wall -Wshadow -Wundef -Wmaybe-uninitialized
CFLAGS += -O3 -g3 -I./
#LDFLAGS += -lSDL2 -lm
BIN = demo

LVGL_DIR = ${shell pwd}

MAINSRC = main.c

include ./lvgl/lv_core/
include ./lvgl/lv_hal/
include ./lvgl/lv_objx/
include ./lvgl/lv_misc/lv_fonts/
include ./lvgl/lv_misc/
include ./lvgl/lv_themes/
include ./lvgl/lv_draw/

include ./lv_drivers/display/
include ./lv_drivers/indev/

OBJEXT ?= .o





all: clean default

%.o: %.c
@$(CC) $(CFLAGS) -c $< -o $@
@echo "CC $<"

default: $(AOBJS) $(COBJS) $(MAINOBJ)

rm -f $(BIN) $(AOBJS) $(COBJS) $(MAINOBJ)

I do realise that more modules than are needed, are being included in the build, but that's OK, as I plan to play with adding more widgets. Notice that SDL2 is not being linked.

Run "make", it creates 'demo'. This will not run on the Xorg desktop, though I vaguely recall a method of doing it in a terminal. Anyway, the way to test 'demo' is to exit from X, via the Shutdown menu in EasyOS (and most pups). Then, on the commandline, as long as a framebuffer has command of the screen, which is likely (there are some caveats), just execute 'demo', where-ever it is.

On the commandline, here is what it looks like:


That's as far as I've got. Next, need to investigate mouse support...

LVGL evaluation Part-3 here: 

Tags: linux

First go at evaluating LittlevGL

August 19, 2018 — BarryK

As posted about a couple of days ago on this blog, I have an interest in creating small GUI apps that will talk directly to the Linux framebuffer. Here is the post:

I tentatively narrowed the choices down to LittlevGL, uGFX and Nuklear. LittlevGL looks great, so giving it a go. The website:

The "PC simulator" looks like a good starting point:, I followed the instructions. Installed Eclipse IDE, etc. Got to this part:

Now you are ready to run the Littlev Graphics Library on your PC. Click on the Hammer Icon on the top menu bar to Build the project. If you have done everything right you will not get any errors. Note that on some systems additional steps might be required to "see" SDL 2 from Eclipse but in most of cases the configurtions in the downloaded project is enough.

After a success build click on the Play button on the top menu bar to run the project. Now a window should appear in the middle of your screen.

Now everything is ready to use the Littlev Graphics Library in the practice or begin the developement on your PC., no, that didn't work. Yeah, the "Hammer Icon" part is OK, it reported a successful build, however, the "Play" button did nothing. Searched the source, couldn't find the compiled files anywhere. Hmmm...

It turned out, the instructions are incomplete, extra steps are required, as explained on YouTube:

However, decided to start again, from scratch. I was not drawn to the Eclipse IDE, it seemed unnecessarily complex, and bloated, requiring Java JRE. Will attempt to do it from  a terminal only.

To keep a clean separation, will create another blog post...

LVGL evaluation Part-2 here:

Tags: linux

GUI creation for the Linux framebuffer

August 17, 2018 — BarryK

For a long time I have wanted some means of creating very small GUI apps that are statically compiled and work directly with the Linux framebuffer. The use would be for a GUI app in the initramfs.

I recently discovered LittlevGL, and then decided to ask for the opinion of two guys who are real experts in this field, 'technosaurus' and 'goingnuts' (their Puppy Forum names).

Firstly, here is a post about LittlevGL:

I sent a pm on the Puppy Forum to technosaurus, and he responded:

littlevgl has been on my radar for a while now - I do like it, but its no gtkdialog replacement; you can see more of my projects of interest at I am in the process of moving from near Houston, Texas to near Kansas City, Missouri (U.S.) We have moved 3 times in 3 years so I have not been coding for some time - just reading/analyzing code for future use (thus all the starred projects, but few commits)

Besides littlevgl, the ones I know of that will work for the framebuffer (and X) are: forum thread here + oui/blendish (uses SDL) (lacks widgets)

more gtkdialog-like: some largish dependencies (libpng,libjpeg,
libxml2,freetype,fontconfig) possibly unmaintained and needs freetype and lua - uses any raw framebuffer (or X11 depending on configuration)

Some notes.

For the ones that use opengl (or GLES) a specially built Mesa is needed and some framebuffer drivers are not supported because they lack support for kernel mode setting (unfortunately no one has ported Fabrice Bellard's tinygl as a fallback)

littlevgl seems to be a retained mode GUI like gtk and kde (but seems to be simplified so that you need ~1/3 less code than gtk and without the huge overhead of c++ and qt) There is a template here and it seems to be targeted to Linux with growing driver support
nuklear and nanovg are immediate mode GUIs which cater toward game development and tend to use more CPU, though nuklear appears to have addressed this since I last tested it. However, since they are single header files, anything unused will get compiled out so they make small binaries.

GUIslice could be a good compromise since it uses SDL (1.2 or 2.x) which will handle the framebuffer (or X) for you. It isn't as pretty though - basically an improvement on curses.

I was aware of Nuklear, and did look at it briefly a year or so ago.

Here is another one, uGFX:

This is a commercial product, free for "home, hobby and educational" use. It is an open source project, and will work with sdl or directly with the framebuffer. Git project site: 

Tags: linux

adb connection to phone over wifi

August 09, 2018 — BarryK

I posted yesterday about using 'adb' and 'adbfs' over usb to browse files on my Android phone:

Briefly mentioned that it could be done over wifi as well. Yes, this site has a nice explanation:

It does require a one-time usb connection to enable the phone to listen on port 5555. With usb-debugging enabled on the phone and usb cable connected to PC, on the PC:

# adb devices
...this will confirm the connection
# adb shell "ip route" dev wlan0  proto kernel  scope link  src
... is the ip-address of the phone.
# adb tcpip 5555
...starts the phone listening on port 5555

Then unplug the usb cable, and on the PC:

# adb connect
# adb shell "ls /sdcard"
...will list folders and files on phone
# adbfs /mnt/phone
...can browse the files
# fusermount -u /mnt/phone

Yeah it works, but not very secure. Port 5555 stays open until the phone is rebooted. adbfs is a simple method, but reckon will restrict to only doing it via usb cable.

Tags: easy, quirky, linux

Smallest and simplest Samba client

July 31, 2018 — BarryK

This is something that I have wanted to figure out for a very long time. What is the smallest and simplest setup if I only want a samba client on a PC, not a server?

I am currently rewriting EasyShare, my easy network file and printer sharing GUI app. This is able to use sshfs or samba, but is actually designed such that samba is required. But, is it really, and if so, what files can it be reduced down to for a client-only system? Strangely, this question is not really answered anywhere on the Internet.

My EasyOS and Quirky will not function as a samba server, however, will have a sshfs server, and cups server, so can serve files and printers. However, other computers on the network may have smb or samba servers, and my PC must be able to connect to them.

basically, EasyShare uses the 'arp-scan' utility to discover the ip-addresses on the network, then 'mpscan' to find server ports. For samba/smb servers, 'nbtscan' is used to obtain the netbios-name/hostname, and for computers that serve sshfs, the 'nmap' utility is used to obtain hostname.

The sticking point is how to discover smb shares on the remote computer. Up to now, I used 'smbclient', which brings with it most of the shared libraries of the samba package.

There are some alternatives to automatically discover shares. A "share" is a name that samba assigns to a particular shared folder or printer.

I discovered that VLC multimedia player uses libdsm for samba discovery, though I couldn't see how it can discover shares. Also, libdsm only supports smbv1, which is too old. Windows 10 has dropped support for smbv1 by default, though apparently it can be enabled. However, smbv1 is considered to be a security risk.

Windows 10 does by default support smbv2 and smbv3. Ah, there is a library, 'libsmb2', with example utilities, that supports smbv2 -- however, whatever I tried to do with the utilities, they always crashed.

I did read that 'nmap' can discover smb shares, but I don't know how.

So, I am back on 'smbclient', meaning that the samba package is required. But, what else from the samba package is required? What about those 'smbd' and 'nmbd' daemons?

I was reminded about those daemons a few days ago, when one of the EasyOS testers thought that they might be responsible for his usb-stick (with easyOS on it, from which he booted) running hot after an overnight backup. This reminded me that sometime ago I noticed that the samba daemons were cpu hogs. Up to now, I have always automatically assumed that they are needed, but what for?

Note, there are lots of posts on the Internet about smbd being a cpu hog, just google "smbd is a cpu hog".

I successfully connected to a Windows 10 machine, from a pc running EasyOS and only the 'smbclient' utility -- absolutely nothing else from the samba package.

Furthermore, I studied the compile options, and created the smallest possible 'smbclient' utility. The smbv2 protocol is sufficient, so I compiled samba 3.6.25 -- 4.x is not required. I will document this exactly soon, when I put it into oe-qky-src, my fork of OpenEmbedded.

There are three packages needed, 'nbtscan', which has the 'nbtscan' utility, 'cifs-utils', which has the 'mount.cifs' utility, and the 'smbclient' utility from samba. All of this can be seen in action in script /usr/local/EasyShare/easyshare, in the next release of EasyOS and Quirky.

I have create a PET,, which is 1.87MB, compared with the 10.5MB samba PET package I was using before.

For the record, here are some links:

It is still on the cards that I might find a light-weight share discovery utility to replace smbclient! 

Tags: easy, quirky, linux

Gxlat language translator

July 28, 2018 — BarryK

This is brilliant! Puppy Forum member vovchik developed this around 2011/2012, however, Google changed to a paid service.

Recently, vovchik has figured out a way around this, so we can still use it for free, using a special script named 'trans'. originally, Gxlat had compiled binaries, however, now is just two shell scripts, and gtkdialog and gxmessage are used for the GUI, which we have in all the pups.

Here is the forum thread:

The latest PET, posted 10 July 2018, has some problems. The file was corrupted, but I was still able to expand it, the icon is missing from /usr/share/pixmaps, and it presents itself as version 0.2b.

There is an earlier version that is 0.3, so I have created a PET and it presents itself as version 0.4. I put in the icon, and modified the gxlat.desktop file slightly -- one thing, put it into the Document menu (sub-section utility), as this is less crowded.

Here is the PET (45KB):

This will be in the next release of EasyOS and Quirky. This is really nice vovchik, much appreciated!

Tags: easy, quirky, linux

Nheko Matrix chat client

July 18, 2018 — BarryK

Purism are using Matrix for chat forums, including for the Librem 5 phone:

So, decided to give it a go. There are various Matrix client apps, and I compiled Qt5-based Nheko:

The PET for EasyOS 0.9.5+ (not yet released) is here:

Dependencies are 'olm', 'libsodium', 'liblmdb', which are also PETs. Also 'boost' version 1.66, which is in the upcoming Easy 0.9.5.

Nheko, at startup, offered to register, where a username, password, and "Home Server" can be entered. For the latter, I entered "", and a captcha came up in the browser to verify that I am a human.

After starting Nheko, I was in my own "room", "@<myusername>", but unable to change out of it. Nheko is lacking some features, but is under rapid development.

I logged in at the online browser Matrix client:

Logged in, I was able to ratify a user-agreement, that then allowed changing rooms. I was also able to personalize my account, with email and avatar, which cannot be done in Nheko.

Started up Nheko, logged in, then hit the "+" icon and was able to change rooms. Chose "", and yay, there it is!

Hmmm, perhaps it is easier just to use the online client.

Tags: linux, easy, quirky

How to give super-powers to zeus

June 20, 2018 — BarryK

This is very interesting! I have a user named 'zeus', your normal underprivileged user. How can I give zeus admin-privileges, without actually becoming root -- because, that is what 'sudo' does, can bump up to 'root' to perform admin operations.

I want to perform some admin operations, while still being zeus. Never mind why I want to do this, I just do.

The 'capsh' utility, in the 'libcap' package, can do it. I wrote about "Linux capabilities" recently:

...however, I am not interested in the cap_sys_mount patch anymore.

Puppy Linux and derivatives such as Easy and Quirky, run as 'root', with the ability to run Internet applications as user 'spot', and in Easy in containers with unprivileged-root -- the latter is achieved by using 'capsh' to drop privileges when chroot into a container.

Anyway, running as root, it would seem that capsh could be used to switch to a normal user, yet keep any privileges that we want to keep. In Easy, there is a user named 'zeus', that I created especially for this experiment.

I thought that capsh would work (using "--secbits"), however, it didn't. I am using libcap version 2.25, which the original author stopped work on some years ago. I discovered that some further work has been done on libcap, to add that missing/broken feature:

...thanks Andrew!

I modified the source slightly, copied from the kernel source /usr/src/linux-4.14.44/include/uapi/linux/capability.h, prctl.h, and securebits.h, to libcap-2.25/libcap/include/uapi/linux/, and changed the "DYNAMIC..." line in Make.Rules to this:

DYNAMIC := $(shell echo yes) as to get dynamically liked executables.

Then just ran the usual:

# make
# new2dir make install

Running "capsh --print" prints out all of the capabilities. Now, if I want to change to user zeus and keep all of those capabilities:

# capsh --keep=1 --user='zeus' --inh='cap_chown,cap_dac_override,cap_dac_read_search,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_linux_immutable,cap_net_bind_service,cap_net_broadcast,cap_net_admin,cap_net_raw,cap_ipc_lock,cap_ipc_owner,cap_sys_module,cap_sys_rawio,cap_sys_chroot,cap_sys_ptrace,cap_sys_pacct,cap_sys_admin,cap_sys_boot,cap_sys_nice,cap_sys_resource,cap_sys_time,cap_sys_tty_config,cap_mknod,cap_lease,cap_audit_write,cap_audit_control,cap_setfcap,cap_mac_override,cap_mac_admin,cap_syslog,cap_wake_alarm,cap_block_suspend,cap_audit_read' --addamb='cap_chown,cap_dac_override,cap_dac_read_search,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_linux_immutable,cap_net_bind_service,cap_net_broadcast,cap_net_admin,cap_net_raw,cap_ipc_lock,cap_ipc_owner,cap_sys_module,cap_sys_rawio,cap_sys_chroot,cap_sys_ptrace,cap_sys_pacct,cap_sys_admin,cap_sys_boot,cap_sys_nice,cap_sys_resource,cap_sys_time,cap_sys_tty_config,cap_mknod,cap_lease,cap_audit_write,cap_audit_control,cap_setfcap,cap_mac_override,cap_mac_admin,cap_syslog,cap_wake_alarm,cap_block_suspend,cap_audit_read' --
# whoami
# rm -f NewFile1

'NewFile1' was owned by root, and a user would not be able to delete it, which I checked was the case when I just did a normal "su zeus". Yippee, zeus has super-powers!

Note, the order is important:

capsh --keep=1 --user='zeus' --inh='...' --addamb='...' -- 

The "--" causes bash to run, so you have a new shell, and get back to root by typing "exit".

Tags: easy, linux, quirky