summaryrefslogtreecommitdiff
path: root/src/rfid_proto_tcl.c
diff options
context:
space:
mode:
authorlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>2006-10-15 19:17:22 +0000
committerlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>2006-10-15 19:17:22 +0000
commit7f44cae7c1c1a7e54099655365afde4f20aeee6a (patch)
tree2214b97f6172e0d3446f04f50003a55c356a2983 /src/rfid_proto_tcl.c
parent966a8e3acc6244025d265db0af5e20365566f2a4 (diff)
- 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
Diffstat (limited to 'src/rfid_proto_tcl.c')
-rw-r--r--src/rfid_proto_tcl.c42
1 files changed, 41 insertions, 1 deletions
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,
},
};
personal git repositories of Harald Welte. Your mileage may vary