dispmanx_vnc: move config to addon

This commit is contained in:
jc 2016-05-03 18:17:14 +02:00
parent 15d32f0194
commit 4a01aca5c1
8 changed files with 129 additions and 26 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -17,27 +17,24 @@
################################################################################
PKG_NAME="dispmanx_vnc"
PKG_ADDON_NAME="Raspberry Pi VNC"
PKG_VERSION="78e6673"
PKG_REV="100"
PKG_ARCH="arm"
PKG_ADDON_PROJECTS="RPi RPi2"
PKG_LICENSE="OSS"
PKG_SITE="https://github.com/patrikolausson/dispmanx_vnc"
PKG_URL="https://github.com/patrikolausson/dispmanx_vnc/archive/$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain libvncserver bcm2835-bootloader libconfig"
PKG_PRIORITY="optional"
PKG_SECTION="service/system"
PKG_SHORTDESC="VNC Server for Raspberry PI using dispmanx"
PKG_LONGDESC="VNC Server for Raspberry PI using dispmanx"
PKG_IS_ADDON="yes"
PKG_ADDON_TYPE="xbmc.service"
PKG_ADDON_PROVIDES=""
PKG_ADDON_PROJECTS="RPi RPi2"
PKG_ADDON_REPOVERSION="8.0"
PKG_SHORTDESC="VNC Server for Raspberry Pi"
PKG_LONGDESC="VNC Server for Raspberry Pi using dispmanx"
PKG_AUTORECONF="no"
PKG_IS_ADDON="yes"
PKG_ADDON_NAME="Raspberry Pi VNC"
PKG_ADDON_TYPE="xbmc.service"
PKG_ADDON_REPOVERSION="8.0"
PKG_MAINTAINER="Anton Voyl (awiouy at gmail dot com)"
pre_make_target() {
@ -51,7 +48,4 @@ makeinstall_target() {
addon() {
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin
cp -p $PKG_BUILD/dispmanx_vncserver $ADDON_BUILD/$PKG_ADDON_ID/bin
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/config
cp $PKG_DIR/source/config/dispmanx_vncserver.conf $ADDON_BUILD/$PKG_ADDON_ID/config/
}

View File

@ -19,9 +19,37 @@
. /etc/profile
oe_setup_addon service.system.dispmanx_vnc
if [ ! -f "$ADDON_HOME/dispmanx_vncserver.conf" ]; then
cp $ADDON_DIR/config/dispmanx_vncserver.conf $ADDON_HOME/
if [ -f "$ADDON_HOME/dispmanx_vncserver.conf" ]; then
rm "$ADDON_HOME/dispmanx_vncserver.conf"
fi
/bin/sleep 10
dispmanx_vncserver --config-file="$ADDON_HOME/dispmanx_vncserver.conf"
options="-p $vnc_port -s $vnc_screen -t $vnc_framerate"
if [ "$vnc_relative" == "true" ]
then
options="$options -r"
else
options="$options -a"
fi
if [ "$vnc_unsafe" == "true" ]
then
options="$options -u"
fi
if [ "$vnc_fullscreen" == "true" ]
then
options="$options -f"
fi
if [ "$vnc_multithreaded" == "true" ]
then
options="$options -m"
fi
if [ ! -z "$vnc_password" ]
then
options="$options -P $vnc_password"
fi
if [ "$vnc_downscale" == "true" ]
then
options="$options -d"
fi
#/bin/sleep 10
dispmanx_vncserver $options

View File

@ -1,9 +0,0 @@
relative = false;
port = 5900;
screen = 0;
unsafe = false;
fullscreen = true;
multi-threaded = false;
password = "";
frame-rate = 15;
downscale = false;

View File

@ -15,3 +15,22 @@
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
import subprocess
import xbmc
import xbmcaddon
class Monitor(xbmc.Monitor):
def __init__(self, *args, **kwargs):
xbmc.Monitor.__init__(self)
self.id = xbmcaddon.Addon().getAddonInfo('id')
def onSettingsChanged(self):
subprocess.call(['systemctl', 'restart', self.id])
if __name__ == "__main__":
Monitor().waitForAbort()

View File

@ -0,0 +1,46 @@
# Kodi Media Center language file
# Addon Name: dispmanx_vnc
# Addon id: service.system.dispmanx_vnc
# Addon Provider: awiouy at gmail dot com
msgid ""
msgstr ""
msgctxt "#30000"
msgid "Configuration"
msgstr ""
msgctxt "#30001"
msgid "relative"
msgstr ""
msgctxt "#30002"
msgid "port"
msgstr ""
msgctxt "#30003"
msgid "screen"
msgstr ""
msgctxt "#30004"
msgid "unsafe"
msgstr ""
msgctxt "#30005"
msgid "fullscreen"
msgstr ""
msgctxt "#30006"
msgid "multi-threaded"
msgstr ""
msgctxt "#30007"
msgid "password"
msgstr ""
msgctxt "#30008"
msgid "frame-rate"
msgstr ""
msgctxt "#30009"
msgid "downscale"
msgstr ""

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<category label="30000">
<setting label="30001" id="vnc_relative" type="bool" default="false" />
<setting label="30002" id="vnc_port" type="number" default="5900" />
<setting label="30003" id="vnc_screen" type="number" default="0" />
<setting label="30004" id="vnc_unsafe" type="bool" default="false" />
<setting label="30005" id="vnc_fullscreen" type="bool" default="false" />
<setting label="30006" id="vnc_multithreaded" type="bool" default="false" />
<setting label="30007" id="vnc_password" type="text" option="hidden" />
<setting label="30008" id="vnc_framerate" type="number" default="15" />
<setting label="30009" id="vnc_downscale" type="bool" default="false" />
</category>
</settings>

View File

@ -0,0 +1,11 @@
<settings>
<setting id="vnc_downscale" value="false" />
<setting id="vnc_framerate" value="15" />
<setting id="vnc_fullscreen" value="false" />
<setting id="vnc_multithreaded" value="false" />
<setting id="vnc_password" value="" />
<setting id="vnc_port" value="5900" />
<setting id="vnc_relative" value="false" />
<setting id="vnc_screen" value="0" />
<setting id="vnc_unsafe" value="false" />
</settings>