From patchwork Thu Jul 12 18:27:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Ortiz X-Patchwork-Id: 1190271 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id CC1ED3FDAE for ; Thu, 12 Jul 2012 18:28:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932833Ab2GLS16 (ORCPT ); Thu, 12 Jul 2012 14:27:58 -0400 Received: from mga09.intel.com ([134.134.136.24]:7925 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932690Ab2GLS16 (ORCPT ); Thu, 12 Jul 2012 14:27:58 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 12 Jul 2012 11:27:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.67,352,1309762800"; d="scan'208";a="165028662" Received: from unknown (HELO sortiz-mobl) ([10.252.121.31]) by orsmga001.jf.intel.com with ESMTP; 12 Jul 2012 11:27:55 -0700 Date: Thu, 12 Jul 2012 20:27:54 +0200 From: Samuel Ortiz To: "John W. Linville" Cc: Lauro Ramos Venancio , Aloisio Almeida Jr , Ilan Elias , linux-wireless@vger.kernel.org, linux-nfc@lists.01.org, Eric Lapuyade Subject: [PATCH 1/2 v2] NFC: Set target nfcid1 for all HCI reader A targets Message-ID: <20120712182754.GE23772@sortiz-mobl> References: <1342113454-23110-1-git-send-email-sameo@linux.intel.com> <1342113454-23110-2-git-send-email-sameo@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1342113454-23110-2-git-send-email-sameo@linux.intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Eric Lapuyade Without the discovered target nfcid1 and its length set properly, type 2 tags detection fails with the pn544 as it checks for them from pn544_hci_complete_target_discovered(). Signed-off-by: Eric Lapuyade Reported-by: Mathias Jeppsson Signed-off-by: Samuel Ortiz --- v2: Add proper changelog and fix a checkpatch warning --- net/nfc/hci/core.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c index e1a640d..c48f534 100644 --- a/net/nfc/hci/core.c +++ b/net/nfc/hci/core.c @@ -170,6 +170,7 @@ static int nfc_hci_target_discovered(struct nfc_hci_dev *hdev, u8 gate) struct nfc_target *targets; struct sk_buff *atqa_skb = NULL; struct sk_buff *sak_skb = NULL; + struct sk_buff *uid_skb = NULL; int r; pr_debug("from gate %d\n", gate); @@ -205,6 +206,19 @@ static int nfc_hci_target_discovered(struct nfc_hci_dev *hdev, u8 gate) targets->sens_res = be16_to_cpu(*(u16 *)atqa_skb->data); targets->sel_res = sak_skb->data[0]; + r = nfc_hci_get_param(hdev, NFC_HCI_RF_READER_A_GATE, + NFC_HCI_RF_READER_A_UID, &uid_skb); + if (r < 0) + goto exit; + + if (uid_skb->len == 0 || uid_skb->len > NFC_NFCID1_MAXSIZE) { + r = -EPROTO; + goto exit; + } + + memcpy(targets->nfcid1, uid_skb->data, uid_skb->len); + targets->nfcid1_len = uid_skb->len; + if (hdev->ops->complete_target_discovered) { r = hdev->ops->complete_target_discovered(hdev, gate, targets); @@ -240,6 +254,7 @@ exit: kfree(targets); kfree_skb(atqa_skb); kfree_skb(sak_skb); + kfree_skb(uid_skb); return r; }