Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relax Frame transmission success criteria #13

Merged
merged 1 commit into from Sep 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 25 additions & 3 deletions src/nci_target.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2019-2021 Jolla Ltd.
* Copyright (C) 2019-2021 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2019-2022 Jolla Ltd.
* Copyright (C) 2019-2022 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
Expand Down Expand Up @@ -287,8 +287,30 @@ nci_target_transmit_finish_frame(
/*
* 8.2 Frame RF Interface
* 8.2.1.2 Data from RF to the DH
*
* For NFC-A and NFC-B the Data Message SHALL correspond to the
* Payload of the Data and Payload Format defined in [DIGITAL]
* Section 4.4 for NFC-A and 5.4 for NFC-B followed by a Status
* field of 1 octet.
* ...
* If the RF frame was received correctly, the NFCC SHALL set the
* Status field of Data Message to a value of STATUS_OK. If the
* NFCC detected an error when receiving the RF frame, the NFCC
* SHALL set the Status field of the Data Message to a value of
* STATUS_RF_FRAME_CORRUPTED.
*/
if (status == NCI_STATUS_OK) {
if (status != NCI_STATUS_RF_FRAME_CORRUPTED) {
/*
* Since the spec (see above) defines only two valid status
* values, STATUS_OK and STATUS_RF_FRAME_CORRUPTED, let's
* treat anything other than STATUS_RF_FRAME_CORRUPTED as
* a success. In reality we're getting other (undocumented)
* status values on some devices, e.g. 0x14 which doesn't
* seem to be harmful.
*/
if (status != NCI_STATUS_OK) {
GDEBUG("Hmm... transmission status 0x%02x", status);
}
nfc_target_transmit_done(target, NFC_TRANSMIT_STATUS_OK,
payload, len - 1);
return TRUE;
Expand Down