Rockbox Technical Forums

Rockbox Development => Starting Development and Compiling => Topic started by: PaulF on March 16, 2015, 04:15:44 PM

Title: SDL app on Raspberry PI
Post by: PaulF on March 16, 2015, 04:15:44 PM
I compiled the the SDL app on the Raspberry PI 2 and it works great. I had to add only a couple of deb packages(zip and SDL headers in the dev package). Is there a manual?

I did a uisimulator build and there in a simdisk directory in the build root to change the themes etc.

The SDL build root has no simdisk and uses the PI file system for media files, but I can't find a configuration files/directories, like .rockbox, for instance. I'm guessing the configurations are done at build time. If so what files do look at for theme loading and other configurations.

How do I find the keyboard key actions? Is there a key that shuts down rockbox? If not, how would I add a shut down key? I can run rockbox from the console and it runs directly to the fb. In an X window closing the window works, but I would like to use the full SDL screen.

Thanks
Title: Re: SDL app on Raspberry PI
Post by: PaulF on March 17, 2015, 12:47:30 AM
I tried the full screen and waited for the idle timer to "power down" and it it didn't return to console so I guess I have no need to add a "power off" button. It was a bad idea so never mind.

I would still like to know how the keys are compiled into a map so I can match the buttons on my 21 key remote keyboard.
Title: Re: SDL app on Raspberry PI
Post by: saratoga on March 17, 2015, 01:00:37 AM
The keymap is here:

http://git.rockbox.org/?p=rockbox.git;a=blob;f=apps/keymaps/keymap-sdl.c

Which is then mapped to SDL button codes here:

http://git.rockbox.org/?p=rockbox.git;a=blob;f=firmware/target/hosted/sdl/app/button-application.c

See also:

https://wiki.libsdl.org/SDL_Keycode
Title: Re: SDL app on Raspberry PI
Post by: saratoga on March 17, 2015, 01:10:37 AM
The output directory for rockbox is set in the configure script.  You can change it with --rbdir=dir when running configure.  I'm not sure how the other paths are determined through.  Someone more familiar with the app ports can answer that.
Title: Re: SDL app on Raspberry PI
Post by: PaulF on March 17, 2015, 03:01:16 PM
The output directory for rockbox is set in the configure script.  You can change it with --rbdir=dir when running configure.  I'm not sure how the other paths are determined through.  Someone more familiar with the app ports can answer that.
Code: [Select]
export RBDIR=/.rockbox
CONFIGURE_OPTIONS=--lcdwidth=400 --lcdheight=240 --target=$(MODELNAME) --ram=$(MEMORYSIZE) --rbdir=$(RBDIR) --type=a
That's why I can't find .rockbox. Rockbox does not have write privilege because I was not the root user.
 
drwxr-xr-x 22 root root 4096 Mar 14 21:56 /

Trying to get my head around the key mapping. My fuzzy view so far is SDL refers to an app and a Linux library. The app apparently is different depending on platforms and the default platform seems to be Android, which has a touch screen. I may add a touch screen to my Pi later, but have no touch screen, yet
Title: Re: SDL app on Raspberry PI
Post by: saratoga on March 17, 2015, 03:14:02 PM
SDL is a cross platform library that wraps around a local operating system's interfaces for accessing things like keys and displays.  Theres a bunch of different targets (and also the UI simulators) that use it because it provides a standard way for a new target to tell rockbox how to read buttons.
Title: Re: SDL app on Raspberry PI
Post by: PaulF on March 18, 2015, 02:56:53 PM
SDL is a cross platform library that wraps around a local operating system's interfaces for accessing things like keys and displays.  Theres a bunch of different targets (and also the UI simulators) that use it because it provides a standard way for a new target to tell rockbox how to read buttons.
You got me thinking. One reason the SDL is part of the Pi is the GUI is an SDL target called LXDE. You start LXDE from the console with startx command and it goes full screen. When you log out it goes back to the console. Maybe I should figure out why when  Rockbox shuts down the display in an unusable state. I gave up on a shut down key, but may revisit it. Now I need to look at LXDE source code, too.
Title: Re: SDL app on Raspberry PI
Post by: [Saint] on March 19, 2015, 11:06:13 PM
You seem somewhat confused. Which is fine. Its not a bad thing to be.

SDL (Simple DirectMedia Layer) isn't "part of the Pi" per se, its just a package (well, several, really - libsdl*, libsdl-image, libsdl-mixer,...), that happens to be present in the distribution you're using, which from the sounds of things is likely the Raspberry Pi Foundation's Raspbian distro.  One of the many distributions one can run on the Raspberry Pi (Arch Linux ARM, Fedora, RISC OS, Open ELEC, ...), each with a fairly striking difference in its default packages.

 LXDE (Lightweight X11 Desktop Environment) is also not tied to SDL in any meaningful way. LXDE is designed to be extremely lightweight X11 client, the guts of it being little more than GTX, X.Org, and its own modular dependencies (lxtask, lxappearence, lxsession, et al).

[Saint]

EDIT: PS - I wanted to add that on the Raspberry Pi, hardware buttons would be very trivial to add via the boards GPIO pins.

