From 7f44cae7c1c1a7e54099655365afde4f20aeee6a Mon Sep 17 00:00:00 2001 From: laforge Date: Sun, 15 Oct 2006 19:17:22 +0000 Subject: - fix multiple include of rfid_protocol_mifare_classic.h problem - add some more layer2 {get,set}opt()s - add rfid_protocol_{get,set}opt() - export functions for l2/proto scanning, not just for combined scanning - add support for sending WUPA instead of REQA in iso14443a git-svn-id: https://svn.gnumonks.org/trunk/librfid@1910 e0336214-984f-0b4b-a45f-81c69e1f0ede --- src/rfid_proto_tcl.c | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 'src/rfid_proto_tcl.c') diff --git a/src/rfid_proto_tcl.c b/src/rfid_proto_tcl.c index d00e966..af626c6 100644 --- a/src/rfid_proto_tcl.c +++ b/src/rfid_proto_tcl.c @@ -122,7 +122,8 @@ tcl_parse_ats(struct rfid_protocol_handle *h, } else { /* Section 7.2: fwi for type B is always in ATQB */ /* Value is assigned in tcl_connect() */ - /* This function is never called for Type B, since it has no (R)ATS */ + /* This function is never called for Type B, + * since Type B has no (R)ATS */ } return 0; } @@ -762,6 +763,43 @@ tcl_fini(struct rfid_protocol_handle *ph) return 0; } +int +tcl_getopt(struct rfid_protocol_handle *h, int optname, void *optval, + unsigned int *optlen) +{ + u_int8_t *opt_str = optval; + + switch (optname) { + case RFID_OPT_P_TCL_ATS: + if (h->priv.tcl.ats_len < *optlen) + *optlen = h->priv.tcl.ats_len; + memcpy(opt_str, h->priv.tcl.ats, *optlen); + break; + case RFID_OPT_P_TCL_ATS_LEN: + if (*optlen < sizeof(u_int8_t)) + return -E2BIG; + *optlen = sizeof(u_int8_t); + *opt_str = h->priv.tcl.ats_len & 0xff; + break; + } + + return 0; +} + +int +tcl_setopt(struct rfid_protocol_handle *h, int optname, const void *optval, + unsigned int optlen) +{ + int ret = -EINVAL; + + switch (optname) { + default: + break; + } + + return ret; +} + const struct rfid_protocol rfid_protocol_tcl = { .id = RFID_PROTOCOL_TCL, .name = "ISO 14443-4 / T=CL", @@ -771,5 +809,7 @@ const struct rfid_protocol rfid_protocol_tcl = { .transceive = &tcl_transceive, .close = &tcl_deselect, .fini = &tcl_fini, + .getopt = &tcl_getopt, + .setopt = &tcl_setopt, }, }; -- cgit v1.2.3