Commit 322bce95 authored by Samuel Ortiz's avatar Samuel Ortiz

NFC: pn533: Copy NFCID2 through ATR_REQ

When using NFC-F we should copy the NFCID2 buffer that we got from
SENSF_RES through the ATR_REQ NFCID3 buffer. Not doing so violates
NFC Forum digital requirement #189.
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 31c44464
...@@ -1235,7 +1235,7 @@ static int pn533_target_found_type_a(struct nfc_target *nfc_tgt, u8 *tgt_data, ...@@ -1235,7 +1235,7 @@ static int pn533_target_found_type_a(struct nfc_target *nfc_tgt, u8 *tgt_data,
struct pn533_target_felica { struct pn533_target_felica {
u8 pol_res; u8 pol_res;
u8 opcode; u8 opcode;
u8 nfcid2[8]; u8 nfcid2[NFC_NFCID2_MAXSIZE];
u8 pad[8]; u8 pad[8];
/* optional */ /* optional */
u8 syst_code[]; u8 syst_code[];
...@@ -1275,6 +1275,9 @@ static int pn533_target_found_felica(struct nfc_target *nfc_tgt, u8 *tgt_data, ...@@ -1275,6 +1275,9 @@ static int pn533_target_found_felica(struct nfc_target *nfc_tgt, u8 *tgt_data,
memcpy(nfc_tgt->sensf_res, &tgt_felica->opcode, 9); memcpy(nfc_tgt->sensf_res, &tgt_felica->opcode, 9);
nfc_tgt->sensf_res_len = 9; nfc_tgt->sensf_res_len = 9;
memcpy(nfc_tgt->nfcid2, tgt_felica->nfcid2, NFC_NFCID2_MAXSIZE);
nfc_tgt->nfcid2_len = NFC_NFCID2_MAXSIZE;
return 0; return 0;
} }
...@@ -2084,6 +2087,9 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target, ...@@ -2084,6 +2087,9 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target,
if (comm_mode == NFC_COMM_PASSIVE) if (comm_mode == NFC_COMM_PASSIVE)
skb_len += PASSIVE_DATA_LEN; skb_len += PASSIVE_DATA_LEN;
if (target && target->nfcid2_len)
skb_len += NFC_NFCID3_MAXSIZE;
skb = pn533_alloc_skb(dev, skb_len); skb = pn533_alloc_skb(dev, skb_len);
if (!skb) if (!skb)
return -ENOMEM; return -ENOMEM;
...@@ -2100,6 +2106,12 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target, ...@@ -2100,6 +2106,12 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target,
*next |= 1; *next |= 1;
} }
if (target && target->nfcid2_len) {
memcpy(skb_put(skb, NFC_NFCID3_MAXSIZE), target->nfcid2,
target->nfcid2_len);
*next |= 2;
}
if (gb != NULL && gb_len > 0) { if (gb != NULL && gb_len > 0) {
memcpy(skb_put(skb, gb_len), gb, gb_len); memcpy(skb_put(skb, gb_len), gb, gb_len);
*next |= 4; /* We have some Gi */ *next |= 4; /* We have some Gi */
......
...@@ -84,6 +84,8 @@ struct nfc_target { ...@@ -84,6 +84,8 @@ struct nfc_target {
u8 sel_res; u8 sel_res;
u8 nfcid1_len; u8 nfcid1_len;
u8 nfcid1[NFC_NFCID1_MAXSIZE]; u8 nfcid1[NFC_NFCID1_MAXSIZE];
u8 nfcid2_len;
u8 nfcid2[NFC_NFCID2_MAXSIZE];
u8 sensb_res_len; u8 sensb_res_len;
u8 sensb_res[NFC_SENSB_RES_MAXSIZE]; u8 sensb_res[NFC_SENSB_RES_MAXSIZE];
u8 sensf_res_len; u8 sensf_res_len;
......
...@@ -164,6 +164,8 @@ enum nfc_sdp_attr { ...@@ -164,6 +164,8 @@ enum nfc_sdp_attr {
#define NFC_DEVICE_NAME_MAXSIZE 8 #define NFC_DEVICE_NAME_MAXSIZE 8
#define NFC_NFCID1_MAXSIZE 10 #define NFC_NFCID1_MAXSIZE 10
#define NFC_NFCID2_MAXSIZE 8
#define NFC_NFCID3_MAXSIZE 10
#define NFC_SENSB_RES_MAXSIZE 12 #define NFC_SENSB_RES_MAXSIZE 12
#define NFC_SENSF_RES_MAXSIZE 18 #define NFC_SENSF_RES_MAXSIZE 18
#define NFC_GB_MAXSIZE 48 #define NFC_GB_MAXSIZE 48
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment