From d88e15979081740b86f48a78c81df56f5122a2c4 Mon Sep 17 00:00:00 2001 From: tick Date: Sat, 1 Dec 2007 01:55:39 +0000 Subject: gsmd: Submitting a PIN for authentication needs to respond with status too.(Andrzej Zaborowski) git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@3545 99fdad57-331a-0410-800a-d7fa5415bdb3 --- src/util/pin.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/util/pin.c') diff --git a/src/util/pin.c b/src/util/pin.c index fdd0099..b873535 100644 --- a/src/util/pin.c +++ b/src/util/pin.c @@ -27,24 +27,28 @@ #include #include +#include "shell.h" + #define PIN_SIZE 8 -static char *pin; +static const char *pin; static char pinbuf[PIN_SIZE+1]; static char pinbuf2[PIN_SIZE+1]; -static int pin_handler(struct lgsm_handle *lh, int evt, struct gsmd_evt_auxdata *aux) +static int pin_handler(struct lgsm_handle *lh, + int evt, struct gsmd_evt_auxdata *aux) { int rc; int type = aux->u.pin.type; char *newpin = NULL; - printf("EVENT: PIN request (type='%s') ", lgsm_pin_name(aux->u.pin.type)); + printf("EVENT: PIN request (type='%s') ", lgsm_pin_name(type)); /* FIXME: read pin from STDIN and send it back via lgsm_pin */ if (type == 1 && pin) { printf("Auto-responding with pin `%s'\n", pin); - lgsm_pin(lh, type, pin, NULL); + pending_responses ++; + return lgsm_pin(lh, type, pin, NULL); } else { do { printf("Please enter %s: ", lgsm_pin_name(type)); @@ -64,10 +68,9 @@ static int pin_handler(struct lgsm_handle *lh, int evt, struct gsmd_evt_auxdata break; } + pending_responses ++; return lgsm_pin(lh, type, pinbuf, newpin); } - - return 0; } int pin_init(struct lgsm_handle *lh, const char *pin_preset) -- cgit v1.2.3