You could add them to the board directly in a removable fashion with a GPIO stacking header (http://www.adafruit.com/images/1200x900/2223-00.jpg) and some 2-pole tactile dome switches (http://www.capacitor.com.hk/upload/TSS-TC-0303-SuntanTactSwitch.jpg).

Adding in basic functions like play, pause (stop on long-press), fastforward & rewind (seek on long-press), etc. should be fairly easy to integrate into the SDL app (in a GPIO driven fashion). You could even add directional keys and select if you wanted I guess. Or you could just snip off the unused riser legs, or if you're lucky you might be able to find a female<->female GPIO riser but they're not easy to source for some reason - at least not in my neck of the woods.

Title: Re: SDL app on Raspberry PI
Post by: PaulF on March 21, 2015, 12:34:11 AM
When I don't know how something works I ask questions. Some make no sense. I don't care if I look confused so all answers are helpful. LXDE was a blind alley as was rightly pointed out. All I am doing now is enhancements because the RockBox SDL app works as window. I have IRKey from Adafruit that I will use to replace a full wireless keyboard I now use. I am curious about the Raspberry PI frame buffer and am in search of an example. The NTSC out is 480i version 720w 480h. I'm not sure about the frame buffer because the buffer can be smaller because of overscan. LXDE is smaller, but now not useful with respect to full screen SDL. I visit the Adafruit Forums a lot as PaulF8080. A reference to the Intel 8080 because PaulF was taken. I used the 8080 a long time ago and later worked at Intel. I am now retired.
Title: Re: SDL app on Raspberry PI
Post by: saratoga on March 21, 2015, 12:49:43 AM
You might want to ask in IRC as well.  There are a few people who know a lot more about the SDL applications. 
Title: Re: SDL app on Raspberry PI
Post by: PaulF on March 30, 2015, 01:00:05 PM
EDIT: PS - I wanted to add that on the Raspberry Pi, hardware buttons would be very trivial to add via the boards GPIO pins.

You could add them to the board directly in a removable fashion with a GPIO stacking header (http://www.adafruit.com/images/1200x900/2223-00.jpg) and some 2-pole tactile dome switches (http://www.capacitor.com.hk/upload/TSS-TC-0303-SuntanTactSwitch.jpg).

Adding in basic functions like play, pause (stop on long-press), fastforward & rewind (seek on long-press), etc. should be fairly easy to integrate into the SDL app (in a GPIO driven fashion). You could even add directional keys and select if you wanted I guess. Or you could just snip off the unused riser legs, or if you're lucky you might be able to find a female<->female GPIO riser but they're not easy to source for some reason - at least not in my neck of the woods.
I went to KiCad PCB design class put on by a local club and was thinking about your ideas. At the class someone had a nav wheel switch designed into a board. I could add the wheel, too. http://www.digikey.com/product-detail/en/TSWB3NCB111LFS/CKN10344-ND/2627683

By shear coincidence, on the same day as the class, someone posted a KiCad template for the Raspberry Pi addon board called a "hat".  https://forum.kicad.info/t/raspberry-pi-b-hat-template/738

This should keep me busy for a few months. Keep the ideas coming.
Title: Re: SDL app on Raspberry PI
Post by: PaulF on May 02, 2015, 04:45:33 PM
I looked in the SDL header files and SDL_SetVideoMode() has a flag called SDL_FULLSCREEN. What does the LCD screen size in the config script do in SDL. Should I set it to the frame buffee size?

I only have  only occasionally looked at enhancements, so not much to report, but I was searching settings for bookmark setup, I saw that there is an HID USB device in the settings. The Fuze buttons and scroll wheel work.  ;D. I wouldn't need to add a scroll wheel to my PI, but unfortunately I have to boot the Sansa FW to get a stable USB.
Title: Re: SDL app on Raspberry PI
Post by: PaulF on July 01, 2015, 10:14:21 PM
I did a design of of a PI add on board called a "Hat". I used kicad for the design ans OSH Park for the purple boards. I added tactile switches, like Saint suggested. I found a scroll wheel that has five tactile switches, just like my Fuze. I also added a Fuze Home button. The Fuze is a disk drive mounted on the Pi so the bookmarks go to the Fuze. I modified the Fuze ThinMod theme so I could see the art form the driver seat. It has been a great learning experience. I have used Rockbox every day for years to listen to my podcasts. When I wanted to learn PCB design, Rockbox is the first thing I thought about.

I have parts for two more boards and if SDLapp developers want one, I will donate them. Its not very useful for most people. Only car travelers that listen to podcasts and/or audio books need shared bookmarks.

Next enhancement is add my podcast WiFi down load software as a plugin.

I made a couple of small patches. Should I upload them some where? Should I add a model, I like RockPI_box.
Title: Re: SDL app on Raspberry PI
Post by: dkrey on May 25, 2016, 08:17:53 AM
I just started to play around with the sdl build. Since you really can't buy any new hardware supporting rockbox, I need to make my own :)

Currently rockbox starts up, but the touchscreen still acts weird and the calibration doesn't seem to help much. Is there any way to debug the touchscreen control? I'm using a PiTft 2.8 capacitive with an ft6236 touch controller.

@PaulF: Did you upload your patches anywhere?