- added card_detect_all
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@868 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
5b1eb43b93
commit
69f8588f47
|
@ -101,13 +101,8 @@ CK_RV C_GetSlotList(CK_BBOOL tokenPresent, /* only slots with token prese
|
||||||
int numMatches, i;
|
int numMatches, i;
|
||||||
sc_pkcs11_slot_t *slot;
|
sc_pkcs11_slot_t *slot;
|
||||||
|
|
||||||
if (context == NULL_PTR)
|
|
||||||
return CKR_CRYPTOKI_NOT_INITIALIZED;
|
|
||||||
|
|
||||||
debug(context, "Getting slot listing\n");
|
debug(context, "Getting slot listing\n");
|
||||||
|
card_detect_all();
|
||||||
for (i=0; i<context->reader_count; i++)
|
|
||||||
card_detect(i);
|
|
||||||
|
|
||||||
numMatches = 0;
|
numMatches = 0;
|
||||||
for (i=0; i<SC_PKCS11_MAX_VIRTUAL_SLOTS; i++) {
|
for (i=0; i<SC_PKCS11_MAX_VIRTUAL_SLOTS; i++) {
|
||||||
|
@ -146,9 +141,9 @@ CK_RV C_GetSlotInfo(CK_SLOT_ID slotID, CK_SLOT_INFO_PTR pInfo)
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
if (!slot->card) {
|
if (!slot->card) {
|
||||||
int i;
|
rv = card_detect_all();
|
||||||
for (i=0; i<context->reader_count; i++)
|
if (rv != CKR_OK)
|
||||||
card_detect(i);
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
debug(context, "Getting info about slot %d\n", slotID);
|
debug(context, "Getting info about slot %d\n", slotID);
|
||||||
|
|
|
@ -287,7 +287,7 @@ void dump_template(const char *info, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCoun
|
||||||
|
|
||||||
/* Slot and card handling functions */
|
/* Slot and card handling functions */
|
||||||
CK_RV card_initialize(int reader);
|
CK_RV card_initialize(int reader);
|
||||||
CK_RV card_detect(int reader);
|
CK_RV card_detect_all(void);
|
||||||
CK_RV card_removed(int reader);
|
CK_RV card_removed(int reader);
|
||||||
CK_RV slot_initialize(int id, struct sc_pkcs11_slot *);
|
CK_RV slot_initialize(int id, struct sc_pkcs11_slot *);
|
||||||
CK_RV slot_get_slot(int id, struct sc_pkcs11_slot **);
|
CK_RV slot_get_slot(int id, struct sc_pkcs11_slot **);
|
||||||
|
|
|
@ -49,7 +49,7 @@ CK_RV card_initialize(int reader)
|
||||||
return CKR_OK;
|
return CKR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
CK_RV card_detect(int reader)
|
static CK_RV card_detect(int reader)
|
||||||
{
|
{
|
||||||
struct sc_pkcs11_card *card;
|
struct sc_pkcs11_card *card;
|
||||||
int rc, rv, i, retry = 1;
|
int rc, rv, i, retry = 1;
|
||||||
|
@ -127,6 +127,16 @@ again: rc = sc_detect_card_presence(context->reader[reader], 0);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CK_RV card_detect_all(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (context == NULL_PTR)
|
||||||
|
return CKR_CRYPTOKI_NOT_INITIALIZED;
|
||||||
|
for (i = 0; i < context->reader_count; i++)
|
||||||
|
card_detect(i);
|
||||||
|
}
|
||||||
|
|
||||||
CK_RV card_removed(int reader)
|
CK_RV card_removed(int reader)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
Loading…
Reference in New Issue