diff options
author | Robert Relyea <rrelyea@redhat.com> | 2010-08-05 10:18:26 +0300 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2010-08-05 10:18:26 +0300 |
commit | d561895862eb34615cc3812a57af493ace266607 (patch) | |
tree | 8f84ad991b14e69c5394d1abb87cf69e4d07c407 /vcard.c | |
parent | b953e440c2b323ee8cdb35c74f7886fd9c547f16 (diff) |
README, soft card updates, pin fix, applet reset, manual insert and remove.
1. Updated and more detailed README. I presume this would be helpful in
putting things upstream.
2. I've added a parser to take some arguments to initialize soft cards.
Unfortunately it's completely untested, so I haven't hooked it up.
3. Patches to fix two of the problems you found this morning (pin
problems and no applet reset).
4. A little more indirection so that new card types can be added without
touching a lot of code (README has instructions). This added 2 new files.
5. I've added the ability to manually insert and remove inserted cards
from vscclient.c as commands from standard in. This too is untested, so
if things go south, this is the first patch to back out.
Diffstat (limited to 'vcard.c')
-rw-r--r-- | vcard.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -10,6 +10,7 @@ struct VCardAppletStruct { VCardApplet *next; VCardProcessAPDU process_apdu; + VCardResetApplet reset_applet; unsigned char *aid; int aid_len; void *applet_private; @@ -84,7 +85,8 @@ vcard_reset(VCard *card, VCardPower power) */ /* constructor */ VCardApplet * -vcard_new_applet(VCardProcessAPDU applet_process_function, unsigned char *aid, int aid_len) +vcard_new_applet(VCardProcessAPDU applet_process_function, VCardResetApplet applet_reset_function, + unsigned char *aid, int aid_len) { VCardApplet *applet; @@ -96,6 +98,7 @@ vcard_new_applet(VCardProcessAPDU applet_process_function, unsigned char *aid, i applet->applet_private = NULL; applet->applet_private_free = NULL; applet->process_apdu = applet_process_function; + applet->reset_applet = applet_reset_function; applet->aid = (char *)malloc(aid_len); if (applet->aid == NULL) { @@ -128,7 +131,7 @@ vcard_delete_applet(VCardApplet *applet) /* accessor */ void vcard_set_applet_private(VCardApplet *applet, VCardAppletPrivate *private, - VCardAppletPrivateFree private_free) + VCardAppletPrivateFree private_free) { if (applet->applet_private_free) { applet->applet_private_free(applet->applet_private); @@ -146,7 +149,7 @@ vcard_new(VCardEmul *private, VCardEmulFree private_free) new_card = (VCard *)malloc(sizeof(VCard)); new_card->applet_list = NULL; for (i=0; i < MAX_CHANNEL; i++) { - new_card->current_applet[i] = NULL; + new_card->current_applet[i] = NULL; } new_card->vcard_buffer_response = NULL; new_card->type = VCARD_VM; @@ -228,6 +231,10 @@ vcard_select_applet(VCard *card, int channel, VCardApplet *applet) { ASSERT(channel < MAX_CHANNEL); card->current_applet[channel] = applet; + /* reset the applet */ + if (applet->reset_applet) { + applet->reset_applet(card, channel); + } } VCardAppletPrivate * |