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;
|
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");
|
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);
|
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));
|
un_braindead_ify_device(fileno(data->fd));
|
||||||
|
|
||||||
|
|
||||||
if (verbose >= 0)
|
PRINTF("Connected to %s\n", PICCDEV);
|
||||||
printf("Connected to %s\n", PICCDEV);
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ static driver_data_t *scdriver_data = NULL;
|
|||||||
static void daemonize(void);
|
static void daemonize(void);
|
||||||
static void cleanup_exit(int signo);
|
static void cleanup_exit(int signo);
|
||||||
static void cleanup(void);
|
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
|
#if HAVE_WORKING_FORK
|
||||||
@@ -113,19 +113,21 @@ void cleanup(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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;
|
size_t i = 0;
|
||||||
printf("%s", label);
|
if (verbose >= LEVEL_NORMAL) {
|
||||||
while (i < len) {
|
printf("%s", label);
|
||||||
printf("%02X", buf[i]);
|
while (i < len) {
|
||||||
i++;
|
printf("%02X", buf[i]);
|
||||||
if (i%20)
|
i++;
|
||||||
printf(" ");
|
if (i%20)
|
||||||
else if (i != len)
|
printf(" ");
|
||||||
printf("\n");
|
else if (i != len)
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main (int argc, char **argv)
|
int main (int argc, char **argv)
|
||||||
@@ -209,8 +211,7 @@ int main (int argc, char **argv)
|
|||||||
if (!buflen || !buf)
|
if (!buflen || !buf)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (verbose >= 0)
|
hexdump("C-APDU:\n", buf, buflen);
|
||||||
printb("C-APDU:\n", buf, buflen);
|
|
||||||
|
|
||||||
|
|
||||||
/* transmit APDU to card */
|
/* transmit APDU to card */
|
||||||
@@ -221,8 +222,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
|
|
||||||
/* send R-APDU */
|
/* send R-APDU */
|
||||||
if (verbose >= 0)
|
hexdump("R-APDU:\n", outputBuffer, outputLength);
|
||||||
printb("R-APDU:\n", outputBuffer, outputLength);
|
|
||||||
|
|
||||||
if (!rfdriver->send_rapdu(rfdriver_data, outputBuffer, outputLength))
|
if (!rfdriver->send_rapdu(rfdriver_data, outputBuffer, outputLength))
|
||||||
goto err;
|
goto err;
|
||||||
|
|||||||
@@ -58,8 +58,12 @@ extern unsigned int readernum;
|
|||||||
extern struct sc_driver driver_vpcd;
|
extern struct sc_driver driver_vpcd;
|
||||||
extern unsigned int vpcdport;
|
extern unsigned int vpcdport;
|
||||||
|
|
||||||
|
#define LEVEL_NORMAL 0
|
||||||
#define LEVEL_INFO 1
|
#define LEVEL_INFO 1
|
||||||
#define LEVEL_DEBUG 2
|
#define LEVEL_DEBUG 2
|
||||||
|
#define PRINTF(...) \
|
||||||
|
{if (verbose >= LEVEL_DEBUG) \
|
||||||
|
printf (__VA_ARGS__);}
|
||||||
#define DEBUG(...) \
|
#define DEBUG(...) \
|
||||||
{if (verbose >= LEVEL_DEBUG) \
|
{if (verbose >= LEVEL_DEBUG) \
|
||||||
printf (__VA_ARGS__);}
|
printf (__VA_ARGS__);}
|
||||||
|
|||||||
Reference in New Issue
Block a user