diff options
author | laforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede> | 2005-10-20 20:15:49 +0000 |
---|---|---|
committer | laforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede> | 2005-10-20 20:15:49 +0000 |
commit | d222d836a7a97c7164e0f96920b148d532fa574a (patch) | |
tree | 80fbd5c4138c5b91bf95a53d87ec96a35fe7fb55 /rfid_protocol.c | |
parent | 95b1a39e943eb22d73dc1ddccd1e372c1176d210 (diff) |
add mifare ultralight support (incomplete)
git-svn-id: https://svn.gnumonks.org/trunk/librfid@1543 e0336214-984f-0b4b-a45f-81c69e1f0ede
Diffstat (limited to 'rfid_protocol.c')
-rw-r--r-- | rfid_protocol.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/rfid_protocol.c b/rfid_protocol.c index 3340b25..28da029 100644 --- a/rfid_protocol.c +++ b/rfid_protocol.c @@ -19,6 +19,7 @@ #include <stdlib.h> #include <unistd.h> +#include <errno.h> #include <rfid/rfid_layer2.h> #include <rfid/rfid_protocol.h> @@ -40,7 +41,9 @@ rfid_protocol_init(struct rfid_layer2_handle *l2h, unsigned int id) int rfid_protocol_open(struct rfid_protocol_handle *ph) { - return ph->proto->fn.open(ph); + if (ph->proto->fn.open) + return ph->proto->fn.open(ph); + return 0; } int @@ -53,6 +56,30 @@ rfid_protocol_transcieve(struct rfid_protocol_handle *ph, timeout, flags); } +int +rfid_protocol_read(struct rfid_protocol_handle *ph, + unsigned int page, + unsigned char *rx_data, + unsigned int rx_len) +{ + if (ph->proto->fn.read) + return ph->proto->fn.read(ph, page, rx_data, rx_len); + else + return -EINVAL; +} + +int +rfid_protocol_write(struct rfid_protocol_handle *ph, + unsigned int page, + unsigned char *tx_data, + unsigned int tx_len) +{ + if (ph->proto->fn.write) + return ph->proto->fn.write(ph, page, tx_data, tx_len); + else + return -EINVAL; +} + int rfid_protocol_fini(struct rfid_protocol_handle *ph) { return ph->proto->fn.fini(ph); @@ -61,7 +88,9 @@ int rfid_protocol_fini(struct rfid_protocol_handle *ph) int rfid_protocol_close(struct rfid_protocol_handle *ph) { - return ph->proto->fn.close(ph); + if (ph->proto->fn.close) + return ph->proto->fn.close(ph); + return 0; } int |