2001-12-25 20:45:48 +00:00
|
|
|
/*
|
2002-01-08 13:56:50 +00:00
|
|
|
* card-default.c: Support for cards with no driver
|
2001-12-25 20:45:48 +00:00
|
|
|
*
|
2006-12-19 21:32:31 +00:00
|
|
|
* Copyright (C) 2001, 2002 Juha Yrjölä <juha.yrjola@iki.fi>
|
2001-12-25 20:45:48 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
2015-04-22 21:55:33 +00:00
|
|
|
#if HAVE_CONFIG_H
|
2010-03-04 08:14:36 +00:00
|
|
|
#include "config.h"
|
2015-04-22 21:55:33 +00:00
|
|
|
#endif
|
2010-03-04 08:14:36 +00:00
|
|
|
|
2004-01-29 09:36:48 +00:00
|
|
|
#include <string.h>
|
2001-12-25 20:45:48 +00:00
|
|
|
|
2010-03-04 08:14:36 +00:00
|
|
|
#include "internal.h"
|
|
|
|
|
2001-12-25 20:45:48 +00:00
|
|
|
static struct sc_card_operations default_ops;
|
2003-02-20 12:51:07 +00:00
|
|
|
static struct sc_card_driver default_drv = {
|
2001-12-25 20:45:48 +00:00
|
|
|
"Default driver for unknown cards",
|
2002-01-08 13:56:50 +00:00
|
|
|
"default",
|
2005-09-07 08:33:55 +00:00
|
|
|
&default_ops,
|
|
|
|
NULL, 0, NULL
|
2001-12-25 20:45:48 +00:00
|
|
|
};
|
|
|
|
|
2013-08-02 20:01:51 +00:00
|
|
|
|
|
|
|
static int
|
|
|
|
default_match_card(struct sc_card *card)
|
2001-12-25 20:45:48 +00:00
|
|
|
{
|
|
|
|
return 1; /* always match */
|
|
|
|
}
|
|
|
|
|
2013-08-02 20:01:51 +00:00
|
|
|
static int
|
|
|
|
default_init(struct sc_card *card)
|
2001-12-25 20:45:48 +00:00
|
|
|
{
|
2013-08-02 20:01:51 +00:00
|
|
|
LOG_FUNC_CALLED(card->ctx);
|
|
|
|
|
2009-11-13 19:01:21 +00:00
|
|
|
card->name = "Unsupported card";
|
2002-02-24 19:32:14 +00:00
|
|
|
card->drv_data = NULL;
|
2001-12-25 20:45:48 +00:00
|
|
|
|
2013-08-02 20:01:51 +00:00
|
|
|
LOG_FUNC_RETURN(card->ctx, SC_SUCCESS);
|
2001-12-25 20:45:48 +00:00
|
|
|
}
|
|
|
|
|
2003-02-20 12:51:07 +00:00
|
|
|
static struct sc_card_driver * sc_get_driver(void)
|
2001-12-25 20:45:48 +00:00
|
|
|
{
|
2003-02-20 12:51:07 +00:00
|
|
|
struct sc_card_driver *iso_drv = sc_get_iso7816_driver();
|
2001-12-25 20:45:48 +00:00
|
|
|
|
|
|
|
default_ops = *iso_drv->ops;
|
|
|
|
default_ops.match_card = default_match_card;
|
|
|
|
default_ops.init = default_init;
|
|
|
|
|
2002-10-19 14:04:52 +00:00
|
|
|
return &default_drv;
|
2001-12-25 20:45:48 +00:00
|
|
|
}
|
|
|
|
|
2003-02-20 12:51:07 +00:00
|
|
|
struct sc_card_driver * sc_get_default_driver(void)
|
2001-12-25 20:45:48 +00:00
|
|
|
{
|
|
|
|
return sc_get_driver();
|
|
|
|
}
|