summaryrefslogtreecommitdiff
path: root/libyhy.c
diff options
context:
space:
mode:
Diffstat (limited to 'libyhy.c')
-rw-r--r--libyhy.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libyhy.c b/libyhy.c
index 041b0b7..77fd89b 100644
--- a/libyhy.c
+++ b/libyhy.c
@@ -5,9 +5,9 @@
#include <unistd.h>
#include <string.h>
-#include <stdio.h>
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#ifdef DEBUG
+ #include <stdio.h>
#define DBG(x) (x)
#else
#define DBG(x)
@@ -100,7 +100,7 @@ enum /*_yhy_command*/ {
static void xxd(uint8_t* buf, size_t len){
size_t n;
for(n = 0; n < len; n++){
- printf("%02X ", buf[n]);
+ DBG(printf("%02X ", buf[n]));
}
}
@@ -257,6 +257,7 @@ int yhy_sync_auth(int fd, uint8_t key_a, uint8_t block, uint8_t key[6]){
return yhy_sync(fd, DEFAULT_NODE_ID, YHY_MIFARE_AUTH, (uint8_t*) (&auth_payload), sizeof(auth_payload), NULL, 0);
}
+//For some reason, this fails with blocks 0 and 10 on all NTAGs
int yhy_sync_read(int fd, uint8_t block, uint8_t* data, size_t max_len){
return yhy_sync(fd, DEFAULT_NODE_ID, YHY_MIFARE_READ, &block, 1, data, max_len);
}