I am currently using a Radxa ZERO 3E (Rockchip RK3566) running a bleeding-edge build of LibreELEC compiled from chewitt’s GitHub repository.
I managed to get a 0.96" SSD1306 OLED display working using LuRu’s addon, which required a patch to enable I2C. However, it recently stopped working, possibly due to an update in Kodi’s Python environment?.
Through troubleshooting, I discovered that updating smbus2 to version 0.6.0 resolved the immediate issue, though the service failed to start consistently after a reboot. To fix this, I used AI to create a patch that implements a retry mechanism for the I2C connection.
I have also integrated LuRu’s patches into the latest script.xbmc.lcdproc (v4.1.1). While I’m not certain this step is strictly necessary, I have attached the modified files.
changes to service.oled/service.py
--- service.oled/service.py 2024-11-01 08:11:44.000000000 +0100
+++ service.oled/service.py 2025-12-28 05:29:51.976312025 +0100
@@ -45,6 +45,21 @@
return False
return bool(TIME_RE.match(s))
+def wait_for_i2c_device(address, port=1, max_retries=10, delay=1):
+ """Waits until an I2C device responds."""
+ for i in range(max_retries):
+ try:
+ import smbus2
+ bus = smbus2.SMBus(port)
+ bus.read_byte(address)
+ bus.close()
+ log(f"I2C device {hex(address)} is available after {i+1} attempts.", False)
+ return True
+ except (FileNotFoundError, OSError):
+ sleep(delay)
+ log(f"Could not find I2C device {hex(address)} after {max_retries} attempts.", False)
+ return False
+
addonname = addon().getAddonInfo('name')
images_dir = join(addon().getAddonInfo('path'), 'resources','images')
fonts_dir = join(addon().getAddonInfo('path'), 'resources','fonts')
@@ -88,6 +103,9 @@
serial = spi(gpio=GPIO, gpio_DC=dc, gpio_RST=rst,device=spidevice, port=spiport)
else: # I2C
from luma.core.interface.serial import i2c
+ # Wait until a I2C device is available
+ if not wait_for_i2c_device(i2caddress, i2cport):
+ raise Exception(f"Cannot connect to OLED display at address {hex(i2caddress)}")
serial = i2c(port = i2cport, address = i2caddress)
import importlib
devmodule = importlib.import_module('luma.oled.device')
@@ -278,7 +296,7 @@
if parts[1:] == [b'0', b'0', b'BLOCK_FILLED']:
clrlines[i] = True
elif x.groups()[2]== b'lineScroller':
- tmp = itm[16:].replace(b'\ ', b'\x1a').replace(b'[ ]', b'[*PROGRESS*]')
+ tmp = itm[16:].replace(b'\\ ', b'\x1a').replace(b'[ ]', b'[*PROGRESS*]')
parts = tmp.split(b' ')
parts[-1] = parts[-1].replace(b'\x1a', b' ').replace(b'\\', b'')
if parts[-1][0]==parts[-1][-1]==34:
@@ -494,4 +512,5 @@
monitor.waitForAbort(10)
log(msg, False)
monitor.stop()
+ import sys
sys.exit()
Display More