Merge pull request #2419 from adamg88/le90_fd628_service

fd628: new kodi service package to compliment fd628-aml driver
This commit is contained in:
Christian Hewitt 2018-01-20 05:59:08 +04:00 committed by GitHub
commit f4d7d88be2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 173 additions and 1 deletions

View File

@ -0,0 +1,2 @@
100
- Initial add-on

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -0,0 +1,45 @@
################################################################################
# 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_ADDON_NAME="service.fd628"
PKG_ADDON_PROJECTS="S905"
PKG_ADDON_TYPE="xbmc.service"
make_target() {
$SED -e "s|@PKG_VERSION@|$PKG_VERSION|g" \
-i addon.xml
}
addon() {
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID
cp -R $PKG_BUILD/* $ADDON_BUILD/$PKG_ADDON_ID
}

View File

@ -0,0 +1,21 @@
<?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>

View File

@ -0,0 +1,104 @@
################################################################################
# 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

View File

@ -37,7 +37,7 @@ pre_make_target() {
} }
make_target() { make_target() {
make -C $(kernel_path) M=$PKG_BUILD/driver make -C "$(kernel_path)" M="$PKG_BUILD/driver"
make FD628Service make FD628Service
} }