summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2012-05-30 01:48:46 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2012-06-04 21:34:32 +0200
commit51d9e803b906ea8ef995980d5367ab66ff79305a (patch)
treeba43cb0d22074d89b825d31fb88afd1966ee8dcc
parentd7f3345d3af568394080890ca3136c4ea1021cba (diff)
downloadop-kernel-dev-51d9e803b906ea8ef995980d5367ab66ff79305a.zip
op-kernel-dev-51d9e803b906ea8ef995980d5367ab66ff79305a.tar.gz
NFC: Add type A and type F parameters for pn533 target mode
Without those settings several devices will not activate pn533 as a target. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/nfc/pn533.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c
index 806ab3d..6e4b228 100644
--- a/drivers/nfc/pn533.c
+++ b/drivers/nfc/pn533.c
@@ -1126,6 +1126,13 @@ static int pn533_init_target_frame(struct pn533_frame *frame,
{
struct pn533_cmd_init_target *cmd;
size_t cmd_len;
+ u8 felica_params[18] = {0x1, 0xfe, /* DEP */
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, /* random */
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0xff, 0xff}; /* System code */
+ u8 mifare_params[6] = {0x1, 0x1, /* SENS_RES */
+ 0x0, 0x0, 0x0,
+ 0x40}; /* SEL_RES for DEP */
cmd_len = sizeof(struct pn533_cmd_init_target) + gb_len + 1;
cmd = kzalloc(cmd_len, GFP_KERNEL);
@@ -1136,17 +1143,33 @@ static int pn533_init_target_frame(struct pn533_frame *frame,
/* DEP support only */
cmd->mode |= PN533_INIT_TARGET_DEP;
- get_random_bytes(cmd->nfcid3, 10);
+
+ /* Felica params */
+ memcpy(cmd->felica, felica_params, 18);
+ get_random_bytes(cmd->felica + 2, 6);
+
+ /* NFCID3 */
+ memset(cmd->nfcid3, 0, 10);
+ memcpy(cmd->nfcid3, cmd->felica, 8);
+
+ /* MIFARE params */
+ memcpy(cmd->mifare, mifare_params, 6);
+
+ /* General bytes */
cmd->gb_len = gb_len;
memcpy(cmd->gb, gb, gb_len);
+
/* Len Tk */
cmd->gb[gb_len] = 0;
memcpy(PN533_FRAME_CMD_PARAMS_PTR(frame), cmd, cmd_len);
+
frame->datalen += cmd_len;
pn533_tx_frame_finish(frame);
+ kfree(cmd);
+
return 0;
}
OpenPOWER on IntegriCloud