Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FD628 Display support to Libreelec 7.0 #22

Open
wants to merge 2 commits into
base: libreelec-7.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/addons/service/fd628/changelog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
100
- Initial add-on
Binary file added packages/addons/service/fd628/icon/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions packages/addons/service/fd628/package.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2018-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################

PKG_NAME="fd628"
PKG_VERSION="1.0"
PKG_REV="100"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="https://libreelec.tv"
PKG_URL=""
PKG_DEPENDS_TARGET="toolchain"
PKG_SECTION="service"
PKG_SHORTDESC="fd628: Kodi service to light up additional icons on devices with FD628 display"
PKG_LONGDESC="fd628: Kodi service to light up additional icons on devices with FD628 display"
PKG_TOOLCHAIN="manual"

PKG_IS_ADDON="yes"
PKG_AUTORECONF="no"
PKG_ADDON_NAME="service.fd628"
PKG_ADDON_PROJECTS="S905"
PKG_ADDON_TYPE="xbmc.service"
PKG_ADDON_REPOVERSION="7.0"

make_target() {
$SED -e "s|@PKG_VERSION@|$PKG_VERSION|g" \
-i addon.xml
}

makeinstall_target() {
: # nop
}

addon() {
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID
cp -R $PKG_BUILD/* $ADDON_BUILD/$PKG_ADDON_ID
}
22 changes: 22 additions & 0 deletions packages/addons/service/fd628/sources/addon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="service.fd628"
name="FD628 Display"
version="@PKG_VERSION@"
provider-name="Team LibreELEC">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
</requires>
<extension point="xbmc.service"
library="default.py"
start="startup">
</extension>
<extension point="xbmc.addon.metadata">
<summary>Service for controlling FD628 VFD display icons</summary>
<description>Service for controlling FD628 VFD display icons, e.g. Ethernet/WiFi connection status and Time</description>
<platform>all</platform>
<assets>
<icon>resources/icon.png</icon>
</assets>
</extension>
</addon>

105 changes: 105 additions & 0 deletions packages/addons/service/fd628/sources/default.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2018-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################

import datetime
import xbmcgui
import xbmcaddon
import threading
import time
import sys
import os
import subprocess

addon = xbmcaddon.Addon(id='service.fd628')

class clockThreadClass(threading.Thread):
def run(self):
self.shutdown = False
while not self.shutdown:
vfdon = '/sys/class/leds/fd628_dev/led_on'
vfdoff = '/sys/class/leds/fd628_dev/led_off'
ledon = []
ledoff = []
play = pause = lanstate = lan = wifistate = wifi = ""
sd_state = sd = usb_state = usb = ''
play = xbmc.getCondVisibility('Player.Playing')
pause = xbmc.getCondVisibility('Player.Paused')
if ( os.path.isfile('/sys/class/amhdmitx/amhdmitx0/hpd_state')):
hpd_state = file('/sys/class/amhdmitx/amhdmitx0/hpd_state', "rb")
hpdstate = hpd_state.read()
p = subprocess.Popen('blkid /dev/sd*', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for line in p.stdout.readlines():
usb_state += line
retval = p.wait()
p = subprocess.Popen('blkid /dev/mmcblk* | grep " UUID"', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for line in p.stdout.readlines():
sd_state += line
retval = p.wait()
if ( os.path.isfile('/sys/class/net/eth0/operstate')):
lanstate = file('/sys/class/net/eth0/operstate', 'rb')
lan = lanstate.read()
if ( os.path.isfile('/sys/class/net/wlan0/operstate')):
wifistate = file('/sys/class/net/wlan0/operstate', 'rb')
wifi = wifistate.read()
if len(usb_state) > 0 :
ledon.append('usb')
else:
ledoff.append('usb')
if len(sd_state) > 0 :
ledon.append('sd')
else:
ledoff.append('sd')
if (hpdstate == '1'):
ledon.append('hdmi')
else:
ledoff.append('hdmi')
if (lan.find('up')>=0 or lan.find('unknown')>=0):
ledon.append('eth')
else:
ledoff.append('eth')
if (wifi.find('up')>=0):
ledon.append('wifi')
else:
ledoff.append('wifi')
if pause == True:
ledon.append('pause')
else:
ledoff.append('pause')
if play == True:
ledon.append('play')
else:
ledoff.append('play')
for i in ledon:
vfd = file(vfdon, "wb")
vfd.write(i)
vfd.flush()
for j in ledoff:
vfd = file(vfdoff, "wb")
vfd.write(j)
vfd.flush()
time.sleep(0.5)

class ClockDialog:
def __init__(self):
self.clockThread = clockThreadClass()
self.clockThread.start()

dialog = ClockDialog()
del dialog
del addon

60 changes: 60 additions & 0 deletions packages/linux-drivers/fd628-aml/package.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2018-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################

PKG_NAME="fd628-aml"
PKG_VERSION="6993a86"
PKG_SHA256="5eb30d485d23c9be427528b3604d564565194f759281677c2b1b66419e6edc15"
PKG_ARCH="arm aarch64"
PKG_LICENSE="GPL"
PKG_SITE="https://github.com/arthur-liberman/linux_fd628"
PKG_URL="https://github.com/arthur-liberman/linux_fd628/archive/$PKG_VERSION.tar.gz"
PKG_SOURCE_DIR="linux_fd628-$PKG_VERSION*"
PKG_DEPENDS_TARGET="toolchain linux"
PKG_NEED_UNPACK="$LINUX_DEPENDS"
PKG_SECTION="driver"
PKG_SHORTDESC="fd628-aml: Driver for Amlogic FD628 display"
PKG_LONGDESC="fd628-aml: Driver for Amlogic FD628 display"

PKG_TOOLCHAIN="manual"

if [ "$TARGET_KERNEL_ARCH" = "arm64" -a "$TARGET_ARCH" = "arm" ]; then
PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET gcc-linaro-aarch64-linux-gnu:host"
export PATH=$ROOT/$TOOLCHAIN/lib/gcc-linaro-aarch64-linux-gnu/bin/:$ROOT/$TOOLCHAIN/bin/:$PATH
fi

pre_make_target() {
unset LDFLAGS
}

make_target() {
make -C $(kernel_path) M=$ROOT/$PKG_BUILD/driver

make FD628Service
}

makeinstall_target() {
mkdir -p $INSTALL/lib/modules/$(get_module_dir)/$PKG_NAME
find $ROOT/$PKG_BUILD/ -name \*.ko -not -path '*/\.*' -exec cp {} $INSTALL/lib/modules/$(get_module_dir)/$PKG_NAME \;

mkdir -p $INSTALL/usr/sbin
cp -P FD628Service $INSTALL/usr/sbin
}

