- memset(uuid_list_valid, MY_NONE, 16);
- memset(uuid_list, 0, ISO15693_UID_LEN * 16);
-
- memset(&acf, 0, sizeof(struct iso15693_anticol_cmd));
- acf.afi = 0;
- acf.flags = RFID_15693_F5_NSLOTS_1 | /* comment out for 16 slots */
- RFID_15693_F_INV_TABLE_5 |
- RFID_15693_F_RATE_HIGH;
- //RFID_15693_F_SUBC_TWO
- acf.mask_len = 0;
- //acf.mask_bits[0] = 3;
- acf.current_slot = 0;
-
- if (acf.flags & RFID_15693_F5_NSLOTS_1)
- i = 1;
- else
- i = 16;
- for (; i >=1; i--) {
- //acf.current_slot=0;
- ret = iso15693_transceive_acf(handle, &acf, &uuid[0], &boc);
- switch (ret) {
- case -ETIMEDOUT:
- DEBUGP("no answer from vicc in slot %d\n",
- acf.current_slot);
- uuid_list_valid[acf.current_slot] = MY_NONE;
- break;
- case -ECOLLISION:
- DEBUGP("Collision during anticol. slot %d bit %d\n",
- acf.current_slot,boc);
- uuid_list_valid[acf.current_slot] = -boc;
- memcpy(uuid_list[acf.current_slot], uuid, ISO15693_UID_LEN);
- break;
- default:
- if (ret < 0) {
- DEBUGP("ERROR ret: %d, slot %d\n", ret,
- acf.current_slot);
- uuid_list_valid[acf.current_slot] = MY_NONE;
+ memset(uuid_list_valid, MY_NONE, sizeof(uuid_list_valid));
+ memset(uuid_list, 0, sizeof(uuid_list));
+
+ //memset(&acf, 0, sizeof(acf));
+
+ /* FIXME: we can't use multiple slots at this point, since the RC632
+ * with librfid on the host PC has too much latency between 'EOF pulse
+ * to mark start of next slot' and 'receive data' commands :( */
+
+ flags = RFID_15693_F_INV_TABLE_5;
+ if (handle->priv.iso15693.vicc_fast)
+ flags |= RFID_15693_F_RATE_HIGH;
+ if (handle->priv.iso15693.vicc_two_subc)
+ flags |= RFID_15693_F_SUBC_TWO;
+ if (handle->priv.iso15693.single_slot) {
+ flags |= RFID_15693_F5_NSLOTS_1;
+ num_slots = 1;
+ }
+ if (handle->priv.iso15693.use_afi)
+ flags |= RFID_15693_F5_AFI_PRES;
+#if 1
+ tx_len = iso15693_build_acf((u_int8_t *)&acf, flags,
+ handle->priv.iso15693.afi, 0, NULL);
+#else
+ /*FIXME: testcode*/
+ u_int8_t uid[8]={0x1f, 0x1e, 0x95, 0x01, 0x00, 0x01, 0x04, 0xe0};
+ //u_int8_t uid[8]={0xe3, 0xe8, 0xf1, 0x01, 0x00, 0x00, 0x07, 0xe0};
+ tx_len = iso15693_build_acf((u_int8_t *)&acf, flags,
+ handle->priv.iso15693.afi, 2, uid);
+#endif
+start_of_ac_loop:
+ for (i = 0; i < num_slots; i++) {
+ rx_len = sizeof(resp);
+ memset(&resp, 0, rx_len);
+ ret = iso15693_transceive_acf(handle,
+ (struct iso15693_anticol_cmd *) &acf,
+ tx_len, &resp, &rx_len, &boc);
+
+ if (ret == -ETIMEDOUT) {
+ //DEBUGP("no answer from vicc in slot %d\n", i);
+ DEBUGP("slot[%d]: timeout\n",i);
+ uuid_list_valid[i] = MY_NONE;
+ } else if (ret < 0) {
+ DEBUGP("slot[%d]: ERROR ret: %d\n", i, ret);
+ uuid_list_valid[i] = MY_NONE;
+ } else {
+ if (ret)
+ DEBUGP("iso15693_transceive_acf() ret: %d\n",ret);
+ if (boc) {
+ DEBUGP("slot[%d]: Collision! bit:%d byte:%d,%d (UID bit:%d byte:%d,%d)\n",
+ i, boc,boc/8,boc%8,
+ boc-16,(boc-16)/8,(boc-16)%8);
+ DEBUGP("Slot[%d]: ret: %d DSFID: %02x UUID: %s\n", i, ret,
+ resp.dsfid, rfid_hexdump(resp.uuid, ISO15693_UID_LEN));
+
+ uuid_list_valid[i]=-boc;
+ memcpy(uuid_list[i], resp.uuid, ISO15693_UID_LEN);