diff --git a/packages/addons/service/pcscd/changelog.txt b/packages/addons/service/pcscd/changelog.txt new file mode 100644 index 0000000000..b98fd1d7eb --- /dev/null +++ b/packages/addons/service/pcscd/changelog.txt @@ -0,0 +1,2 @@ +100 +- initial addon \ No newline at end of file diff --git a/packages/addons/service/pcscd/config/reader.conf b/packages/addons/service/pcscd/config/reader.conf new file mode 100644 index 0000000000..d9991a666c --- /dev/null +++ b/packages/addons/service/pcscd/config/reader.conf @@ -0,0 +1,10 @@ +# Gemalto reader with serial communication +# - n is the serial port to use n in [0..3] +# - reader is the reader name. It is needed for multi-slot readers. +# Possible reader values are: GemPCPinPad, GemCorePOSPro, GemCoreSIMPro, +# GemPCTwin (default value) +# example: /dev/ttyS0:GemPCPinPad +#FRIENDLYNAME "GemPCTwin serial" +#DEVICENAME /dev/ttySn[:reader] +#LIBPATH /storage/.kodi/addons/service.pcscd/drivers/serial/libccidtwin.so +#CHANNELID n diff --git a/packages/addons/service/pcscd/icon/icon.png b/packages/addons/service/pcscd/icon/icon.png new file mode 100755 index 0000000000..222be49f4b Binary files /dev/null and b/packages/addons/service/pcscd/icon/icon.png differ diff --git a/packages/addons/service/pcscd/package.mk b/packages/addons/service/pcscd/package.mk new file mode 100644 index 0000000000..b02f55439d --- /dev/null +++ b/packages/addons/service/pcscd/package.mk @@ -0,0 +1,59 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2017-present Team LibreELEC +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2011-2011 Gregor Fuis (gujs@openelec.tv) +# +# 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 . +################################################################################ + +PKG_NAME="pcscd" +PKG_VERSION="1.0" +PKG_REV="100" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://libreelec.tv" +PKG_URL="" +PKG_DEPENDS_TARGET="toolchain pcsc-lite libusb ccid" +PKG_SECTION="service" +PKG_SHORTDESC="Middleware to access a smart card using SCard API (PC/SC)" +PKG_LONGDESC="Middleware to access a smart card using SCard API (PC/SC)" +PKG_AUTORECONF="no" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="PC/SC Smart Card Daemon" +PKG_ADDON_TYPE="xbmc.service" + +make_target() { + : +} + +makeinstall_target() { + : +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin/ + cp -Pa $(get_build_dir pcsc-lite)/.install_pkg/usr/sbin/pcscd $ADDON_BUILD/$PKG_ADDON_ID/bin/pcscd.bin + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/drivers/serial + cp -Pa $(get_build_dir ccid)/.$TARGET_NAME/src/.libs/libccidtwin.so $ADDON_BUILD/$PKG_ADDON_ID/drivers/serial + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/drivers/ifd-ccid.bundle/Contents/Linux/ + cp -Pa $(get_build_dir ccid)/.$TARGET_NAME/src/.libs/libccid.so $ADDON_BUILD/$PKG_ADDON_ID/drivers/ifd-ccid.bundle/Contents/Linux/ + cp -Pa $(get_build_dir ccid)/.$TARGET_NAME/src/Info.plist $ADDON_BUILD/$PKG_ADDON_ID/drivers/ifd-ccid.bundle/Contents + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/config + cp -Pa $PKG_DIR/config/* $ADDON_BUILD/$PKG_ADDON_ID/config/ +} diff --git a/packages/addons/service/pcscd/source/bin/pcscd.start b/packages/addons/service/pcscd/source/bin/pcscd.start new file mode 100755 index 0000000000..4eb58f0ab5 --- /dev/null +++ b/packages/addons/service/pcscd/source/bin/pcscd.start @@ -0,0 +1,34 @@ +#!/bin/sh + +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2017-present Team LibreELEC +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# 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 . +################################################################################ + +. /etc/profile + +oe_setup_addon service.pcscd + +mkdir -p $ADDON_HOME/config + +chmod a+x $ADDON_DIR/bin/* + +if [ ! -f "$ADDON_HOME/config/reader.conf" ]; then + cp $ADDON_DIR/config/reader.conf $ADDON_HOME/config/reader.conf +fi + +exec pcscd.bin --foreground -c $ADDON_HOME/config/reader.conf diff --git a/packages/addons/service/pcscd/source/default.py b/packages/addons/service/pcscd/source/default.py new file mode 100644 index 0000000000..c2749857f9 --- /dev/null +++ b/packages/addons/service/pcscd/source/default.py @@ -0,0 +1,35 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2017-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 . +################################################################################ + +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() diff --git a/packages/addons/service/pcscd/source/system.d/service.pcscd.service b/packages/addons/service/pcscd/source/system.d/service.pcscd.service new file mode 100644 index 0000000000..1434d18b61 --- /dev/null +++ b/packages/addons/service/pcscd/source/system.d/service.pcscd.service @@ -0,0 +1,13 @@ +[Unit] +Description=PCSC lite +After=graphical.target + +[Service] +ExecStart=/bin/sh -c "exec sh /storage/.kodi/addons/service.pcscd/bin/pcscd.start" +TimeoutStopSec=1 +Restart=always +RestartSec=2 +StartLimitInterval=0 + +[Install] +WantedBy=kodi.target