Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 314199
b: refs/heads/master
c: 51d9e80
h: refs/heads/master
i:
  314197: ecd7667
  314195: 2725358
  314191: ee4b8d5
v: v3
  • Loading branch information
Samuel Ortiz committed Jun 4, 2012
1 parent 4787bd4 commit 3b1bb57
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d7f3345d3af568394080890ca3136c4ea1021cba
refs/heads/master: 51d9e803b906ea8ef995980d5367ab66ff79305a
25 changes: 24 additions & 1 deletion trunk/drivers/nfc/pn533.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}

Expand Down

0 comments on commit 3b1bb57

Please sign in to comment.