added LEVEL_NORMAL for in interactive mode
This commit is contained in:
@@ -146,8 +146,7 @@ static int lnfc_connect(driver_data_t **driver_data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (verbose >= 0)
|
||||
printf("Connected to %s\n", nfc_device_get_name(data->pndTarget));
|
||||
PRINTF("Connected to %s\n", nfc_device_get_name(data->pndTarget));
|
||||
|
||||
DEBUG("Waiting for a command that is not part of the anti-collision...\n");
|
||||
data->iCapduLen = nfc_target_init(data->pndTarget, &ntEmulatedTarget, data->abtCapdu, sizeof data->abtCapdu, 0);
|
||||
|
||||
@@ -172,8 +172,7 @@ static int picc_connect(driver_data_t **driver_data)
|
||||
un_braindead_ify_device(fileno(data->fd));
|
||||
|
||||
|
||||
if (verbose >= 0)
|
||||
printf("Connected to %s\n", PICCDEV);
|
||||
PRINTF("Connected to %s\n", PICCDEV);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ static driver_data_t *scdriver_data = NULL;
|
||||
static void daemonize(void);
|
||||
static void cleanup_exit(int signo);
|
||||
static void cleanup(void);
|
||||
static void printb(const char *label, unsigned char *buf, size_t len);
|
||||
static void hexdump(const char *label, unsigned char *buf, size_t len);
|
||||
|
||||
|
||||
#if HAVE_WORKING_FORK
|
||||
@@ -113,19 +113,21 @@ void cleanup(void) {
|
||||
}
|
||||
|
||||
void
|
||||
printb(const char *label, unsigned char *buf, size_t len)
|
||||
hexdump(const char *label, unsigned char *buf, size_t len)
|
||||
{
|
||||
size_t i = 0;
|
||||
printf("%s", label);
|
||||
while (i < len) {
|
||||
printf("%02X", buf[i]);
|
||||
i++;
|
||||
if (i%20)
|
||||
printf(" ");
|
||||
else if (i != len)
|
||||
printf("\n");
|
||||
if (verbose >= LEVEL_NORMAL) {
|
||||
printf("%s", label);
|
||||
while (i < len) {
|
||||
printf("%02X", buf[i]);
|
||||
i++;
|
||||
if (i%20)
|
||||
printf(" ");
|
||||
else if (i != len)
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
@@ -209,8 +211,7 @@ int main (int argc, char **argv)
|
||||
if (!buflen || !buf)
|
||||
continue;
|
||||
|
||||
if (verbose >= 0)
|
||||
printb("C-APDU:\n", buf, buflen);
|
||||
hexdump("C-APDU:\n", buf, buflen);
|
||||
|
||||
|
||||
/* transmit APDU to card */
|
||||
@@ -221,8 +222,7 @@ int main (int argc, char **argv)
|
||||
|
||||
|
||||
/* send R-APDU */
|
||||
if (verbose >= 0)
|
||||
printb("R-APDU:\n", outputBuffer, outputLength);
|
||||
hexdump("R-APDU:\n", outputBuffer, outputLength);
|
||||
|
||||
if (!rfdriver->send_rapdu(rfdriver_data, outputBuffer, outputLength))
|
||||
goto err;
|
||||
|
||||
@@ -58,8 +58,12 @@ extern unsigned int readernum;
|
||||
extern struct sc_driver driver_vpcd;
|
||||
extern unsigned int vpcdport;
|
||||
|
||||
#define LEVEL_NORMAL 0
|
||||
#define LEVEL_INFO 1
|
||||
#define LEVEL_DEBUG 2
|
||||
#define PRINTF(...) \
|
||||
{if (verbose >= LEVEL_DEBUG) \
|
||||
printf (__VA_ARGS__);}
|
||||
#define DEBUG(...) \
|
||||
{if (verbose >= LEVEL_DEBUG) \
|
||||
printf (__VA_ARGS__);}
|
||||
|
||||
Reference in New Issue
Block a user