mirror of
https://github.com/polhenarejos/pico-hsm.git
synced 2024-09-20 03:10:09 +00:00
Reducing debug level.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
eab3e5b73d
commit
240dc07fa5
3
debug.c
3
debug.c
@ -24,13 +24,14 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "tusb.h"
|
||||
#include "config.h"
|
||||
|
||||
void my_write (const char *s, int len)
|
||||
{
|
||||
if (len == 0)
|
||||
return;
|
||||
|
||||
TU_LOG2(s);
|
||||
TU_LOG1(s);
|
||||
}
|
||||
|
||||
|
||||
|
1
gnuk.h
1
gnuk.h
@ -1,3 +1,4 @@
|
||||
#include "config.h"
|
||||
/*
|
||||
* Application layer <-> CCID layer data structure
|
||||
*/
|
||||
|
10
hsm2040.c
10
hsm2040.c
@ -246,21 +246,21 @@ static void ccid_notify_slot_change(struct ccid *c)
|
||||
|
||||
static void ccid_init_cb(void) {
|
||||
struct ccid *c = &ccid;
|
||||
TU_LOG2("-------- CCID INIT\r\n");
|
||||
TU_LOG1("-------- CCID INIT\r\n");
|
||||
vendord_init();
|
||||
|
||||
//ccid_notify_slot_change(c);
|
||||
}
|
||||
|
||||
static void ccid_reset_cb(uint8_t rhport) {
|
||||
TU_LOG2("-------- CCID RESET\r\n");
|
||||
TU_LOG1("-------- CCID RESET\r\n");
|
||||
itf_num = 0;
|
||||
vendord_reset(rhport);
|
||||
}
|
||||
|
||||
static uint16_t ccid_open(uint8_t rhport, tusb_desc_interface_t const *itf_desc, uint16_t max_len) {
|
||||
uint8_t *itf_vendor = (uint8_t *)malloc(sizeof(uint8_t)*max_len);
|
||||
TU_LOG2("-------- CCID OPEN\r\n");
|
||||
TU_LOG1("-------- CCID OPEN\r\n");
|
||||
TU_VERIFY(itf_desc->bInterfaceClass == TUSB_CLASS_SMART_CARD && itf_desc->bInterfaceSubClass == 0 && itf_desc->bInterfaceProtocol == 0, 0);
|
||||
|
||||
//vendord_open expects a CLASS_VENDOR interface class
|
||||
@ -386,7 +386,7 @@ static const uint8_t ATR_head[] = {
|
||||
/* Send back ATR (Answer To Reset) */
|
||||
static enum ccid_state ccid_power_on (struct ccid *c)
|
||||
{
|
||||
TU_LOG2("!!! CCID POWER ON %d\r\n",c->application);
|
||||
TU_LOG1("!!! CCID POWER ON %d\r\n",c->application);
|
||||
uint8_t p[CCID_MSG_HEADER_SIZE+1]; /* >= size of historical_bytes -1 */
|
||||
int hist_len = historical_bytes[0];
|
||||
size_t size_atr = sizeof (ATR_head) + hist_len + 1;
|
||||
@ -465,7 +465,6 @@ static void ccid_send_status (struct ccid *c)
|
||||
|
||||
memcpy (endp1_tx_buf, ccid_reply, CCID_MSG_HEADER_SIZE);
|
||||
usb_tx_enable (endp1_tx_buf, CCID_MSG_HEADER_SIZE);
|
||||
DEBUG_PAYLOAD(ccid_reply,CCID_MSG_HEADER_SIZE);
|
||||
c->tx_busy = 1;
|
||||
}
|
||||
|
||||
@ -1225,7 +1224,6 @@ static void ccid_prepare_receive (struct ccid *c)
|
||||
c->epo->next_buf = ccid_abdata;
|
||||
c->epo->end_rx = end_ccid_rx;
|
||||
c->epo->ready = 1;
|
||||
DEBUG_INFO ("Rx ready\r\n");
|
||||
}
|
||||
|
||||
static void ccid_rx_ready (uint16_t len)
|
||||
|
18
hsm2040.h
18
hsm2040.h
@ -14,19 +14,19 @@
|
||||
extern const uint8_t historical_bytes[];
|
||||
|
||||
#define DEBUG_PAYLOAD(p,s) { \
|
||||
TU_LOG2("Payload %s (%d bytes):\r\n", #p,s);\
|
||||
TU_LOG1("Payload %s (%d bytes):\r\n", #p,s);\
|
||||
for (int i = 0; i < s; i += 16) {\
|
||||
for (int j = 0; j < 16; j++) {\
|
||||
if (j < s-i) TU_LOG2("%02X ",p[i+j]);\
|
||||
else TU_LOG2(" ");\
|
||||
if (j == 7) TU_LOG2(" ");\
|
||||
} TU_LOG2(": "); \
|
||||
if (j < s-i) TU_LOG1("%02X ",p[i+j]);\
|
||||
else TU_LOG1(" ");\
|
||||
if (j == 7) TU_LOG1(" ");\
|
||||
} TU_LOG1(": "); \
|
||||
for (int j = 0; j < MIN(16,s-i); j++) {\
|
||||
TU_LOG2("%c",p[i+j] == 0x0a || p[i+j] == 0x0d ? '\\' : p[i+j]);\
|
||||
if (j == 7) TU_LOG2(" ");\
|
||||
TU_LOG1("%c",p[i+j] == 0x0a || p[i+j] == 0x0d ? '\\' : p[i+j]);\
|
||||
if (j == 7) TU_LOG1(" ");\
|
||||
}\
|
||||
TU_LOG2("\r\n");\
|
||||
} TU_LOG2("\r\n"); \
|
||||
TU_LOG1("\r\n");\
|
||||
} TU_LOG1("\r\n"); \
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user