- ret = iso15693_transceive(handle, RFID_15693_FRAME, (u_int8_t*)&tx_req,
- tx_len, (u_int8_t*)&rx_buf, &rx_len, 50,0);
- DEBUGP("ret: %d, error_flag: %d error: %d\n", ret,
- rx_buf.head.flags&RFID_15693_RF_ERROR, 0);
- return -1;
+
+ DEBUGP("ret: %d%s, error_flag: %d", ret,(ret==-ETIMEDOUT)?"(TIMEOUT)":"",
+ rx_buf.head.flags&RFID_15693_RF_ERROR);
+ if (rx_buf.head.flags&RFID_15693_RF_ERROR){
+ DEBUGPC(" -> error: %02x '%s'\n", rx_buf.error,
+ iso15693_get_response_error_name(rx_buf.error));
+ l2h->priv.iso15693.state = RFID_15693_STATE_SELECTED;
+ return 0;
+ }else{
+ DEBUGPC("\n");
+ return -1;
+ }
+}
+
+static int
+iso15693_stay_quiet(struct rfid_layer2_handle *l2h)
+{
+ struct iso15693_request_adressed tx_req;
+ int ret;
+ unsigned int rx_len, tx_len;
+
+ struct {
+ struct iso15693_response head;
+ u_int8_t error;
+ unsigned char crc[2];
+ } rx_buf;
+ rx_len = sizeof(rx_buf);
+
+ tx_req.head.command = ISO15693_CMD_STAY_QUIET;
+
+ tx_req.head.flags = RFID_15693_F4_ADDRESS;
+ if (l2h->priv.iso15693.vicc_fast)
+ tx_req.head.flags |= RFID_15693_F_RATE_HIGH;
+ if (l2h->priv.iso15693.vicc_two_subc)
+ tx_req.head.flags |= RFID_15693_F_SUBC_TWO;
+ memcpy(&tx_req.uid, l2h->uid, ISO15693_UID_LEN);
+ tx_len = sizeof(tx_req);
+
+ DEBUGP("tx_len=%u", tx_len); DEBUGPC(" rx_len=%u\n",rx_len);
+
+ ret = iso15693_transceive(l2h, RFID_15693_FRAME, (u_int8_t*)&tx_req,
+ tx_len, (u_int8_t*)&rx_buf, &rx_len, 10,0);
+
+ l2h->priv.iso15693.state = RFID_15693_STATE_QUIET;
+
+ DEBUGP("ret: %d%s, error_flag: %d", ret,(ret==-ETIMEDOUT)?"(TIMEOUT)":"",
+ rx_buf.head.flags&RFID_15693_RF_ERROR);
+ if (rx_buf.head.flags&RFID_15693_RF_ERROR)
+ DEBUGPC(" -> error: %02x\n", rx_buf.error);
+ else
+ DEBUGPC("\n");
+
+ return 0;