Customizing OGST, Gaming Kit Tools

Very powerful gaming console solution based on Debian
Post Reply
User avatar
AreaScout
Posts: 1356
Joined: Sun Jul 07, 2013 3:05 am
languages_spoken: german, english
ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
N1, Go, VU5A, Show2, CloudShell2,
H2, N2, VU7A, VuShell, Go2, C4
Has thanked: 60 times
Been thanked: 194 times
Contact:

Customizing OGST, Gaming Kit Tools

Post by AreaScout » Sat Jun 30, 2018 4:59 pm

Hi all

This thread should help people to quickly find all tools available to customize your OGST Gaming Console Kit to Display unique contents

All posts are taken from this thread viewtopic.php?f=156&t=30979#p223554

RG

User avatar
AreaScout
Posts: 1356
Joined: Sun Jul 07, 2013 3:05 am
languages_spoken: german, english
ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
N1, Go, VU5A, Show2, CloudShell2,
H2, N2, VU7A, VuShell, Go2, C4
Has thanked: 60 times
Been thanked: 194 times
Contact:

Re: Customizing OGST, Gaming Kit Tools

Post by AreaScout » Sat Jun 30, 2018 5:01 pm

Hi all

I have just created a GitHub repository at https://github.com/AreaScout/Gaming-Kit-Tools

It contains four tools which helps you to access the Gaming Kit LCD and user button in an easy to use script able way, you can do things like this:

Image

SDL2OSD.png
SDL2OSD.png (108.06 KiB) Viewed 4621 times
gpio_button:

This tool can run as daemon and start scripts/programs when the user button is either pressed or released, this gives you the opportunity to measure
the time between the keypress to start different events or just fire up a script only when the button is released, you can run it from console to test
your script like so gpio_button -f /home/odroid/LCDTools/test.sh -r /home/odroid/LCDTools/test2.sh and add it to auto start later and run it
as daemon like this:

/etc/rc.local

Code: Select all

##### CONSOLE KIT START #####

[ `/sbin/lsmod | grep -c spi_s3c64xx` -ge 1 ] && rmmod spi_s3c64xx
modprobe spi_s3c64xx force32b=1
modprobe fbtft_device name=hktft9340 busnum=1 rotate=270
su root -c '/bin/rm -f /dev/fb1'
su root -c '/bin/mknod /dev/fb1 c 29 1'
su root -c '/bin/chmod 0666 /dev/fb1'
su root -c 'gpio_button'
su odroid -c 'gpio_button -f /home/odroid/LCDTools/test.sh -r /home/odroid/LCDTools/test2.sh -d'
su odroid -c 'img2fb -i "/home/odroid/ROMS/N64/fanart/Bottom of the 9th (USA).jpg"'
##### CONSOLE KIT END #####
as you can see the last line of the auto start script displays a "boot screen" which brings us to the next tool ( pictures can be displayed way earlier in the boot process but you know that )

img2fb:

With this tool you can display pictures to LCD, they will be scaled down to the right size, you can choose if aspect ratio should be used or not

show_info:

It's basically the same tool like SDL2DisplayTest aka OGSTDisplay, but this displays the OSD to an already present image on the LCD and restore it on exit
so here is an example of a shell script

Code: Select all

#!/bin/bash

img2fb -i /some/super/image.jpg
show_info -d 128 &
sleep 5
PPID=$(pidof -s show_info)
kill -SIGINT $PPID
The picture is shown, show_info dims the picture, displays the system info for 5 seconds and then exits by sending an SIGINT which is an ctrl+c and restores the image

osd2fb:

Displays Text as an OSD over a already loaded picture like so

Code: Select all

#!/bin/bash

cat /dev/fb1 > image.raw
osd2fb -f DroidSans-Bold.ttf -i "Weather forecast" -y 10 -x 20 -w 15 -s -o 128
osd2fb -f DroidSans-Bold.ttf -i "21°C" -y 30 -x 30 -w 38 -s
sleep 5
cat image.raw > /dev/fb1
as you can see each line has to send separate to the LCD
the first line backups the framebuffer contains in a file
the second line draws not only the text with x and y position, it adds an overlay with transparency 128
the third line draws also a text but this time without overlay, because it's already there
fourth sleeps 5 seconds
fifth restore the original framebuffer

P.S.: for more detailed info look on GitHub
Last edited by AreaScout on Sat Jun 30, 2018 7:12 pm, edited 4 times in total.

User avatar
AreaScout
Posts: 1356
Joined: Sun Jul 07, 2013 3:05 am
languages_spoken: german, english
ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
N1, Go, VU5A, Show2, CloudShell2,
H2, N2, VU7A, VuShell, Go2, C4
Has thanked: 60 times
Been thanked: 194 times
Contact:

Re: Customizing OGST, Gaming Kit Tools

Post by AreaScout » Sat Jun 30, 2018 5:12 pm

Hi all

I have just created a new github repo at https://github.com/AreaScout/Shader2LCD

Please get the information how to use and build it from there

