summaryrefslogtreecommitdiff
path: root/reader_yhy.c
diff options
context:
space:
mode:
Diffstat (limited to 'reader_yhy.c')
-rw-r--r--reader_yhy.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/reader_yhy.c b/reader_yhy.c
index 704a053..5174ef9 100644
--- a/reader_yhy.c
+++ b/reader_yhy.c
@@ -142,11 +142,19 @@ uint8_t read_ntag(nfc_tag_info_t* tag){
return FLAG_TAG_DATA_VALID;
}
+void write_ntag(nfc_tag_info_t* tag){
+ //TODO
+}
+
uint8_t read_mifare(nfc_tag_info_t* tag){
//TODO
return FLAG_TAG_LOCKED;
}
+void write_mifare(nfc_tag_info_t* tag){
+ //TODO
+}
+
int scan(){
nfc_tag_info_t card = {
0
@@ -154,7 +162,7 @@ int scan(){
uint16_t atqa = 0;
uint8_t sak = 0;
- uint8_t flags;
+ uint8_t flags = 0;
for(yhy_sync_request(reader_fd, 1, &atqa); atqa; yhy_sync_request(reader_fd, 0, &atqa)){
sak = 0;
@@ -201,7 +209,13 @@ int scan(){
reader_tag_present(flags, &card);
break;
case TAG_WRITE_REQUESTED:
- //TODO write card data
+ //write card data
+ if(card.type == tag_ntag){
+ write_ntag(&card);
+ }
+ else if(card.type == tag_mifare1){
+ write_mifare(&card);
+ }
break;
}