diff options
author | Christophe Ricard <christophe.ricard@gmail.com> | 2014-05-21 00:21:55 +0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2014-07-23 03:04:31 +0400 |
commit | 8e9466ccda297c0844a606910152787ce9133b24 (patch) | |
tree | 722839a3d90c00dceff70da306c65b0863609809 /drivers/nfc | |
parent | cf577344e2ece0798046402fd88472473c6e7ee8 (diff) | |
download | linux-8e9466ccda297c0844a606910152787ce9133b24.tar.xz |
NFC: st21nfca: Improved start of frame detection
A start of frame is 7E 00 not only 7E. Make sure the first read sequence is
starting with 7E 00.
For example: 7E FF FF FF FF is as a correct crc but it is a bad frame.
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc')
-rw-r--r-- | drivers/nfc/st21nfca/i2c.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/nfc/st21nfca/i2c.c b/drivers/nfc/st21nfca/i2c.c index d10d837fb888..70564b3f2ab2 100644 --- a/drivers/nfc/st21nfca/i2c.c +++ b/drivers/nfc/st21nfca/i2c.c @@ -397,12 +397,11 @@ static int st21nfca_hci_i2c_read(struct st21nfca_i2c_phy *phy, * The first read sequence does not start with SOF. * Data is corrupeted so we drop it. */ - if (!phy->current_read_len && buf[0] != ST21NFCA_SOF_EOF) { + if (!phy->current_read_len && !IS_START_OF_FRAME(buf)) { skb_trim(skb, 0); phy->current_read_len = 0; return -EIO; - } else if (phy->current_read_len && - IS_START_OF_FRAME(buf)) { + } else if (phy->current_read_len && IS_START_OF_FRAME(buf)) { /* * Previous frame transmission was interrupted and * the frame got repeated. |