I have ported that tool from the oShaderToy which can display shaders from the https://www.shadertoy.com/ webside you can just search there for a nice shader you want for your DIY console project, there are thousands of shaders
but be aware that a lot of them are to GPU intensive to run on our ODROID's, some of them are drawing a complete jungle terrain with mountains only with a shader, no 3D Model nothing, you will see how GPU intensive this will be if you browse the website only.

https://www.shadertoy.com/

You can display starting from a clock to terrain, creative art drawings, ps3 like sinwave, game intros, demo intros a.s.o, just browse the webside, i will soon add a tut how to get the shaders from the webside inside the Shader2LCD tool
There are also 35 shaders included on github, the screenshots shows some of them. Running those shaders the same time a game is running is a bad (6-8fps drop) idea but running them the same time a GUI is active, it's no problem ( RetroArch, Attract Mode, EmulationStation GUI etc. ).

RG
Attachments
Shaders.png
Shaders.png (693.18 KiB) Viewed 4635 times

User avatar
AreaScout
Posts: 1356
Joined: Sun Jul 07, 2013 3:05 am
languages_spoken: german, english
ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
N1, Go, VU5A, Show2, CloudShell2,
H2, N2, VU7A, VuShell, Go2, C4
Has thanked: 60 times
Been thanked: 194 times
Contact:

Re: Customizing OGST, Gaming Kit Tools

Post by AreaScout » Sat Jun 30, 2018 5:16 pm

Hi all

I have created a github repo https://github.com/AreaScout/SDL2DisplayTest with the first tool that shows how to display OSD over an bitmap image, it listens for gpio events on sysfs ( right user button )
SDL2OSD.png
SDL2OSD.png (108.06 KiB) Viewed 4621 times
building:

Code: Select all

sudo apt-get install libsdl2-dev libsdl2-ttf-dev
git clone https://github.com/AreaScout/SDL2DisplayTest.git
./build.sh
you can add it to autostart by edit /etc/rc.local (just an example) like so:

Code: Select all

##### CONSOLE KIT START #####

[ `/sbin/lsmod | grep -c spi_s3c64xx` -ge 1 ] && rmmod spi_s3c64xx
modprobe spi_s3c64xx force32b=1
modprobe fbtft_device name=hktft9340 busnum=1 rotate=270
su root -c '/bin/rm -f /dev/fb1'
su root -c '/bin/mknod /dev/fb1 c 29 1'
su root -c '/bin/chmod 0666 /dev/fb1'
su root -c '/path/to/the/binary/OGSTDisplay'
su odroid -c 'cd /path/to/the/binary && ./OGSTDisplay odroid.bmp DroidSans-Bold.ttf'
##### CONSOLE KIT END #####

exit 0

if you wonder why i delete /dev/fb1 in the first place, this is because there seems to be an issue, when the driver is loaded it takes >2min after the device is booted before /dev/fb1 will show up, i can
bypass this by creating the node manually but i have to delete a already created device node first in case it takes <2min (sometimes this happens too)

Good forum post to read viewtopic.php?f=156&t=30848

usage:

first run it as root, the gpio device sysfs entry has to be created

Code: Select all

sudo OGSTDISPLAY
./OGSTDisplay some.bmp some.ttf
Have Fun

User avatar
odroid
Site Admin
Posts: 34586
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 812 times
Been thanked: 704 times
Contact:

Re: Customizing OGST, Gaming Kit Tools

Post by odroid » Sun Jul 01, 2018 12:41 pm

Very useful articles and I've changed this thread to "STICKY".

Danielsan
Posts: 11
Joined: Thu Dec 27, 2018 5:52 am
languages_spoken: english
ODROIDs: Odroid-XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: Customizing OGST, Gaming Kit Tools

Post by Danielsan » Sun Apr 19, 2020 12:50 am

Hi folks, do all these scripts work on the Ubuntu image?

Thanks

User avatar
adiastra
Posts: 5
Joined: Tue May 12, 2020 9:53 pm
languages_spoken: english
ODROIDs: XU4 OGST
Has thanked: 0
Been thanked: 0
Contact:

Re: Customizing OGST, Gaming Kit Tools

Post by adiastra » Tue May 12, 2020 9:57 pm

I would like to use the right button to turn the backlight on and off using these commands (i already tested them and they work)
What would that script look like? I am using recalbox so i cant make the toolset.

Code: Select all

        echo 0 > /sys/class/backlight/fb_ili9340/bl_power #power ON backlight

        echo 1 > /sys/class/backlight/fb_ili9340/bl_power #power OFF backlight 
The commands at this link also work if you omit sudo as recalbox does not have sudo, I just dont know how to setup the GPIO button. I am assuming i can add a script to /etc/init.d that waits for the event, but what exactly is the event when the right button is pushed?
https://odroid.com/dokuwiki/doku.php?id ... _backlight

Post Reply

Return to “OGST-XU4”

Who is online

Users browsing this forum: No registered users and 1 guest