1
# -*- coding: utf-8 -*-
3
#Módulo gempluscardreader- Módulo que implementa el "actor hardware" para los
4
#lectores de tarjetas Gemplus GemPC Twin.
7
# David Amián Valle <amialinux@gmail.com
9
# [es] Modulo gempluscardreader - Implementación del "actor hardware" para
10
# lectores de tarjetas Gemplus GemPC Twin
11
# [en] gempluscardreader Module - Gemplus GemPC Twin cardreader devices Actor
12
# class implementation
14
# Copyright (C) 2009 Junta de Andalucía
16
# ----------------------------[es]---------------------------------------------
18
# Este fichero es parte de Detección de Hardware de Guadalinex V6
20
# Este programa es software libre: puede redistribuirlo y/o modificarlo bajo
21
# los términos de la Licencia Pública General version 3 de GNU según
22
# es publicada por la Free Software Foundation.
24
# Este programa se distribuye con la esperanza de que será útil, pero
25
# SIN NINGUNA GARANTÍA, incluso sin la garantías implicitas de
26
# MERCANTILIZACION, CALIDAD SATISFACTORIA o de CONVENIENCIA PARA UN PROPÓSITO
27
# PARTICULAR. Véase la Licencia Pública General de GNU para más detalles.
29
# Debería haber recibido una copia de la Licencia Pública General
30
# junto con este programa; si no ha sido así,
31
# visite <http://www.gnu.org/licenses/>
32
# o escriba a la Free Software Foundation, Inc.,
33
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
35
# ----------------------------[en]---------------------------------------------
37
# This file is part of Guadalinex V6 Hardware Detection.
39
# This program is free software: you can redistribute it and/or modify it
40
# under the terms of the GNU General Public License version 3, as published
41
# by the Free Software Foundation.
43
# This program is distributed in the hope that it will be useful, but
44
# WITHOUT ANY WARRANTY; without even the implied warranties of
45
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
46
# PURPOSE. See the GNU General Public License for more details.
48
# You should have received a copy of the GNU General Public License
49
# along with this program; if not, visit <http://www.gnu.org/licenses/>
50
# or write to the Free Software Foundation, Inc.,
51
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
57
from deviceactor import PkgDeviceActor
58
from utils.pkginstaller import PkgInstaller
59
from utils import get_sudo
60
from gettext import gettext as _
62
CERTMANAGER_CMD = '/usr/bin/certmanager.py'
65
class Actor(PkgDeviceActor):
67
[es] Implementación de la clase Actor para dispositivos lectores de
68
tarjetas Gemplus GemPC Twin.
69
---------------------------------------------------------------------------
70
[en] Gemplus GemPC Twin cardreader devices Actor class implementation
73
"info.subsystem": "usb_device",
74
"usb_device.vendor_id":0x8E6,
75
"usb_device.product_id":0x3437}
77
__icon_path__ = os.path.abspath('actors/img/gempctwin.png')
78
__iconoff_path__ = os.path.abspath('actors/img/gempctwinoff.png')
79
__device_title__ = _("Gemplus GemPC Twin")
80
__device_conn_description__ = _("Card reader detected")
81
__device_disconn_description__ = _("Card reader disconnected")
86
os.system('%s --install-dnie' % CERTMANAGER_CMD)
88
def configure_ceres():
89
os.system('%s --install-ceres' % CERTMANAGER_CMD)
91
if os.path.exists(CERTMANAGER_CMD):
92
actions[_("Configure DNIe")] = configure_dnie
93
actions[_("Configure FNMT-Ceres card")] = configure_ceres
95
def add_user_to_scard():
97
# The os.getlogin() raises OSError: [Errno 25]
99
user = pwd.getpwuid(os.geteuid())[0]
100
# [es] Obtenemos acceso en modo administrador
101
# [en] get root access
103
cmd = '/usr/bin/gksudo /usr/sbin/adduser %s scard' % user
104
status, output = commands.getstatusoutput(cmd)
105
self.msg_render.show_info(_('Session restart needed'),
106
_('You must restart your session to apply the changes'))
108
status, output = commands.getstatusoutput('/usr/bin/groups')
109
if 'scard' not in output:
110
actions[_("Add user to scard group")] = add_user_to_scard
112
self.msg_render.show(self.__device_title__,
113
self.__device_conn_description__,
114
self.__icon_path__, actions=actions)