start ctap protocol
This commit is contained in:
parent
ac3e3da68b
commit
3080007b12
3
Makefile
3
Makefile
@ -8,3 +8,6 @@ name = main
|
|||||||
|
|
||||||
$(name): $(obj)
|
$(name): $(obj)
|
||||||
$(CC) $(LDFLAGS) -o $@ $(obj) $(LDFLAGS)
|
$(CC) $(LDFLAGS) -o $@ $(obj) $(LDFLAGS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o main.exe main
|
||||||
|
84
ctap.c
Normal file
84
ctap.c
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "cbor.h"
|
||||||
|
|
||||||
|
#include "ctap.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void check_ret(CborError ret)
|
||||||
|
{
|
||||||
|
if (ret != CborNoError)
|
||||||
|
{
|
||||||
|
printf("CborError: %d: %s\n", ret, cbor_error_string(ret));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ctap_handle_packet(uint8_t * pkt_raw, int length, CTAP_RESPONSE * resp)
|
||||||
|
{
|
||||||
|
uint8_t cmd = *pkt_raw;
|
||||||
|
int ret;
|
||||||
|
pkt_raw++;
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t buf[100];
|
||||||
|
memset(buf,0,sizeof(buf));
|
||||||
|
|
||||||
|
resp->data = buf;
|
||||||
|
resp->length = 0;
|
||||||
|
|
||||||
|
CborEncoder encoder;
|
||||||
|
CborEncoder array;
|
||||||
|
|
||||||
|
switch(cmd)
|
||||||
|
{
|
||||||
|
case CTAP_MAKE_CREDENTIAL:
|
||||||
|
printf("CTAP_MAKE_CREDENTIAL\n");
|
||||||
|
break;
|
||||||
|
case CTAP_GET_ASSERTION:
|
||||||
|
printf("CTAP_GET_ASSERTION\n");
|
||||||
|
break;
|
||||||
|
case CTAP_CANCEL:
|
||||||
|
printf("CTAP_CANCEL\n");
|
||||||
|
break;
|
||||||
|
case CTAP_GET_INFO:
|
||||||
|
printf("CTAP_GET_INFO\n");
|
||||||
|
|
||||||
|
cbor_encoder_init(&encoder, buf, sizeof(buf), 0);
|
||||||
|
|
||||||
|
ret = cbor_encoder_create_array(&encoder, &array, 2);
|
||||||
|
check_ret(ret);
|
||||||
|
|
||||||
|
ret = cbor_encode_text_stringz(&array, "1.0");
|
||||||
|
check_ret(ret);
|
||||||
|
ret = cbor_encode_text_stringz(&array, "2.0");
|
||||||
|
check_ret(ret);
|
||||||
|
|
||||||
|
ret = cbor_encoder_close_container(&encoder, &array);
|
||||||
|
check_ret(ret);
|
||||||
|
|
||||||
|
dump_hex(buf, cbor_encoder_get_buffer_size(&encoder, buf));
|
||||||
|
|
||||||
|
resp->length = cbor_encoder_get_buffer_size(&encoder, buf);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case CTAP_CLIENT_PIN:
|
||||||
|
printf("CTAP_CLIENT_PIN\n");
|
||||||
|
break;
|
||||||
|
case CTAP_RESET:
|
||||||
|
printf("CTAP_RESET\n");
|
||||||
|
break;
|
||||||
|
case GET_NEXT_ASSERTION:
|
||||||
|
printf("CTAP_NEXT_ASSERTION\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("error, invalid cmd\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("cbor structure: %d bytes\n", length - 1);
|
||||||
|
}
|
33
ctap.h
Normal file
33
ctap.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#ifndef _CTAP_H
|
||||||
|
#define _CTAP_H
|
||||||
|
|
||||||
|
#define CTAP_MAKE_CREDENTIAL 0x01
|
||||||
|
#define CTAP_GET_ASSERTION 0x02
|
||||||
|
#define CTAP_CANCEL 0x03
|
||||||
|
#define CTAP_GET_INFO 0x04
|
||||||
|
#define CTAP_CLIENT_PIN 0x06
|
||||||
|
#define CTAP_RESET 0x07
|
||||||
|
#define GET_NEXT_ASSERTION 0x08
|
||||||
|
#define CTAP_VENDOR_FIRST 0x40
|
||||||
|
#define CTAP_VENDOR_LAST 0xBF
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t * data;
|
||||||
|
uint16_t length;
|
||||||
|
} CTAP_RESPONSE;
|
||||||
|
|
||||||
|
|
||||||
|
void ctap_handle_packet(uint8_t * pkt_raw, int length, CTAP_RESPONSE * resp);
|
||||||
|
|
||||||
|
// Must be implemented by application
|
||||||
|
// data is HID_MESSAGE_SIZE long in bytes
|
||||||
|
extern void ctap_write_block(uint8_t * data);
|
||||||
|
|
||||||
|
// Buffer data and send in HID_MESSAGE_SIZE chunks
|
||||||
|
// if len == 0, FLUSH
|
||||||
|
// if len == -1, RESET
|
||||||
|
extern void ctap_write(void * _data, int len);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
56
ctap_device.c
Normal file
56
ctap_device.c
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Device specific functionality defined here
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "cbor.h"
|
||||||
|
|
||||||
|
#include "util.h"
|
||||||
|
#include "usbhid.h"
|
||||||
|
|
||||||
|
|
||||||
|
void ctap_write_block(uint8_t * data)
|
||||||
|
{
|
||||||
|
printf("<< "); dump_hex(data, 64);
|
||||||
|
usbhid_send(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ctap_write(void * _data, int len)
|
||||||
|
{
|
||||||
|
static uint8_t buf[HID_MESSAGE_SIZE];
|
||||||
|
static int offset = 0;
|
||||||
|
|
||||||
|
uint8_t * data = (uint8_t *) _data;
|
||||||
|
|
||||||
|
if (len == 0)
|
||||||
|
{
|
||||||
|
if (offset > 0)
|
||||||
|
{
|
||||||
|
memset(buf + offset, 0, HID_MESSAGE_SIZE - offset);
|
||||||
|
ctap_write_block(buf);
|
||||||
|
}
|
||||||
|
offset = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (len == -1)
|
||||||
|
{
|
||||||
|
memset(buf, 0, HID_MESSAGE_SIZE);
|
||||||
|
offset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
buf[offset++] = data[i];
|
||||||
|
if (offset == HID_MESSAGE_SIZE)
|
||||||
|
{
|
||||||
|
ctap_write_block(buf);
|
||||||
|
offset = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
141
ctaphid.c
141
ctaphid.c
@ -4,6 +4,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "ctaphid.h"
|
#include "ctaphid.h"
|
||||||
|
#include "ctap.h"
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
@ -36,8 +37,6 @@ static int ctap_packet_seq;
|
|||||||
|
|
||||||
static uint32_t _next_cid = 0;
|
static uint32_t _next_cid = 0;
|
||||||
|
|
||||||
static void ctaphid_write(void * _data, int len);
|
|
||||||
|
|
||||||
void ctaphid_init()
|
void ctaphid_init()
|
||||||
{
|
{
|
||||||
state = IDLE;
|
state = IDLE;
|
||||||
@ -46,7 +45,7 @@ void ctaphid_init()
|
|||||||
ctap_buffer_bcnt = 0;
|
ctap_buffer_bcnt = 0;
|
||||||
ctap_buffer_offset = 0;
|
ctap_buffer_offset = 0;
|
||||||
ctap_packet_seq = 0;
|
ctap_packet_seq = 0;
|
||||||
ctaphid_write(NULL, -1);
|
ctap_write(NULL, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t set_next_cid(uint32_t cid)
|
static uint32_t set_next_cid(uint32_t cid)
|
||||||
@ -155,69 +154,35 @@ static int buffer_len()
|
|||||||
return ctap_buffer_bcnt;
|
return ctap_buffer_bcnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Buffer data and send in HID_MESSAGE_SIZE chunks
|
|
||||||
static void ctaphid_write(void * _data, int len)
|
|
||||||
{
|
|
||||||
static uint8_t buf[HID_MESSAGE_SIZE];
|
|
||||||
static int offset = 0;
|
|
||||||
|
|
||||||
uint8_t * data = (uint8_t *) _data;
|
|
||||||
|
|
||||||
if (len == 0)
|
|
||||||
{
|
|
||||||
if (offset > 0)
|
|
||||||
{
|
|
||||||
memset(buf + offset, 0, HID_MESSAGE_SIZE - offset);
|
|
||||||
ctaphid_write_block(buf);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (len == -1)
|
|
||||||
{
|
|
||||||
memset(buf, 0, HID_MESSAGE_SIZE);
|
|
||||||
offset = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < len; i++)
|
|
||||||
{
|
|
||||||
buf[offset++] = data[i];
|
|
||||||
if (offset == HID_MESSAGE_SIZE)
|
|
||||||
{
|
|
||||||
ctaphid_write_block(buf);
|
|
||||||
offset = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ctaphid_send_error(uint32_t cid, uint8_t error)
|
static void ctaphid_send_error(uint32_t cid, uint8_t error)
|
||||||
{
|
{
|
||||||
uint8_t buf[HID_MESSAGE_SIZE];
|
uint8_t buf[HID_MESSAGE_SIZE];
|
||||||
memset(buf,0,sizeof(buf));
|
memset(buf,0,sizeof(buf));
|
||||||
CTAPHID_ERROR_RESPONSE * resp = (CTAPHID_ERROR_RESPONSE *) buf;
|
CTAPHID_RESPONSE * resp = (CTAPHID_RESPONSE *) buf;
|
||||||
resp->cid = cid;
|
resp->cid = cid;
|
||||||
resp->cmd = CTAPHID_ERROR;
|
resp->cmd = CTAPHID_ERROR;
|
||||||
resp->bcnth = 0;
|
resp->bcnth = 0;
|
||||||
resp->bcntl = 1;
|
resp->bcntl = 1;
|
||||||
resp->error = error;
|
buf[sizeof(CTAPHID_RESPONSE)] = error;
|
||||||
ctaphid_write_block(buf);
|
ctap_write_block(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ctaphid_handle_packet(uint8_t * pkt_raw, CTAPHID_STATUS * stat)
|
void ctaphid_handle_packet(uint8_t * pkt_raw)
|
||||||
{
|
{
|
||||||
CTAPHID_PACKET * pkt = (CTAPHID_PACKET *)(pkt_raw);
|
CTAPHID_PACKET * pkt = (CTAPHID_PACKET *)(pkt_raw);
|
||||||
|
|
||||||
printf("Recv packet\n");
|
printf("Recv packet\n");
|
||||||
printf(" CID: %08x\n", pkt->cid);
|
printf(" CID: %08x active(%08x)\n", pkt->cid, active_cid);
|
||||||
printf(" cmd: %02x\n", pkt->pkt.init.cmd);
|
printf(" cmd: %02x\n", pkt->pkt.init.cmd);
|
||||||
printf(" length: %d\n", ctaphid_packet_len(pkt));
|
printf(" length: %d\n", ctaphid_packet_len(pkt));
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
static CTAPHID_INIT_RESPONSE init_resp;
|
static CTAPHID_INIT_RESPONSE init_resp;
|
||||||
static CTAPHID_PING_RESPONSE ping_resp;
|
static CTAPHID_RESPONSE resp;
|
||||||
static CTAPHID_WINK_RESPONSE wink_resp;
|
|
||||||
|
CTAP_RESPONSE ctap_resp;
|
||||||
|
|
||||||
memset(stat, 0, sizeof(CTAPHID_STATUS));
|
|
||||||
|
|
||||||
start_over:
|
start_over:
|
||||||
|
|
||||||
@ -299,7 +264,6 @@ start_over:
|
|||||||
{
|
{
|
||||||
case BUFFERING:
|
case BUFFERING:
|
||||||
printf("BUFFERING\n");
|
printf("BUFFERING\n");
|
||||||
stat->status = NO_RESPONSE;
|
|
||||||
active_cid_timestamp = millis();
|
active_cid_timestamp = millis();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -336,22 +300,21 @@ start_over:
|
|||||||
init_resp.build_version = 0;//?
|
init_resp.build_version = 0;//?
|
||||||
init_resp.capabilities = CAPABILITY_WINK | CAPABILITY_CBOR;
|
init_resp.capabilities = CAPABILITY_WINK | CAPABILITY_CBOR;
|
||||||
|
|
||||||
ctaphid_write(&init_resp,sizeof(CTAPHID_INIT_RESPONSE));
|
ctap_write(&init_resp,sizeof(CTAPHID_INIT_RESPONSE));
|
||||||
ctaphid_write(NULL,0);
|
ctap_write(NULL,0);
|
||||||
|
|
||||||
stat->status = CTAPHID_RESPONSE;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case CTAPHID_PING:
|
case CTAPHID_PING:
|
||||||
|
|
||||||
ping_resp.cid = active_cid;
|
resp.cid = active_cid;
|
||||||
ping_resp.cmd = CTAPHID_PING;
|
resp.cmd = CTAPHID_PING;
|
||||||
ping_resp.bcnth = (buffer_len() & 0xff00) >> 8;
|
resp.bcnth = (buffer_len() & 0xff00) >> 8;
|
||||||
ping_resp.bcntl = (buffer_len() & 0xff) >> 0;
|
resp.bcntl = (buffer_len() & 0xff) >> 0;
|
||||||
|
|
||||||
ctaphid_write(&ping_resp,sizeof(CTAPHID_PING_RESPONSE));
|
ctap_write(&resp,sizeof(CTAPHID_RESPONSE));
|
||||||
ctaphid_write(ctap_buffer, buffer_len());
|
ctap_write(ctap_buffer, buffer_len());
|
||||||
ctaphid_write(NULL,0);
|
ctap_write(NULL,0);
|
||||||
|
|
||||||
printf("CTAPHID_PING\n");
|
printf("CTAPHID_PING\n");
|
||||||
break;
|
break;
|
||||||
@ -366,16 +329,41 @@ start_over:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wink_resp.cid = active_cid;
|
resp.cid = active_cid;
|
||||||
wink_resp.cmd = CTAPHID_WINK;
|
resp.cmd = CTAPHID_WINK;
|
||||||
wink_resp.bcnt = 0;
|
resp.bcntl = 0;
|
||||||
|
resp.bcnth = 0;
|
||||||
|
|
||||||
ctaphid_write(&wink_resp,sizeof(CTAPHID_WINK_RESPONSE));
|
ctap_write(&resp,sizeof(CTAPHID_RESPONSE));
|
||||||
ctaphid_write(NULL,0);
|
ctap_write(NULL,0);
|
||||||
|
|
||||||
printf("CTAPHID_WINK\n");
|
printf("CTAPHID_WINK\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CTAPHID_CBOR:
|
||||||
|
printf("CTAPHID_CBOR\n");
|
||||||
|
if (buffer_len() == 0)
|
||||||
|
{
|
||||||
|
printf("Error,invalid 0 length field for cbor packet\n");
|
||||||
|
ctaphid_send_error(pkt->cid, ERR_INVALID_LEN);
|
||||||
|
ctaphid_init();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctap_handle_packet(ctap_buffer, buffer_len(), &ctap_resp);
|
||||||
|
|
||||||
|
resp.cid = active_cid;
|
||||||
|
resp.cmd = CTAPHID_MSG;
|
||||||
|
resp.bcntl = (ctap_resp.length & 0x00ff) >> 0;
|
||||||
|
resp.bcnth = (ctap_resp.length & 0xff00) >> 8;
|
||||||
|
|
||||||
|
ctap_write(&resp,sizeof(CTAPHID_RESPONSE));
|
||||||
|
ctap_write(ctap_resp.data, ctap_resp.length);
|
||||||
|
ctap_write(NULL, 0);
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("error, unimplemented HID cmd: %02x\r\n", buffer_cmd());
|
printf("error, unimplemented HID cmd: %02x\r\n", buffer_cmd());
|
||||||
break;
|
break;
|
||||||
@ -388,36 +376,7 @@ start_over:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ctaphid_dump_status(CTAPHID_STATUS * stat)
|
|
||||||
{
|
|
||||||
switch(stat->status)
|
|
||||||
{
|
|
||||||
case NO_RESPONSE:
|
|
||||||
printf("NO_RESPONSE");
|
|
||||||
break;
|
|
||||||
case CTAPHID_RESPONSE:
|
|
||||||
printf("CTAPHID_RESPONSE");
|
|
||||||
break;
|
|
||||||
case U2F_RESPONSE:
|
|
||||||
printf("U2F_RESPONSE");
|
|
||||||
break;
|
|
||||||
case CBOR_RESPONSE:
|
|
||||||
printf("CBOR_RESPONSE");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
printf("\ninvalid status %d; abort\n", stat->status);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
/*printf(" (%d)\n ", stat->length);*/
|
|
||||||
/*if (stat->length > 0)*/
|
|
||||||
/*{*/
|
|
||||||
/*dump_hex(stat->data, stat->length);*/
|
|
||||||
/*}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
41
ctaphid.h
41
ctaphid.h
@ -74,54 +74,17 @@ typedef struct
|
|||||||
uint8_t cmd;
|
uint8_t cmd;
|
||||||
uint8_t bcnth;
|
uint8_t bcnth;
|
||||||
uint8_t bcntl;
|
uint8_t bcntl;
|
||||||
} __attribute__((packed)) CTAPHID_PING_RESPONSE;
|
} __attribute__((packed)) CTAPHID_RESPONSE;
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t cid;
|
|
||||||
uint8_t cmd;
|
|
||||||
uint16_t bcnt;
|
|
||||||
} __attribute__((packed)) CTAPHID_WINK_RESPONSE;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint32_t cid;
|
|
||||||
uint8_t cmd;
|
|
||||||
uint8_t bcnth;
|
|
||||||
uint8_t bcntl;
|
|
||||||
uint8_t error;
|
|
||||||
} __attribute__((packed)) CTAPHID_ERROR_RESPONSE;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// API specific, not protocol specific //
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
NO_RESPONSE = 0,
|
|
||||||
CTAPHID_RESPONSE,
|
|
||||||
U2F_RESPONSE,
|
|
||||||
CBOR_RESPONSE,
|
|
||||||
} CTAPHID_CODE;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
int status;
|
|
||||||
} CTAPHID_STATUS;
|
|
||||||
////////
|
|
||||||
|
|
||||||
|
|
||||||
void ctaphid_init();
|
void ctaphid_init();
|
||||||
|
|
||||||
void ctaphid_handle_packet(uint8_t * pkt_raw, CTAPHID_STATUS * stat);
|
void ctaphid_handle_packet(uint8_t * pkt_raw);
|
||||||
|
|
||||||
void ctaphid_dump_status(CTAPHID_STATUS * stat);
|
|
||||||
|
|
||||||
// Must be implemented by application
|
|
||||||
// data is HID_MESSAGE_SIZE long in bytes
|
|
||||||
extern void ctaphid_write_block(uint8_t * data);
|
|
||||||
|
|
||||||
#define ctaphid_packet_len(pkt) ((uint16_t)((pkt)->pkt.init.bcnth << 8) | ((pkt)->pkt.init.bcntl))
|
#define ctaphid_packet_len(pkt) ((uint16_t)((pkt)->pkt.init.bcnth << 8) | ((pkt)->pkt.init.bcntl))
|
||||||
|
|
||||||
|
14
main.c
14
main.c
@ -8,7 +8,7 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
|
||||||
void check_ret(CborError ret)
|
static void check_ret(CborError ret)
|
||||||
{
|
{
|
||||||
if (ret != CborNoError)
|
if (ret != CborNoError)
|
||||||
{
|
{
|
||||||
@ -18,14 +18,6 @@ void check_ret(CborError ret)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ctaphid_write_block(uint8_t * data)
|
|
||||||
{
|
|
||||||
printf("usbhid send\n");
|
|
||||||
dump_hex(data, 64);
|
|
||||||
usbhid_send(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char * argv[])
|
int main(int argc, char * argv[])
|
||||||
{
|
{
|
||||||
/*CborError ret;*/
|
/*CborError ret;*/
|
||||||
@ -45,7 +37,6 @@ int main(int argc, char * argv[])
|
|||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
uint8_t hidmsg[64];
|
uint8_t hidmsg[64];
|
||||||
CTAPHID_STATUS res;
|
|
||||||
memset(hidmsg,0,sizeof(hidmsg));
|
memset(hidmsg,0,sizeof(hidmsg));
|
||||||
|
|
||||||
printf("recv'ing hid msg \n");
|
printf("recv'ing hid msg \n");
|
||||||
@ -55,9 +46,8 @@ int main(int argc, char * argv[])
|
|||||||
usbhid_recv(hidmsg);
|
usbhid_recv(hidmsg);
|
||||||
printf("%d>> ",count++); dump_hex(hidmsg,sizeof(hidmsg));
|
printf("%d>> ",count++); dump_hex(hidmsg,sizeof(hidmsg));
|
||||||
|
|
||||||
ctaphid_handle_packet(hidmsg, &res);
|
ctaphid_handle_packet(hidmsg);
|
||||||
memset(hidmsg, 0, sizeof(hidmsg));
|
memset(hidmsg, 0, sizeof(hidmsg));
|
||||||
ctaphid_dump_status(&res);
|
|
||||||
|
|
||||||
/*int i;*/
|
/*int i;*/
|
||||||
/*for(i = 0; i < res.length; i += 64)*/
|
/*for(i = 0; i < res.length; i += 64)*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user