forked from Minki/linux
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>
This commit is contained in:
parent
d7f3345d3a
commit
51d9e803b9
@ -1126,6 +1126,13 @@ static int pn533_init_target_frame(struct pn533_frame *frame,
|
|||||||
{
|
{
|
||||||
struct pn533_cmd_init_target *cmd;
|
struct pn533_cmd_init_target *cmd;
|
||||||
size_t cmd_len;
|
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_len = sizeof(struct pn533_cmd_init_target) + gb_len + 1;
|
||||||
cmd = kzalloc(cmd_len, GFP_KERNEL);
|
cmd = kzalloc(cmd_len, GFP_KERNEL);
|
||||||
@ -1136,17 +1143,33 @@ static int pn533_init_target_frame(struct pn533_frame *frame,
|
|||||||
|
|
||||||
/* DEP support only */
|
/* DEP support only */
|
||||||
cmd->mode |= PN533_INIT_TARGET_DEP;
|
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;
|
cmd->gb_len = gb_len;
|
||||||
memcpy(cmd->gb, gb, gb_len);
|
memcpy(cmd->gb, gb, gb_len);
|
||||||
|
|
||||||
/* Len Tk */
|
/* Len Tk */
|
||||||
cmd->gb[gb_len] = 0;
|
cmd->gb[gb_len] = 0;
|
||||||
|
|
||||||
memcpy(PN533_FRAME_CMD_PARAMS_PTR(frame), cmd, cmd_len);
|
memcpy(PN533_FRAME_CMD_PARAMS_PTR(frame), cmd, cmd_len);
|
||||||
|
|
||||||
frame->datalen += cmd_len;
|
frame->datalen += cmd_len;
|
||||||
|
|
||||||
pn533_tx_frame_finish(frame);
|
pn533_tx_frame_finish(frame);
|
||||||
|
|
||||||
|
kfree(cmd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user