Input: remove race when instantiating polled device attributes
[linux/fpc-iii.git] / net / nfc / digital_technology.c
blob251c8c753ebe0f48be67beadff61ec10b8a843b1
1 /*
2 * NFC Digital Protocol stack
3 * Copyright (c) 2013, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
16 #define pr_fmt(fmt) "digital: %s: " fmt, __func__
18 #include "digital.h"
20 #define DIGITAL_CMD_SENS_REQ 0x26
21 #define DIGITAL_CMD_ALL_REQ 0x52
22 #define DIGITAL_CMD_SEL_REQ_CL1 0x93
23 #define DIGITAL_CMD_SEL_REQ_CL2 0x95
24 #define DIGITAL_CMD_SEL_REQ_CL3 0x97
26 #define DIGITAL_SDD_REQ_SEL_PAR 0x20
28 #define DIGITAL_SDD_RES_CT 0x88
29 #define DIGITAL_SDD_RES_LEN 5
31 #define DIGITAL_SEL_RES_NFCID1_COMPLETE(sel_res) (!((sel_res) & 0x04))
32 #define DIGITAL_SEL_RES_IS_T2T(sel_res) (!((sel_res) & 0x60))
33 #define DIGITAL_SEL_RES_IS_NFC_DEP(sel_res) ((sel_res) & 0x40)
35 #define DIGITAL_SENS_RES_IS_T1T(sens_res) (((sens_res) & 0x0C00) == 0x0C00)
36 #define DIGITAL_SENS_RES_IS_VALID(sens_res) \
37 ((!((sens_res) & 0x001F) && (((sens_res) & 0x0C00) == 0x0C00)) || \
38 (((sens_res) & 0x001F) && ((sens_res) & 0x0C00) != 0x0C00))
40 #define DIGITAL_MIFARE_READ_RES_LEN 16
41 #define DIGITAL_MIFARE_ACK_RES 0x0A
43 #define DIGITAL_CMD_SENSF_REQ 0x00
44 #define DIGITAL_CMD_SENSF_RES 0x01
46 #define DIGITAL_SENSF_RES_MIN_LENGTH 17
47 #define DIGITAL_SENSF_RES_RD_AP_B1 0x00
48 #define DIGITAL_SENSF_RES_RD_AP_B2 0x8F
50 #define DIGITAL_SENSF_REQ_RC_NONE 0
51 #define DIGITAL_SENSF_REQ_RC_SC 1
52 #define DIGITAL_SENSF_REQ_RC_AP 2
54 struct digital_sdd_res {
55 u8 nfcid1[4];
56 u8 bcc;
57 } __packed;
59 struct digital_sel_req {
60 u8 sel_cmd;
61 u8 b2;
62 u8 nfcid1[4];
63 u8 bcc;
64 } __packed;
66 struct digital_sensf_req {
67 u8 cmd;
68 u8 sc1;
69 u8 sc2;
70 u8 rc;
71 u8 tsn;
72 } __packed;
74 struct digital_sensf_res {
75 u8 cmd;
76 u8 nfcid2[8];
77 u8 pad0[2];
78 u8 pad1[3];
79 u8 mrti_check;
80 u8 mrti_update;
81 u8 pad2;
82 u8 rd[2];
83 } __packed;
85 static int digital_in_send_sdd_req(struct nfc_digital_dev *ddev,
86 struct nfc_target *target);
88 static void digital_in_recv_sel_res(struct nfc_digital_dev *ddev, void *arg,
89 struct sk_buff *resp)
91 struct nfc_target *target = arg;
92 int rc;
93 u8 sel_res;
94 u8 nfc_proto;
96 if (IS_ERR(resp)) {
97 rc = PTR_ERR(resp);
98 resp = NULL;
99 goto exit;
102 if (!DIGITAL_DRV_CAPS_IN_CRC(ddev)) {
103 rc = digital_skb_check_crc_a(resp);
104 if (rc) {
105 PROTOCOL_ERR("4.4.1.3");
106 goto exit;
110 if (!resp->len) {
111 rc = -EIO;
112 goto exit;
115 sel_res = resp->data[0];
117 if (!DIGITAL_SEL_RES_NFCID1_COMPLETE(sel_res)) {
118 rc = digital_in_send_sdd_req(ddev, target);
119 if (rc)
120 goto exit;
122 goto exit_free_skb;
125 if (DIGITAL_SEL_RES_IS_T2T(sel_res)) {
126 nfc_proto = NFC_PROTO_MIFARE;
127 } else if (DIGITAL_SEL_RES_IS_NFC_DEP(sel_res)) {
128 nfc_proto = NFC_PROTO_NFC_DEP;
129 } else {
130 rc = -EOPNOTSUPP;
131 goto exit;
134 target->sel_res = sel_res;
136 rc = digital_target_found(ddev, target, nfc_proto);
138 exit:
139 kfree(target);
141 exit_free_skb:
142 dev_kfree_skb(resp);
144 if (rc)
145 digital_poll_next_tech(ddev);
148 static int digital_in_send_sel_req(struct nfc_digital_dev *ddev,
149 struct nfc_target *target,
150 struct digital_sdd_res *sdd_res)
152 struct sk_buff *skb;
153 struct digital_sel_req *sel_req;
154 u8 sel_cmd;
155 int rc;
157 skb = digital_skb_alloc(ddev, sizeof(struct digital_sel_req));
158 if (!skb)
159 return -ENOMEM;
161 skb_put(skb, sizeof(struct digital_sel_req));
162 sel_req = (struct digital_sel_req *)skb->data;
164 if (target->nfcid1_len <= 4)
165 sel_cmd = DIGITAL_CMD_SEL_REQ_CL1;
166 else if (target->nfcid1_len < 10)
167 sel_cmd = DIGITAL_CMD_SEL_REQ_CL2;
168 else
169 sel_cmd = DIGITAL_CMD_SEL_REQ_CL3;
171 sel_req->sel_cmd = sel_cmd;
172 sel_req->b2 = 0x70;
173 memcpy(sel_req->nfcid1, sdd_res->nfcid1, 4);
174 sel_req->bcc = sdd_res->bcc;
176 if (DIGITAL_DRV_CAPS_IN_CRC(ddev)) {
177 rc = digital_in_configure_hw(ddev, NFC_DIGITAL_CONFIG_FRAMING,
178 NFC_DIGITAL_FRAMING_NFCA_STANDARD_WITH_CRC_A);
179 if (rc)
180 goto exit;
181 } else {
182 digital_skb_add_crc_a(skb);
185 rc = digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sel_res,
186 target);
187 exit:
188 if (rc)
189 kfree_skb(skb);
191 return rc;
194 static void digital_in_recv_sdd_res(struct nfc_digital_dev *ddev, void *arg,
195 struct sk_buff *resp)
197 struct nfc_target *target = arg;
198 struct digital_sdd_res *sdd_res;
199 int rc;
200 u8 offset, size;
201 u8 i, bcc;
203 if (IS_ERR(resp)) {
204 rc = PTR_ERR(resp);
205 resp = NULL;
206 goto exit;
209 if (resp->len < DIGITAL_SDD_RES_LEN) {
210 PROTOCOL_ERR("4.7.2.8");
211 rc = -EINVAL;
212 goto exit;
215 sdd_res = (struct digital_sdd_res *)resp->data;
217 for (i = 0, bcc = 0; i < 4; i++)
218 bcc ^= sdd_res->nfcid1[i];
220 if (bcc != sdd_res->bcc) {
221 PROTOCOL_ERR("4.7.2.6");
222 rc = -EINVAL;
223 goto exit;
226 if (sdd_res->nfcid1[0] == DIGITAL_SDD_RES_CT) {
227 offset = 1;
228 size = 3;
229 } else {
230 offset = 0;
231 size = 4;
234 memcpy(target->nfcid1 + target->nfcid1_len, sdd_res->nfcid1 + offset,
235 size);
236 target->nfcid1_len += size;
238 rc = digital_in_send_sel_req(ddev, target, sdd_res);
240 exit:
241 dev_kfree_skb(resp);
243 if (rc) {
244 kfree(target);
245 digital_poll_next_tech(ddev);
249 static int digital_in_send_sdd_req(struct nfc_digital_dev *ddev,
250 struct nfc_target *target)
252 int rc;
253 struct sk_buff *skb;
254 u8 sel_cmd;
256 rc = digital_in_configure_hw(ddev, NFC_DIGITAL_CONFIG_FRAMING,
257 NFC_DIGITAL_FRAMING_NFCA_STANDARD);
258 if (rc)
259 return rc;
261 skb = digital_skb_alloc(ddev, 2);
262 if (!skb)
263 return -ENOMEM;
265 if (target->nfcid1_len == 0)
266 sel_cmd = DIGITAL_CMD_SEL_REQ_CL1;
267 else if (target->nfcid1_len == 3)
268 sel_cmd = DIGITAL_CMD_SEL_REQ_CL2;
269 else
270 sel_cmd = DIGITAL_CMD_SEL_REQ_CL3;
272 *skb_put(skb, sizeof(u8)) = sel_cmd;
273 *skb_put(skb, sizeof(u8)) = DIGITAL_SDD_REQ_SEL_PAR;
275 return digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sdd_res,
276 target);
279 static void digital_in_recv_sens_res(struct nfc_digital_dev *ddev, void *arg,
280 struct sk_buff *resp)
282 struct nfc_target *target = NULL;
283 int rc;
285 if (IS_ERR(resp)) {
286 rc = PTR_ERR(resp);
287 resp = NULL;
288 goto exit;
291 if (resp->len < sizeof(u16)) {
292 rc = -EIO;
293 goto exit;
296 target = kzalloc(sizeof(struct nfc_target), GFP_KERNEL);
297 if (!target) {
298 rc = -ENOMEM;
299 goto exit;
302 target->sens_res = __le16_to_cpu(*(__le16 *)resp->data);
304 if (!DIGITAL_SENS_RES_IS_VALID(target->sens_res)) {
305 PROTOCOL_ERR("4.6.3.3");
306 rc = -EINVAL;
307 goto exit;
310 if (DIGITAL_SENS_RES_IS_T1T(target->sens_res))
311 rc = digital_target_found(ddev, target, NFC_PROTO_JEWEL);
312 else
313 rc = digital_in_send_sdd_req(ddev, target);
315 exit:
316 dev_kfree_skb(resp);
318 if (rc) {
319 kfree(target);
320 digital_poll_next_tech(ddev);
324 int digital_in_send_sens_req(struct nfc_digital_dev *ddev, u8 rf_tech)
326 struct sk_buff *skb;
327 int rc;
329 rc = digital_in_configure_hw(ddev, NFC_DIGITAL_CONFIG_RF_TECH,
330 NFC_DIGITAL_RF_TECH_106A);
331 if (rc)
332 return rc;
334 rc = digital_in_configure_hw(ddev, NFC_DIGITAL_CONFIG_FRAMING,
335 NFC_DIGITAL_FRAMING_NFCA_SHORT);
336 if (rc)
337 return rc;
339 skb = digital_skb_alloc(ddev, 1);
340 if (!skb)
341 return -ENOMEM;
343 *skb_put(skb, sizeof(u8)) = DIGITAL_CMD_SENS_REQ;
345 rc = digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sens_res, NULL);
346 if (rc)
347 kfree_skb(skb);
349 return rc;
352 int digital_in_recv_mifare_res(struct sk_buff *resp)
354 /* Successful READ command response is 16 data bytes + 2 CRC bytes long.
355 * Since the driver can't differentiate a ACK/NACK response from a valid
356 * READ response, the CRC calculation must be handled at digital level
357 * even if the driver supports it for this technology.
359 if (resp->len == DIGITAL_MIFARE_READ_RES_LEN + DIGITAL_CRC_LEN) {
360 if (digital_skb_check_crc_a(resp)) {
361 PROTOCOL_ERR("9.4.1.2");
362 return -EIO;
365 return 0;
368 /* ACK response (i.e. successful WRITE). */
369 if (resp->len == 1 && resp->data[0] == DIGITAL_MIFARE_ACK_RES) {
370 resp->data[0] = 0;
371 return 0;
374 /* NACK and any other responses are treated as error. */
375 return -EIO;
378 static void digital_in_recv_sensf_res(struct nfc_digital_dev *ddev, void *arg,
379 struct sk_buff *resp)
381 int rc;
382 u8 proto;
383 struct nfc_target target;
384 struct digital_sensf_res *sensf_res;
386 if (IS_ERR(resp)) {
387 rc = PTR_ERR(resp);
388 resp = NULL;
389 goto exit;
392 if (resp->len < DIGITAL_SENSF_RES_MIN_LENGTH) {
393 rc = -EIO;
394 goto exit;
397 if (!DIGITAL_DRV_CAPS_IN_CRC(ddev)) {
398 rc = digital_skb_check_crc_f(resp);
399 if (rc) {
400 PROTOCOL_ERR("6.4.1.8");
401 goto exit;
405 skb_pull(resp, 1);
407 memset(&target, 0, sizeof(struct nfc_target));
409 sensf_res = (struct digital_sensf_res *)resp->data;
411 memcpy(target.sensf_res, sensf_res, resp->len);
412 target.sensf_res_len = resp->len;
414 memcpy(target.nfcid2, sensf_res->nfcid2, NFC_NFCID2_MAXSIZE);
415 target.nfcid2_len = NFC_NFCID2_MAXSIZE;
417 if (target.nfcid2[0] == DIGITAL_SENSF_NFCID2_NFC_DEP_B1 &&
418 target.nfcid2[1] == DIGITAL_SENSF_NFCID2_NFC_DEP_B2)
419 proto = NFC_PROTO_NFC_DEP;
420 else
421 proto = NFC_PROTO_FELICA;
423 rc = digital_target_found(ddev, &target, proto);
425 exit:
426 dev_kfree_skb(resp);
428 if (rc)
429 digital_poll_next_tech(ddev);
432 int digital_in_send_sensf_req(struct nfc_digital_dev *ddev, u8 rf_tech)
434 struct digital_sensf_req *sensf_req;
435 struct sk_buff *skb;
436 int rc;
437 u8 size;
439 rc = digital_in_configure_hw(ddev, NFC_DIGITAL_CONFIG_RF_TECH, rf_tech);
440 if (rc)
441 return rc;
443 rc = digital_in_configure_hw(ddev, NFC_DIGITAL_CONFIG_FRAMING,
444 NFC_DIGITAL_FRAMING_NFCF);
445 if (rc)
446 return rc;
448 size = sizeof(struct digital_sensf_req);
450 skb = digital_skb_alloc(ddev, size);
451 if (!skb)
452 return -ENOMEM;
454 skb_put(skb, size);
456 sensf_req = (struct digital_sensf_req *)skb->data;
457 sensf_req->cmd = DIGITAL_CMD_SENSF_REQ;
458 sensf_req->sc1 = 0xFF;
459 sensf_req->sc2 = 0xFF;
460 sensf_req->rc = 0;
461 sensf_req->tsn = 0;
463 *skb_push(skb, 1) = size + 1;
465 if (!DIGITAL_DRV_CAPS_IN_CRC(ddev))
466 digital_skb_add_crc_f(skb);
468 rc = digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sensf_res,
469 NULL);
470 if (rc)
471 kfree_skb(skb);
473 return rc;
476 static int digital_tg_send_sel_res(struct nfc_digital_dev *ddev)
478 struct sk_buff *skb;
479 int rc;
481 skb = digital_skb_alloc(ddev, 1);
482 if (!skb)
483 return -ENOMEM;
485 *skb_put(skb, 1) = DIGITAL_SEL_RES_NFC_DEP;
487 if (!DIGITAL_DRV_CAPS_TG_CRC(ddev))
488 digital_skb_add_crc_a(skb);
490 rc = digital_tg_send_cmd(ddev, skb, 300, digital_tg_recv_atr_req,
491 NULL);
492 if (rc)
493 kfree_skb(skb);
495 return rc;
498 static void digital_tg_recv_sel_req(struct nfc_digital_dev *ddev, void *arg,
499 struct sk_buff *resp)
501 int rc;
503 if (IS_ERR(resp)) {
504 rc = PTR_ERR(resp);
505 resp = NULL;
506 goto exit;
509 if (!DIGITAL_DRV_CAPS_TG_CRC(ddev)) {
510 rc = digital_skb_check_crc_a(resp);
511 if (rc) {
512 PROTOCOL_ERR("4.4.1.3");
513 goto exit;
517 /* Silently ignore SEL_REQ content and send a SEL_RES for NFC-DEP */
519 rc = digital_tg_send_sel_res(ddev);
521 exit:
522 if (rc)
523 digital_poll_next_tech(ddev);
525 dev_kfree_skb(resp);
528 static int digital_tg_send_sdd_res(struct nfc_digital_dev *ddev)
530 struct sk_buff *skb;
531 struct digital_sdd_res *sdd_res;
532 int rc, i;
534 skb = digital_skb_alloc(ddev, sizeof(struct digital_sdd_res));
535 if (!skb)
536 return -ENOMEM;
538 skb_put(skb, sizeof(struct digital_sdd_res));
539 sdd_res = (struct digital_sdd_res *)skb->data;
541 sdd_res->nfcid1[0] = 0x08;
542 get_random_bytes(sdd_res->nfcid1 + 1, 3);
544 sdd_res->bcc = 0;
545 for (i = 0; i < 4; i++)
546 sdd_res->bcc ^= sdd_res->nfcid1[i];
548 rc = digital_tg_send_cmd(ddev, skb, 300, digital_tg_recv_sel_req,
549 NULL);
550 if (rc)
551 kfree_skb(skb);
553 return rc;
556 static void digital_tg_recv_sdd_req(struct nfc_digital_dev *ddev, void *arg,
557 struct sk_buff *resp)
559 u8 *sdd_req;
560 int rc;
562 if (IS_ERR(resp)) {
563 rc = PTR_ERR(resp);
564 resp = NULL;
565 goto exit;
568 sdd_req = resp->data;
570 if (resp->len < 2 || sdd_req[0] != DIGITAL_CMD_SEL_REQ_CL1 ||
571 sdd_req[1] != DIGITAL_SDD_REQ_SEL_PAR) {
572 rc = -EINVAL;
573 goto exit;
576 rc = digital_tg_send_sdd_res(ddev);
578 exit:
579 if (rc)
580 digital_poll_next_tech(ddev);
582 dev_kfree_skb(resp);
585 static int digital_tg_send_sens_res(struct nfc_digital_dev *ddev)
587 struct sk_buff *skb;
588 u8 *sens_res;
589 int rc;
591 skb = digital_skb_alloc(ddev, 2);
592 if (!skb)
593 return -ENOMEM;
595 sens_res = skb_put(skb, 2);
597 sens_res[0] = (DIGITAL_SENS_RES_NFC_DEP >> 8) & 0xFF;
598 sens_res[1] = DIGITAL_SENS_RES_NFC_DEP & 0xFF;
600 rc = digital_tg_send_cmd(ddev, skb, 300, digital_tg_recv_sdd_req,
601 NULL);
602 if (rc)
603 kfree_skb(skb);
605 return rc;
608 void digital_tg_recv_sens_req(struct nfc_digital_dev *ddev, void *arg,
609 struct sk_buff *resp)
611 u8 sens_req;
612 int rc;
614 if (IS_ERR(resp)) {
615 rc = PTR_ERR(resp);
616 resp = NULL;
617 goto exit;
620 sens_req = resp->data[0];
622 if (!resp->len || (sens_req != DIGITAL_CMD_SENS_REQ &&
623 sens_req != DIGITAL_CMD_ALL_REQ)) {
624 rc = -EINVAL;
625 goto exit;
628 rc = digital_tg_send_sens_res(ddev);
630 exit:
631 if (rc)
632 digital_poll_next_tech(ddev);
634 dev_kfree_skb(resp);
637 static int digital_tg_send_sensf_res(struct nfc_digital_dev *ddev,
638 struct digital_sensf_req *sensf_req)
640 struct sk_buff *skb;
641 u8 size;
642 int rc;
643 struct digital_sensf_res *sensf_res;
645 size = sizeof(struct digital_sensf_res);
647 if (sensf_req->rc != DIGITAL_SENSF_REQ_RC_NONE)
648 size -= sizeof(sensf_res->rd);
650 skb = digital_skb_alloc(ddev, size);
651 if (!skb)
652 return -ENOMEM;
654 skb_put(skb, size);
656 sensf_res = (struct digital_sensf_res *)skb->data;
658 memset(sensf_res, 0, size);
660 sensf_res->cmd = DIGITAL_CMD_SENSF_RES;
661 sensf_res->nfcid2[0] = DIGITAL_SENSF_NFCID2_NFC_DEP_B1;
662 sensf_res->nfcid2[1] = DIGITAL_SENSF_NFCID2_NFC_DEP_B2;
663 get_random_bytes(&sensf_res->nfcid2[2], 6);
665 switch (sensf_req->rc) {
666 case DIGITAL_SENSF_REQ_RC_SC:
667 sensf_res->rd[0] = sensf_req->sc1;
668 sensf_res->rd[1] = sensf_req->sc2;
669 break;
670 case DIGITAL_SENSF_REQ_RC_AP:
671 sensf_res->rd[0] = DIGITAL_SENSF_RES_RD_AP_B1;
672 sensf_res->rd[1] = DIGITAL_SENSF_RES_RD_AP_B2;
673 break;
676 *skb_push(skb, sizeof(u8)) = size + 1;
678 if (!DIGITAL_DRV_CAPS_TG_CRC(ddev))
679 digital_skb_add_crc_f(skb);
681 rc = digital_tg_send_cmd(ddev, skb, 300,
682 digital_tg_recv_atr_req, NULL);
683 if (rc)
684 kfree_skb(skb);
686 return rc;
689 void digital_tg_recv_sensf_req(struct nfc_digital_dev *ddev, void *arg,
690 struct sk_buff *resp)
692 struct digital_sensf_req *sensf_req;
693 int rc;
695 if (IS_ERR(resp)) {
696 rc = PTR_ERR(resp);
697 resp = NULL;
698 goto exit;
701 if (!DIGITAL_DRV_CAPS_TG_CRC(ddev)) {
702 rc = digital_skb_check_crc_f(resp);
703 if (rc) {
704 PROTOCOL_ERR("6.4.1.8");
705 goto exit;
709 if (resp->len != sizeof(struct digital_sensf_req) + 1) {
710 rc = -EINVAL;
711 goto exit;
714 skb_pull(resp, 1);
715 sensf_req = (struct digital_sensf_req *)resp->data;
717 if (sensf_req->cmd != DIGITAL_CMD_SENSF_REQ) {
718 rc = -EINVAL;
719 goto exit;
722 rc = digital_tg_send_sensf_res(ddev, sensf_req);
724 exit:
725 if (rc)
726 digital_poll_next_tech(ddev);
728 dev_kfree_skb(resp);
731 int digital_tg_listen_nfca(struct nfc_digital_dev *ddev, u8 rf_tech)
733 int rc;
735 rc = digital_tg_configure_hw(ddev, NFC_DIGITAL_CONFIG_RF_TECH, rf_tech);
736 if (rc)
737 return rc;
739 rc = digital_tg_configure_hw(ddev, NFC_DIGITAL_CONFIG_FRAMING,
740 NFC_DIGITAL_FRAMING_NFCA_NFC_DEP);
741 if (rc)
742 return rc;
744 return digital_tg_listen(ddev, 300, digital_tg_recv_sens_req, NULL);
747 int digital_tg_listen_nfcf(struct nfc_digital_dev *ddev, u8 rf_tech)
749 int rc;
750 u8 *nfcid2;
752 rc = digital_tg_configure_hw(ddev, NFC_DIGITAL_CONFIG_RF_TECH, rf_tech);
753 if (rc)
754 return rc;
756 rc = digital_tg_configure_hw(ddev, NFC_DIGITAL_CONFIG_FRAMING,
757 NFC_DIGITAL_FRAMING_NFCF_NFC_DEP);
758 if (rc)
759 return rc;
761 nfcid2 = kzalloc(NFC_NFCID2_MAXSIZE, GFP_KERNEL);
762 if (!nfcid2)
763 return -ENOMEM;
765 nfcid2[0] = DIGITAL_SENSF_NFCID2_NFC_DEP_B1;
766 nfcid2[1] = DIGITAL_SENSF_NFCID2_NFC_DEP_B2;
767 get_random_bytes(nfcid2 + 2, NFC_NFCID2_MAXSIZE - 2);
769 return digital_tg_listen(ddev, 300, digital_tg_recv_sensf_req, nfcid2);