diff --git a/packages/addons/service/system/pcscd-addon/addon b/packages/addons/service/system/pcscd-addon/addon new file mode 100755 index 0000000000..72608cf464 --- /dev/null +++ b/packages/addons/service/system/pcscd-addon/addon @@ -0,0 +1,42 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2011-2011 Gregor Fuis (gujs@openelec.tv) +# +# This Program 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, or (at your option) +# any later version. +# +# This Program 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 OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +. config/options $1 + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin/ + + cp -Pa $BUILD/pcsc-lite-*/src/pcscd $ADDON_BUILD/$PKG_ADDON_ID/bin/pcscd.bin + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -Pa $BUILD/pcsc-lite-*/src/.libs/*.so* $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -Pa $BUILD/pcsc-lite-*/src/spy/.libs/*.so* $ADDON_BUILD/$PKG_ADDON_ID/lib + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/drivers/serial + cp -Pa $BUILD/libccid-*/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 $BUILD/libccid-*/src/.libs/libccid.so $ADDON_BUILD/$PKG_ADDON_ID/drivers/ifd-ccid.bundle/Contents/Linux/ + cp -Pa $BUILD/libccid-*/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/system/pcscd-addon/changelog.txt b/packages/addons/service/system/pcscd-addon/changelog.txt new file mode 100644 index 0000000000..1a3d1c4a38 --- /dev/null +++ b/packages/addons/service/system/pcscd-addon/changelog.txt @@ -0,0 +1,2 @@ +2.0.1 +- initial version for pcsc-lite 1.8.2 / ccid 1.4.5 diff --git a/packages/addons/service/system/pcscd-addon/config/reader.conf b/packages/addons/service/system/pcscd-addon/config/reader.conf new file mode 100644 index 0000000000..d984d4a45c --- /dev/null +++ b/packages/addons/service/system/pcscd-addon/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/.xbmc/addons/service.system.pcscd-addon/drivers/serial/libccidtwin.so +#CHANNELID n diff --git a/packages/addons/service/system/pcscd-addon/icon/icon.png b/packages/addons/service/system/pcscd-addon/icon/icon.png new file mode 100644 index 0000000000..41cb661419 Binary files /dev/null and b/packages/addons/service/system/pcscd-addon/icon/icon.png differ diff --git a/packages/addons/service/system/pcscd-addon/meta b/packages/addons/service/system/pcscd-addon/meta new file mode 100755 index 0000000000..4d15b81abc --- /dev/null +++ b/packages/addons/service/system/pcscd-addon/meta @@ -0,0 +1,37 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2011-2011 Gregor Fuis (gujs@openelec.tv) +# +# This Program 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, or (at your option) +# any later version. +# +# This Program 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 OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="pcscd-addon" +PKG_VERSION="2.0" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://www.openelec.tv" +PKG_URL="" +PKG_DEPENDS="" +PKG_BUILD_DEPENDS="toolchain pcsc-lite libusb libccid" +PKG_PRIORITY="optional" +PKG_SECTION="service/system" +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_IS_ADDON="yes" +PKG_ADDON_TYPE="xbmc.service" +PKG_AUTORECONF="no" diff --git a/packages/addons/service/system/pcscd-addon/source/bin/pcscd.start b/packages/addons/service/system/pcscd-addon/source/bin/pcscd.start new file mode 100755 index 0000000000..d79015d41c --- /dev/null +++ b/packages/addons/service/system/pcscd-addon/source/bin/pcscd.start @@ -0,0 +1,55 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program 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, or (at your option) +# any later version. +# +# This Program 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 OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +ADDON_NAME="service.system.pcscd-addon" +ADDON_DIR="$HOME/.xbmc/addons/$ADDON_NAME" +ADDON_HOME="$HOME/.xbmc/userdata/addon_data/$ADDON_NAME" + +ADDON_CONFIG_DIR="$ADDON_HOME/config" + +LOCKDIR="/var/lock/" +LOCKFILE="pcscd.disabled" + +mkdir -p $ADDON_HOME + +export PATH=$ADDON_DIR/bin:$PATH + +cd $ADDON_DIR/config +mkdir -p $ADDON_CONFIG_DIR +for config in `find . -type f -name "*.conf*"`; do + if [ ! -f $ADDON_CONFIG_DIR/$config ]; then + cp $config $ADDON_CONFIG_DIR/$config + fi +done + +if [ ! "$(pidof pcscd.bin)" ];then + if [ -f "$LOCKDIR/$LOCKFILE" ] ; then + rm -rf "$LOCKDIR/$LOCKFILE" + fi + while [ true ] ; do + if [ -f "$LOCKDIR/$LOCKFILE" ] ; then + break + fi + pcscd.bin --foreground -c $ADDON_CONFIG_DIR/reader.conf + sleep 1 + done & +fi diff --git a/packages/addons/service/system/pcscd-addon/source/bin/pcscd.stop b/packages/addons/service/system/pcscd-addon/source/bin/pcscd.stop new file mode 100755 index 0000000000..4722ea09ff --- /dev/null +++ b/packages/addons/service/system/pcscd-addon/source/bin/pcscd.stop @@ -0,0 +1,30 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program 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, or (at your option) +# any later version. +# +# This Program 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 OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +LOCKDIR="/var/lock/" +LOCKFILE="pcscd.disabled" + +if [ "$(pidof pcscd.bin)" ];then + mkdir -p "$LOCKDIR" + touch "$LOCKDIR/$LOCKFILE" + killall -9 pcscd.bin +fi diff --git a/packages/addons/service/system/pcscd-addon/source/default.py b/packages/addons/service/system/pcscd-addon/source/default.py new file mode 100755 index 0000000000..b361cbe120 --- /dev/null +++ b/packages/addons/service/system/pcscd-addon/source/default.py @@ -0,0 +1,44 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# Copyright (C) 2011-2011 Gregor Fuis (gujs@openelec.tv) +# +# This Program 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, or (at your option) +# any later version. +# +# This Program 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 OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +import os +import sys +import xbmcaddon +import time +import subprocess + +__scriptname__ = "PCSC lite" +__author__ = "OpenELEC" +__url__ = "http://www.openelec.tv" +__settings__ = xbmcaddon.Addon(id='service.system.pcscd-addon') +__cwd__ = __settings__.getAddonInfo('path') +__start__ = xbmc.translatePath( os.path.join( __cwd__, 'bin', "pcscd.start") ) +__stop__ = xbmc.translatePath( os.path.join( __cwd__, 'bin', "pcscd.stop") ) + +#make binary files executable in adson bin folder +subprocess.Popen("chmod -R +x " + __cwd__ + "/bin/*" , shell=True, close_fds=True) + +subprocess.Popen(__start__, shell=True, close_fds=True) + +while (not xbmc.abortRequested): + time.sleep(0.250) + +subprocess.Popen(__stop__, shell=True, close_fds=True)