summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>2005-10-22 17:20:47 +0000
committerlaforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede>2005-10-22 17:20:47 +0000
commitb441f1c6a000da975589b002f38c1b57ca327e22 (patch)
tree2fdff2e2c935b711eaadbf870b93d498a94d2bb8
parent8cd779e0a3b0ab320a954eb493fc6acb505e533a (diff)
- move some initialization of proto handle from _tcl to core
- read_len is actually a pointer to the value git-svn-id: https://svn.gnumonks.org/trunk/librfid@1549 e0336214-984f-0b4b-a45f-81c69e1f0ede
-rw-r--r--rfid_proto_tcl.c2
-rw-r--r--rfid_protocol.c20
2 files changed, 15 insertions, 7 deletions
diff --git a/rfid_proto_tcl.c b/rfid_proto_tcl.c
index da3ecf1..5b63607 100644
--- a/rfid_proto_tcl.c
+++ b/rfid_proto_tcl.c
@@ -647,8 +647,6 @@ tcl_init(struct rfid_layer2_handle *l2h)
th->priv.tcl.state = TCL_STATE_INITIAL;
th->priv.tcl.ats_len = mru;
th->priv.tcl.toggle = 1;
- th->l2h = l2h;
- th->proto = &rfid_protocol_tcl;
th->priv.tcl.fsd = iso14443_fsd_approx(mru);
diff --git a/rfid_protocol.c b/rfid_protocol.c
index 28da029..abbd04d 100644
--- a/rfid_protocol.c
+++ b/rfid_protocol.c
@@ -30,12 +30,22 @@ struct rfid_protocol_handle *
rfid_protocol_init(struct rfid_layer2_handle *l2h, unsigned int id)
{
struct rfid_protocol *p;
+ struct rfid_protocol_handle *ph = NULL;
- for (p = rfid_protocol_list; p; p = p->next)
- if (p->id == id)
- return p->fn.init(l2h);
+ for (p = rfid_protocol_list; p; p = p->next) {
+ if (p->id == id) {
+ ph = p->fn.init(l2h);
+ break;
+ }
+ }
- return NULL;
+ if (!ph)
+ return NULL;
+
+ ph->proto = p;
+ ph->l2h = l2h;
+
+ return ph;
}
int
@@ -60,7 +70,7 @@ int
rfid_protocol_read(struct rfid_protocol_handle *ph,
unsigned int page,
unsigned char *rx_data,
- unsigned int rx_len)
+ unsigned int *rx_len)
{
if (ph->proto->fn.read)
return ph->proto->fn.read(ph, page, rx_data, rx_len);
personal git repositories of Harald Welte. Your mileage may vary