2 /* UNFINISHED TI Tag-it implementation, PCD side.
4 * (C) 2005-2008 by Harald Welte <laforge@gnumonks.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2
11 * as published by the Free Software Foundation
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
28 #include <librfid/rfid.h>
29 #include <librfid/rfid_protocol.h>
30 #include <librfid/rfid_layer2.h>
31 #include <librfid/rfid_layer2_iso15693.h>
32 #include <librfid/rfid_protocol_tagit.h>
34 struct tagit_version {
35 u_int8_t version; /* bit 47..40 (last bit masked) of uid */
39 const struct tagit_version tagit_versions[] = {
42 .name = "HF-I Plus Inlay",
45 .name = "HF-I Plus Chip",
48 .name = "HF-I Standard Chip / Inlay",
51 .name = "HF-I Pro Chip / Inlay",
56 tagit_read(struct rfid_protocol_handle *ph, unsigned int page,
57 unsigned char *rx_data, unsigned int *rx_len)
59 unsigned char rx_buf[16];
60 unsigned int real_rx_len = sizeof(rx_buf);
69 tagit_write(struct rfid_protocol_handle *ph, unsigned int page,
70 unsigned char *tx_data, unsigned int tx_len)
75 unsigned int rx_len = sizeof(rx);
82 tagit_getopt(struct rfid_protocol_handle *ph, int optname, void *optval,
86 unsigned int *size = optval;
89 case RFID_OPT_PROTO_SIZE:
91 /* we have to return the size in bytes, not bits */
92 /* FIXME: implement this */
101 static struct rfid_protocol_handle *
102 tagit_init(struct rfid_layer2_handle *l2h)
104 struct rfid_protocol_handle *ph;
106 unsigned int uid_len = sizeof(uid);
108 if (l2h->l2->id != RFID_LAYER2_ISO15693)
111 /* According to "SCBU002 - November 2005 */
112 rfid_layer2_getopt(l2h, RFID_OPT_LAYER2_UID,
114 if (uid[5] != 0xe0 || uid[4] != 0x07)
116 if (l2h->uid_len != 6)
119 ph = malloc_protocol_handle(sizeof(struct rfid_protocol_handle));
123 static int tagit_fini(struct rfid_protocol_handle *ph)
125 free_protocol_handle(ph);
129 const struct rfid_protocol rfid_protocol_tagit = {
130 .id = RFID_PROTOCOL_TAGIT,
131 .name = "TI Tag-it HF",
135 .write = &tagit_write,
137 .getopt = &tagit_getopt,
141 /* Functions below are not (yet? covered in the generic librfid api */