start of ctaphid
This commit is contained in:
21
main.c
21
main.c
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "cbor.h"
|
||||
#include "usbhid.h"
|
||||
#include "ctaphid.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
@@ -18,18 +19,20 @@ void check_ret(CborError ret)
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
CborError ret;
|
||||
uint8_t buf[16];
|
||||
memset(buf,0,sizeof(buf));
|
||||
CborEncoder encoder;
|
||||
cbor_encoder_init(&encoder, buf, sizeof(buf), 0);
|
||||
ret = cbor_encode_int(&encoder, 55);
|
||||
check_ret(ret);
|
||||
/*CborError ret;*/
|
||||
/*uint8_t buf[16];*/
|
||||
/*memset(buf,0,sizeof(buf));*/
|
||||
/*CborEncoder encoder;*/
|
||||
/*cbor_encoder_init(&encoder, buf, sizeof(buf), 0);*/
|
||||
/*ret = cbor_encode_int(&encoder, 55);*/
|
||||
/*check_ret(ret);*/
|
||||
|
||||
dump_hex(buf,sizeof(buf));
|
||||
/*dump_hex(buf,sizeof(buf));*/
|
||||
|
||||
printf("init usbhid\n");
|
||||
usbhid_init();
|
||||
printf("init ctaphid\n");
|
||||
ctaphid_init();
|
||||
|
||||
uint8_t hidmsg[64];
|
||||
memset(hidmsg,0,sizeof(hidmsg));
|
||||
@@ -40,6 +43,8 @@ int main(int argc, char * argv[])
|
||||
{
|
||||
usbhid_recv(hidmsg);
|
||||
printf(">> "); dump_hex(hidmsg,sizeof(hidmsg));
|
||||
|
||||
ctaphid_handle_packet(hidmsg);
|
||||
printf("<< "); dump_hex(hidmsg,sizeof(hidmsg));
|
||||
usbhid_send(hidmsg);
|
||||
}
|
||||
|
Reference in New Issue
Block a user