|
@@ -176,6 +176,27 @@ static void nci_init_complete_req(struct nci_dev *ndev, unsigned long opt)
|
|
|
(1 + ((*num) * sizeof(struct disc_map_config))), &cmd);
|
|
|
}
|
|
|
|
|
|
+struct nci_set_config_param {
|
|
|
+ __u8 id;
|
|
|
+ size_t len;
|
|
|
+ __u8 *val;
|
|
|
+};
|
|
|
+
|
|
|
+static void nci_set_config_req(struct nci_dev *ndev, unsigned long opt)
|
|
|
+{
|
|
|
+ struct nci_set_config_param *param = (struct nci_set_config_param *)opt;
|
|
|
+ struct nci_core_set_config_cmd cmd;
|
|
|
+
|
|
|
+ BUG_ON(param->len > NCI_MAX_PARAM_LEN);
|
|
|
+
|
|
|
+ cmd.num_params = 1;
|
|
|
+ cmd.param.id = param->id;
|
|
|
+ cmd.param.len = param->len;
|
|
|
+ memcpy(cmd.param.val, param->val, param->len);
|
|
|
+
|
|
|
+ nci_send_cmd(ndev, NCI_OP_CORE_SET_CONFIG_CMD, (3 + param->len), &cmd);
|
|
|
+}
|
|
|
+
|
|
|
static void nci_rf_discover_req(struct nci_dev *ndev, unsigned long opt)
|
|
|
{
|
|
|
struct nci_rf_disc_cmd cmd;
|
|
@@ -388,6 +409,32 @@ static int nci_dev_down(struct nfc_dev *nfc_dev)
|
|
|
return nci_close_device(ndev);
|
|
|
}
|
|
|
|
|
|
+static int nci_set_local_general_bytes(struct nfc_dev *nfc_dev)
|
|
|
+{
|
|
|
+ struct nci_dev *ndev = nfc_get_drvdata(nfc_dev);
|
|
|
+ struct nci_set_config_param param;
|
|
|
+ __u8 local_gb[NFC_MAX_GT_LEN];
|
|
|
+ int i, rc = 0;
|
|
|
+
|
|
|
+ param.val = nfc_get_local_general_bytes(nfc_dev, ¶m.len);
|
|
|
+ if ((param.val == NULL) || (param.len == 0))
|
|
|
+ return rc;
|
|
|
+
|
|
|
+ if (param.len > NCI_MAX_PARAM_LEN)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ for (i = 0; i < param.len; i++)
|
|
|
+ local_gb[param.len-1-i] = param.val[i];
|
|
|
+
|
|
|
+ param.id = NCI_PN_ATR_REQ_GEN_BYTES;
|
|
|
+ param.val = local_gb;
|
|
|
+
|
|
|
+ rc = nci_request(ndev, nci_set_config_req, (unsigned long)¶m,
|
|
|
+ msecs_to_jiffies(NCI_SET_CONFIG_TIMEOUT));
|
|
|
+
|
|
|
+ return rc;
|
|
|
+}
|
|
|
+
|
|
|
static int nci_start_poll(struct nfc_dev *nfc_dev,
|
|
|
__u32 im_protocols, __u32 tm_protocols)
|
|
|
{
|
|
@@ -415,6 +462,14 @@ static int nci_start_poll(struct nfc_dev *nfc_dev,
|
|
|
return -EBUSY;
|
|
|
}
|
|
|
|
|
|
+ if (im_protocols & NFC_PROTO_NFC_DEP_MASK) {
|
|
|
+ rc = nci_set_local_general_bytes(nfc_dev);
|
|
|
+ if (rc) {
|
|
|
+ pr_err("failed to set local general bytes\n");
|
|
|
+ return rc;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
rc = nci_request(ndev, nci_rf_discover_req, im_protocols,
|
|
|
msecs_to_jiffies(NCI_RF_DISC_TIMEOUT));
|
|
|
|