Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 314198
b: refs/heads/master
c: d7f3345
h: refs/heads/master
v: v3
  • Loading branch information
Samuel Ortiz committed Jun 4, 2012
1 parent ecd7667 commit 4787bd4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 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: 34a85bfcfb84fe673833290ee071de0a10dd1cac
refs/heads/master: d7f3345d3af568394080890ca3136c4ea1021cba
23 changes: 18 additions & 5 deletions trunk/drivers/nfc/pn533.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ struct pn533_cmd_jump_dep {
u8 active;
u8 baud;
u8 next;
u8 gt[];
u8 data[];
} __packed;

struct pn533_cmd_jump_dep_response {
Expand Down Expand Up @@ -1582,12 +1582,14 @@ static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg,
return 0;
}

#define PASSIVE_DATA_LEN 5
static int pn533_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target,
u8 comm_mode, u8* gb, size_t gb_len)
{
struct pn533 *dev = nfc_get_drvdata(nfc_dev);
struct pn533_cmd_jump_dep *cmd;
u8 cmd_len;
u8 cmd_len, *data_ptr;
u8 passive_data[PASSIVE_DATA_LEN] = {0x00, 0xff, 0xff, 0x00, 0x3};
int rc;

nfc_dev_dbg(&dev->interface->dev, "%s", __func__);
Expand All @@ -1605,17 +1607,28 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target,
}

cmd_len = sizeof(struct pn533_cmd_jump_dep) + gb_len;
if (comm_mode == NFC_COMM_PASSIVE)
cmd_len += PASSIVE_DATA_LEN;

cmd = kzalloc(cmd_len, GFP_KERNEL);
if (cmd == NULL)
return -ENOMEM;

pn533_tx_frame_init(dev->out_frame, PN533_CMD_IN_JUMP_FOR_DEP);

cmd->active = !comm_mode;
cmd->baud = 0;
cmd->next = 0;
cmd->baud = 2;
data_ptr = cmd->data;
if (comm_mode == NFC_COMM_PASSIVE && cmd->baud > 0) {
memcpy(data_ptr, passive_data, PASSIVE_DATA_LEN);
cmd->next |= 1;
data_ptr += PASSIVE_DATA_LEN;
}

if (gb != NULL && gb_len > 0) {
cmd->next = 4; /* We have some Gi */
memcpy(cmd->gt, gb, gb_len);
cmd->next |= 4; /* We have some Gi */
memcpy(data_ptr, gb, gb_len);
} else {
cmd->next = 0;
}
Expand Down

0 comments on commit 4787bd4

Please sign in to comment.