diff --git a/packages/3rdparty/lib/libccid/build b/packages/3rdparty/lib/libccid/build new file mode 100755 index 0000000000..97281294e1 --- /dev/null +++ b/packages/3rdparty/lib/libccid/build @@ -0,0 +1,16 @@ +#!/bin/sh + +. config/options $1 + +cd $PKG_BUILD + +./configure --host=$TARGET_NAME \ + --build=$HOST_NAME \ + --prefix=/usr \ + --enable-shared \ + --enable-static \ + --enable-twinserial + +make +make -C src/ Info.plist +$MAKEINSTALL diff --git a/packages/3rdparty/lib/libccid/meta b/packages/3rdparty/lib/libccid/meta new file mode 100644 index 0000000000..5d6d5d7a2a --- /dev/null +++ b/packages/3rdparty/lib/libccid/meta @@ -0,0 +1,35 @@ +################################################################################ +# 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 +################################################################################ + +PKG_NAME="libccid" +PKG_VERSION="1.4.5" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="LGPL" +PKG_SITE="http://pcsclite.alioth.debian.org/ccid.html" +PKG_URL="https://alioth.debian.org/frs/download.php/3672/${PKG_NAME}-${PKG_VERSION}.tar.bz2" +PKG_DEPENDS="" +PKG_BUILD_DEPENDS="toolchain pcsc-lite" +PKG_PRIORITY="optional" +PKG_SECTION="driver" +PKG_SHORTDESC="CCID free software driver" +PKG_LONGDESC="CCID free software driver" +PKG_IS_ADDON="no" +PKG_AUTORECONF="yes" diff --git a/packages/3rdparty/lib/libccid/rename b/packages/3rdparty/lib/libccid/rename new file mode 100755 index 0000000000..ba366abae7 --- /dev/null +++ b/packages/3rdparty/lib/libccid/rename @@ -0,0 +1,6 @@ +#!/bin/sh + +. config/options $1 + +cd $BUILD +mv ccid-${PKG_VERSION} ${PKG_NAME}-${PKG_VERSION} diff --git a/packages/3rdparty/system/pcsc-lite/build b/packages/3rdparty/system/pcsc-lite/build new file mode 100755 index 0000000000..5bbf10611e --- /dev/null +++ b/packages/3rdparty/system/pcsc-lite/build @@ -0,0 +1,39 @@ +#!/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 +################################################################################ + +. config/options $1 + +cd $PKG_BUILD + +PCSCD_ADDON_DIR="/storage/.xbmc/addons/service.system.pcscd-addon" + +./configure --host=$TARGET_NAME \ + --build=$HOST_NAME \ + --prefix=/usr \ + --sysconfdir=/etc \ + --enable-shared \ + --disable-static \ + --disable-libudev \ + --enable-libusb \ + --enable-usbdropdir=$PCSCD_ADDON_DIR/drivers + +$MAKEINSTALL diff --git a/packages/3rdparty/system/pcsc-lite/meta b/packages/3rdparty/system/pcsc-lite/meta new file mode 100644 index 0000000000..2adb8f57a3 --- /dev/null +++ b/packages/3rdparty/system/pcsc-lite/meta @@ -0,0 +1,36 @@ +################################################################################ +# 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="pcsc-lite" +PKG_VERSION="1.8.2" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://pcsclite.alioth.debian.org/pcsclite.html" +PKG_URL="https://alioth.debian.org/frs/download.php/3695/${PKG_NAME}-${PKG_VERSION}.tar.bz2" +PKG_DEPENDS="" +PKG_BUILD_DEPENDS="toolchain libusb" +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_AUTORECONF="yes" diff --git a/packages/addons/service/softcam/oscam/addon b/packages/addons/service/softcam/oscam/addon index 2c2d406c23..aeea0fff59 100755 --- a/packages/addons/service/softcam/oscam/addon +++ b/packages/addons/service/softcam/oscam/addon @@ -27,4 +27,6 @@ mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin cp -P $PKG_BUILD/build/oscam $ADDON_BUILD/$PKG_ADDON_ID/bin cp -PR $PKG_DIR/config/oscam.conf $ADDON_BUILD/$PKG_ADDON_ID/oscam-default.conf - +mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -aP $BUILD/pcsc-lite-*/src/.libs/libpcsclite.so $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -aP $BUILD/pcsc-lite-*/src/.libs/libpcsclite.so.* $ADDON_BUILD/$PKG_ADDON_ID/lib diff --git a/packages/addons/service/softcam/oscam/build b/packages/addons/service/softcam/oscam/build index ce80afb29f..c1b351c50f 100755 --- a/packages/addons/service/softcam/oscam/build +++ b/packages/addons/service/softcam/oscam/build @@ -33,6 +33,7 @@ cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_CONF \ -DHAVE_DVBAPI=1 -DWITH_STAPI=0 \ -DMODULE_CAMD33=1 \ -DWEBIF=1 \ + -DOPTIONAL_INCLUDE_DIR=$SYSROOT_PREFIX/usr/include \ .. make diff --git a/packages/addons/service/softcam/oscam/changelog.txt b/packages/addons/service/softcam/oscam/changelog.txt index b9bfa0daac..483f29e91e 100644 --- a/packages/addons/service/softcam/oscam/changelog.txt +++ b/packages/addons/service/softcam/oscam/changelog.txt @@ -1,3 +1,6 @@ +2.0.3 +- add pcsc reader support + 2.0.2 - add possibilty to start / stop addon from addon manager with enable / disable diff --git a/packages/addons/service/softcam/oscam/meta b/packages/addons/service/softcam/oscam/meta index 69b7c24882..cd700292e8 100644 --- a/packages/addons/service/softcam/oscam/meta +++ b/packages/addons/service/softcam/oscam/meta @@ -20,14 +20,14 @@ ################################################################################ PKG_NAME="oscam" -PKG_VERSION="6136" -PKG_REV="2" +PKG_VERSION="6472" +PKG_REV="3" PKG_ARCH="any" PKG_LICENSE="GPL" PKG_SITE="http://streamboard.gmc.to/wiki/index.php/OSCam/en" PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.bz2" PKG_DEPENDS="openssl" -PKG_BUILD_DEPENDS="toolchain openssl" +PKG_BUILD_DEPENDS="toolchain openssl pcsc-lite" PKG_PRIORITY="optional" PKG_SECTION="service/softcam" PKG_SHORTDESC="oscam: OSCam is Open Source Conditional Access Modul." diff --git a/packages/addons/service/softcam/oscam/patches/oscam-6136-1-trunk-vdr.patch b/packages/addons/service/softcam/oscam/patches/oscam-6136-1-trunk-vdr.patch deleted file mode 100644 index 26fccad8f8..0000000000 --- a/packages/addons/service/softcam/oscam/patches/oscam-6136-1-trunk-vdr.patch +++ /dev/null @@ -1,73 +0,0 @@ ---- oscam-1.10/module-dvbapi.c 2011-12-08 00:02:39.058737655 +0100 -+++ /emu/backup/oscam-1.10/module-dvbapi.c 2011-12-07 23:35:15.708736813 +0100 -@@ -4,7 +4,7 @@ - - #include "module-dvbapi.h" - --const char *boxdesc[] = { "none", "dreambox", "duckbox", "ufs910", "dbox2", "ipbox", "ipbox-pmt", "dm7000", "qboxhd", "coolstream", "neumo" }; -+const char *boxdesc[] = { "none", "dreambox", "duckbox", "ufs910", "dbox2", "ipbox", "ipbox-pmt", "dm7000", "qboxhd", "coolstream", "neumo", "pc" }; - - const struct box_devices devices[BOX_COUNT] = { - /* QboxHD (dvb-api-3)*/ { "/tmp/virtual_adapter/", "ca%d", "demux%d", "/tmp/camd.socket" }, -@@ -214,6 +214,9 @@ - if (cfg.dvbapi_boxtype==BOXTYPE_QBOXHD) - num=0; - -+ if (cfg.dvbapi_boxtype==BOXTYPE_PC) -+ num=0; -+ - snprintf(device_path2, sizeof(device_path2), devices[selected_box].ca_device, num+ca_offset); - snprintf(device_path, sizeof(device_path), devices[selected_box].path, adapter); - -@@ -1090,6 +1093,12 @@ - adapter_index = buffer[21]; // with STONE 1.0.4 adapter index can be 0,1,2 - ca_mask = (1 << adapter_index); // use adapter_index as ca_mask (used as index for ca_fd[] array) - } -+ -+ if (cfg.dvbapi_boxtype == BOXTYPE_PC ) { -+ demux_index = buffer[6]; // it always 0 but you never know -+ adapter_index = buffer[7]; // adapter index can be 0,1,2 -+ ca_mask = (1 << adapter_index); // use adapter_index as ca_mask (used as index for ca_fd[] array) -+ } - - demux[demux_id].program_number=((buffer[1] << 8) | buffer[2]); - demux[demux_id].demux_index=demux_index; -@@ -1106,10 +1115,10 @@ - cs_strncpy(demux[demux_id].pmt_file, pmtfile, sizeof(demux[demux_id].pmt_file)); - - if (program_info_length > 1 && program_info_length < length) -- dvbapi_parse_descriptor(demux_id, program_info_length-1, buffer+7); -+ dvbapi_parse_descriptor(demux_id, program_info_length-1, buffer+9); - - uint32_t es_info_length=0; -- for (i = program_info_length + 6; i < length; i += es_info_length + 5) { -+ for (i = program_info_length + 8; i < length; i += es_info_length + 5) { - int32_t stream_type = buffer[i]; - uint16_t elementary_pid = ((buffer[i + 1] & 0x1F) << 8) | buffer[i + 2]; - es_info_length = ((buffer[i + 3] & 0x0F) << 8) | buffer[i + 4]; -@@ -1301,9 +1310,10 @@ - if (pthread_mutex_trylock(&event_handler_lock) == EBUSY) - return; - -- int32_t standby_fd = open(STANDBY_FILE, O_RDONLY); -- pausecam = (standby_fd > 0) ? 1 : 0; -- if (standby_fd) close(standby_fd); -+ //int32_t standby_fd = open(STANDBY_FILE, O_RDONLY); -+ //pausecam = (standby_fd > 0) ? 1 : 0; -+ //if (standby_fd) close(standby_fd); -+ pausecam = 0; - - if (cfg.dvbapi_boxtype==BOXTYPE_IPBOX || cfg.dvbapi_pmtmode == 1) { - pthread_mutex_unlock(&event_handler_lock); ---- oscam-1.10/globals.h 2011-12-08 00:02:39.068737655 +0100 -+++ /emu/backup/oscam-1.10/globals.h 2011-12-07 23:34:38.678736793 +0100 -@@ -234,7 +234,8 @@ - #define BOXTYPE_QBOXHD 8 - #define BOXTYPE_COOLSTREAM 9 - #define BOXTYPE_NEUMO 10 --#define BOXTYPES 10 -+#define BOXTYPE_PC 11 -+#define BOXTYPES 11 - extern const char *boxdesc[]; - #endif - diff --git a/packages/addons/service/softcam/oscam/patches/oscam-6136-2-dvbapi_ca.patch b/packages/addons/service/softcam/oscam/patches/oscam-6136-2-dvbapi_ca.patch deleted file mode 100644 index 1eea1ac300..0000000000 --- a/packages/addons/service/softcam/oscam/patches/oscam-6136-2-dvbapi_ca.patch +++ /dev/null @@ -1,104 +0,0 @@ -commit 35ce4dd3c5871b5a700d4e07965d93a561299df0 -Author: Mariusz Bialonczyk -Date: Mon Dec 19 13:45:08 2011 +0100 - - Include dvbapi_ca.c functionality in oscam - -diff --git a/module-dvbapi.c b/module-dvbapi.c -index 89221b1..cfc2c41 100644 ---- a/module-dvbapi.c -+++ b/module-dvbapi.c -@@ -232,6 +232,32 @@ int32_t dvbapi_open_device(int32_t type, int32_t num, int32_t adapter) { - return dmx_fd; - } - -+int32_t dvbapi_open_netdevice(int32_t type, int32_t num, int32_t adapter) { -+ int32_t socket_fd; -+ -+ socket_fd = socket(PF_INET,SOCK_DGRAM,IPPROTO_UDP); -+ if(socket_fd==-1) { -+ cs_debug_mask(D_DVBAPI, "Failed to open socket (%d %s)", errno, strerror(errno)); -+ } -+ else { -+ struct sockaddr_in saddr; -+ fcntl(socket_fd,F_SETFL,O_NONBLOCK); -+ bzero(&saddr,sizeof(saddr)); -+ saddr.sin_family = AF_INET; -+ saddr.sin_port = htons(PORT + adapter); // port = PORT + adapter number -+ saddr.sin_addr.s_addr = inet_addr("127.0.0.1"); -+ int r = connect(socket_fd, (struct sockaddr *) &saddr, sizeof(saddr)); -+ if (r<0) { -+ cs_debug_mask(D_DVBAPI, "Failed to connect socket (%d %s), at localhost, port=%d", errno, strerror(errno), PORT + adapter); -+ close(socket_fd); -+ socket_fd=-1; -+ } -+ } -+ -+ cs_debug_mask(D_DVBAPI, "NET DEVICE open (port = %d) fd %d", PORT + adapter, socket_fd); -+ return socket_fd; -+} -+ - int32_t dvbapi_stop_filter(int32_t demux_index, int32_t type) { - int32_t g; - -@@ -515,16 +541,21 @@ void dvbapi_set_pid(int32_t demux_id, int32_t num, int32_t index) { - for (i=0;i<8;i++) { - if (demux[demux_id].ca_mask & (1 << i)) { - if (ca_fd[i]<=0) -- ca_fd[i]=dvbapi_open_device(1, i, demux[demux_id].adapter_index); -+ ca_fd[i]=dvbapi_open_netdevice(1, i, demux[demux_id].adapter_index); - if (ca_fd[i]>0) { - ca_pid_t ca_pid2; - memset(&ca_pid2,0,sizeof(ca_pid2)); - ca_pid2.pid = demux[demux_id].STREAMpids[num]; - ca_pid2.index = index; -- if (ioctl(ca_fd[i], CA_SET_PID, &ca_pid2)==-1) -- cs_debug_mask(D_DVBAPI, "Error CA_SET_PID pid=0x%04x index=%d (errno=%d %s)", ca_pid2.pid, ca_pid2.index, errno, strerror(errno)); -- else -- cs_debug_mask(D_DVBAPI, "CA_SET_PID pid=0x%04x index=%d", ca_pid2.pid, ca_pid2.index); -+ -+ int request=CA_SET_PID; -+ send(ca_fd[i],(void*)&request, sizeof(request), 0); -+ send(ca_fd[i],(void*)&ca_pid2, sizeof(ca_pid2), 0); -+ -+// if (ioctl(ca_fd[i], CA_SET_PID, &ca_pid2)==-1) -+// cs_debug_mask(D_DVBAPI, "Error CA_SET_PID pid=0x%04x index=%d (errno=%d %s)", ca_pid2.pid, ca_pid2.index, errno, strerror(errno)); -+// else -+// cs_debug_mask(D_DVBAPI, "CA_SET_PID pid=0x%04x index=%d", ca_pid2.pid, ca_pid2.index); - } - } - } -@@ -1836,13 +1867,17 @@ static void dvbapi_write_cw(int32_t demux_id, uchar *cw, int32_t index) { - if (demux[demux_id].ca_mask & (1 << i)) { - cs_debug_mask(D_DVBAPI, "write cw%d index: %d (ca%d)", n, ca_descr.index, i); - if (ca_fd[i]<=0) { -- ca_fd[i]=dvbapi_open_device(1, i, demux[demux_id].adapter_index); -+ ca_fd[i]=dvbapi_open_netdevice(1, i, demux[demux_id].adapter_index); - if (ca_fd[i]<=0) - return; - } - -- if (ioctl(ca_fd[i], CA_SET_DESCR, &ca_descr) < 0) -- cs_debug_mask(D_DVBAPI, "Error CA_SET_DESCR"); -+ int request=CA_SET_DESCR; -+ send(ca_fd[i],(void*)&request, sizeof(request), 0); -+ send(ca_fd[i],(void*)&ca_descr, sizeof(ca_descr), 0); -+ -+// if (ioctl(ca_fd[i], CA_SET_DESCR, &ca_descr) < 0) -+// cs_debug_mask(D_DVBAPI, "Error CA_SET_DESCR"); - } - } - #endif -diff --git a/module-dvbapi.h b/module-dvbapi.h -index 2802b03..8720b01 100644 ---- a/module-dvbapi.h -+++ b/module-dvbapi.h -@@ -16,6 +16,8 @@ - #define STAPI 2 - #define COOLAPI 3 - -+#define PORT 9000 -+ - #define TMPDIR "/tmp/" - #define STANDBY_FILE "/tmp/.pauseoscam" - #define ECMINFO_FILE "/tmp/ecm.info" diff --git a/packages/addons/service/softcam/oscam/source/bin/oscam.start b/packages/addons/service/softcam/oscam/source/bin/oscam.start index 2ceaa0ddfa..9cc46920ab 100755 --- a/packages/addons/service/softcam/oscam/source/bin/oscam.start +++ b/packages/addons/service/softcam/oscam/source/bin/oscam.start @@ -79,7 +79,7 @@ if [ ! "$(pidof oscam)" ]; then if [ -f "$LOCKDIR/$LOCKFILE" ] ; then break fi - oscam $OSCAM_ARG > /dev/null 2>&1 + LD_LIBRARY_PATH="$ADDON_DIR/lib:$LD_LIBRARY_PATH" oscam $OSCAM_ARG > /dev/null 2>&1 sleep 1 done & fi 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)