post_install() {
enable_service fd628.service
}
6 changes: 6 additions & 0 deletions packages/linux-drivers/fd628-aml/sources/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
default:
obj-m += driver/aml_fd628.o
$(MAKE) modules

FD628Service: FD628Service.c
$(CC) $(CFLAGS) -Wall -w -o $@ $^ -lm -lpthread
12 changes: 12 additions & 0 deletions packages/linux-drivers/fd628-aml/system.d/fd628.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=Amlogic FD628 Service
ConditionPathExists=/proc/device-tree/fd628_dev

[Service]
Type=oneshot
ExecStart=/sbin/modprobe aml_fd628
ExecStart=/usr/sbin/FD628Service
RemainAfterExit=yes

[Install]
WantedBy=basic.target
2 changes: 1 addition & 1 deletion packages/x11/font/liberation-fonts-ttf/package.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="OFL1_1"
PKG_SITE="https://www.redhat.com/promo/fonts/"
PKG_URL="https://fedorahosted.org/releases/l/i/liberation-fonts/$PKG_NAME-$PKG_VERSION.tar.gz"
PKG_URL="http://sources.libreelec.tv/mirror/liberation-fonts-ttf/liberation-fonts-ttf-2.00.1.tar.gz"
PKG_DEPENDS_TARGET="toolchain util-macros"
PKG_PRIORITY="optional"
PKG_SECTION="x11/fonts"
Expand Down
2 changes: 1 addition & 1 deletion projects/S905/options
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
# for a list of additinoal drivers see packages/linux-drivers
# Space separated list is supported,
# e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2"
ADDITIONAL_DRIVERS="RTL8192CU RTL8192DU RTL8192EU RTL8812AU gpu-aml qca9377-aml media_build mt7601u-aml mt7603u-aml"
ADDITIONAL_DRIVERS="RTL8192CU RTL8192DU RTL8192EU RTL8812AU gpu-aml qca9377-aml media_build mt7601u-aml mt7603u-aml fd628-aml"

# additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware)
# Space separated list is supported,
Expand Down