I’m trying to get a small Adafruit 1.5" 128x128 OLED to run as a second display (to show playback details, channel tuned in PVR etc.). I’ve got it running in Raspbian with a stock Pi Foundation kernel (which includes fbtft support) but the OSMC kernel doesn’t seem to include fbtft support? Is there a simple way I can add this?
Yes - current stock Raspbian “2018-06-27-raspbian-stretch” includes it.
A “sudo modprobe fbtft_device name=pioled” works fine with no additional code added. I think there was a change to the way Linux handled video output that meant the fbtft approach was unlikely to be a long-term solution so it was moved to staging?
However it’s still very useful - and because so many portable game solutions use little TFT/OLED screens driven by SPI using fbtft (and fbcpy) I guess the Raspbian team continue to include it?
There are a couple of Kodi addons that use SDL and pygame to drive neat little status displays using fbtft as a way of talking to SPI ‘second displays’.
Add the following line: deb http://apt.osmc.tv stretch-devel main
Run the following commands to update: sudo apt-get update && sudo apt-get dist-upgrade && reboot
Your system should have have received the update.
Please see if the issue is resolved.
I also recommend you edit /etc/apt/sources.list again and remove the line that you added after updating. This will return you to the normal update channel.
Sam - it works thanks and the pioled can be enabled with fbtft support at boot.
Unfortunately the add-on I want to use GitHub - vitalogy/script.kodisplay is proving tricky - it requires SDL and pygame. Have got about 98% of the way there but it fails. There is a fault installing pygame but it completes.
13:00:20.580 T:1687155456 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <class 'pygame.error'>
Error Contents: Unable to open a console terminal
Traceback (most recent call last):
File "/home/osmc/.kodi/addons/script.kodisplay/kodisplay.py", line 202, in <module>
Display()
File "/home/osmc/.kodi/addons/script.kodisplay/kodisplay.py", line 101, in __init__
pygame.display.init()
error: Unable to open a console terminal
-->End of Python script error report<--
13:00:20.585 T:1925474816 DEBUG: ------ Window Init (DialogNotification.xml) ------
13:00:20.677 T:1687155456 INFO: Python script stopped
It runs fine in stock raspbian - but I’ve hit the limit of my abilities…
Suspect I’ll have to use a second Pi and KodiDisplayInfo to remotely connect instead.
(The aim is to have a neat small OLED or TFT screen that shows Kodi status separate to the main video output. Tuned Live TV channel, File playing etc. Kodisplay is much neater and better implemented than Kodi Display Info, but the latter runs over http whereas the former needs to run on the same box I think)
I wonder if stopping Kodi (sudo systemctl stop mediacenter) lets you start PyGame on the screen from the command line.
I would also check permissions on /dev/fb1. chown osmc:osmc on /dev/fb1 might be all that’s needed for this to work; but it’s unclear if PyGame is trying to open /dev/fb1 (presumably your fbtft display) or trying to open /dev/fb0.
If you run ls -l on /dev/fb0 and /dev/fb1 respectively, there will probably be different permissions.
Do let me know if this is the case. We probably want to adjust our udev rules to handle this properly.
They do indeed, so that doesn’t seem to be the issue.
Try this demo here:
Stop Kodi: sudo systemctl stop mediacenter
Run: python modified_012_text.py (not tested, but should work).
If you get the same error, output of strace python modified_012_text.py | paste-log would be interesting.
osmc@osmc:~$ python modified_012_text.py
Traceback (most recent call last):
File "modified_012_text.py", line 86, in <module>
flytext()
File "modified_012_text.py", line 41, in flytext
screen = pygame.display.set_mode((320,240))
pygame.error: Unable to open a console terminal
Ah - stderr isn’t being captured with your command line options - I did something different to capture stderr rather than stdout
I think that could be the problem. These ioctls are trying to get keyboard inputs associated with the TTY, but I’m not sure that should be happening at all when (presumably) doing this via SSH.
FB_OpenKeyboard in SDL_fbevents[1] is called unconditionally during
Framebuffer video initialization.[2] You can see there that most of
the logic to find a keyboard device is guarded by a check that
geteuid() == 0. (I.e. that the user is root.) The only fallback for
when not root is to try to open /dev/tty. If it fails to find a
keyboard device it can use it aborts. I hope that helps back up what
has been gleaned from the strace and maybe gives some clues.
Correct – it’s also strange that it doesn’t work in Kodi.
Did you install via pip? Might be worth checking the Raspbian version versus what you’ve installed under OSMC.
Did you try running PyGame (with Kodi stopped) as root (sudo)?
There was a hard-coded resolution in modified_012_text.py that was larger than my display and thus gave an error because it couldn’t open a screen the right size even when I ran as root…
With sudo python modified_012.text.py it runs and I get text on my display, without sudo I get pygame.error: Unable to open a console terminal
This is a root permissions thing isn’t it? I wonder if my raspbian account has root and therefore doesn’t give the console output issue?