summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Stop "LLC length mis-match" log spamstaging/cm-12.1stable/cm-12.1-YOG7Dstable/cm-12.1-YOG4Pstable/cm-12.1-YOG3Cstable/cm-12.0-YNG4Nstable/cm-12.0-YNG3Cstable/cm-12.0-YNG1TAstable/cm-12.0-YNG1Tstable/cm-12.0-YNG1Icm-12.1cm-12.0Vladislav Koldobskiy2014-12-061-1/+1
| | | | | | | | | | Happens on all Sony fusion3 devices, probably others. The message is not present in stock libnfc.so, most probably Sony decided to remove/comment it too. PS2: change to ALOGV instead... Change-Id: Ib4faa0c571747a874eb582f411bf464622f25d92
* libnfc-nxp: Add alternate firmware pathSteve Kondik2014-12-061-3/+6
| | | | | | | * Check in /system/lib for firmware as well, so we can be bug-for-bug compatible with OEMs. Change-Id: Iea350c3d0a58a1f6012c2a088f8ba6fed4b10365
* nfx-nxp: add NFCSTATUS_FAILEDdoug yeager2014-12-062-2/+6
| | | | | | | | | | | | | | | | On some handsets, there is a configuration of hardware that causes a conflict with HCE. Primarily it is something in the SWP configuration with a SWP sim card. It appears to be a PN544 register setting that blocks HCE type A only from initialization. This patch checks for this conflict and disables HCE for those configurations. The better way would be to understand how to set the PN544 registers to unblock the conflict, but this is a sufficient work around for this minority of configurations. Change-Id: I64d79acaa7eb58e15f1fb4bbe298883036f6d45a
* card emulation patch port to JBdoug yeager2014-12-0619-1157/+4955
| | | | Change-Id: I86657f9c547840de33c35df4912b5f282d4fe459
* Updated path for seperate vendor partitionstaging/cm-12.0-cafstable/cm-13.0-ZNH2KBstable/cm-13.0-ZNH2Kstable/cm-13.0-ZNH0EDaniel Rosenberg2014-06-131-1/+1
| | | | | Change-Id: I116b76d844c5c89e068acc55430d93c7de8bc61e Signed-off-by: Daniel Rosenberg <drosen@google.com>
* libnfc-nxp: fix build for 64-bitColin Cross2014-03-215-23/+23
| | | | | | | | Turn off unused parameter warnings to unclutter the build output When storing an int in a void*, use intptr_t to cast between them Store pointer handles in an intptr_t or a uintptr_t Change-Id: If48290ca23dd295f1a87220c5b1d5232ebdc8d45
* Fix crash in reader mode.Martijn Coenen2013-09-132-7/+9
| | | | | | | | | | | | | The connect callback wasn't cleared in error cases, which could cause spurious callbacks including data that used to be allocated on the stack, and has been freed by now. Also, always add the -3a tech for any IsoDep target, even if the remote device has the P2P bit set. Bug: 10360259 Change-Id: I73141c4a1106f66ff89c6b1c53c4977e9cb78fa1
* Return NFCSTATUS_BUSY in case of invalid state transition.Martijn Coenen2013-04-252-2/+9
| | | | | | | This allows the caller to recovery by trying again. Bug: 8552749 Change-Id: Iff979c097d33f9adda06654de9e588595daf89a3
* Restore SE activated mode in case of failure.Martijn Coenen2013-04-121-0/+3
| | | | | | | | | | | | | There is a tight race condition where opening of the SE can fail, due to a tag/p2p device having just come in. In that case, restore the original state of the SE activated mode. This will prevent future calls into this method and Connect() from immediately bailing out. Bug: 8599167 Change-Id: I1890e4efb73a9f5bdd6abe0644f88051b32e8c02
* Make sure LLCP header fields are reset.Martijn Coenen2013-03-062-12/+11
| | | | | | | | | | | In some conditions these would persist over a link tear-down, causing them to be sent out the next time the link comes up. Also, don't overwrite them if a send is still in progress. Change-Id: I19dec5d79ae4b25f41fb5e8a0514e565ceca7a91
* Fix wrong callback being cleared.Martijn Coenen2013-03-054-9/+9
| | | | | | | | | | | When a call to disconnect() failed, the connect() callback was cleared, not the disconnect() one. This would cause deadlocks, where JNI threads were forever blocked on doConnect(). Bug: 7324226 Change-Id: I784c8d700c87d643315f2417610ca75ef8f9aa7c
* Fix some LLCP threading issues.Martijn Coenen2013-03-055-156/+181
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Android we now start connecting SNEP/other LLCP services as soon as the link comes up. That means we will have connect requests incoming, accept responses outgoing, connect requests outgoing and accept responses incoming. This lays bare a lot of threading issues in this lib. Since the receives come in serialized, those typically do not cause any issue. However, we may be sending something on a thread coming from the NfcService, while at the same time we'll receive for example a connect frame from the remote, to which the receive thread immediately wants to send a response. This is a first attempt at making sends thread-safe: already there was a lot of logic to deal with the fact that another send was in progress, in the form of the bSendPending variable. That variable was however not checked atomically, and some operations did not even set it correctly. This change tests and sets that variable atomically, more or less implementing a semaphore with try-acquires and fallbacks for the failure case. The generic structure is: if (testAndSetSendPending()) { // Another thread is sending, stash data // and most importantly do *NOT* change shared data } else { // We're now the only one sending, we're free // to change shared data until the callback is // called. } This is just a band-aid fix, but given the fact that this stack will be deprecated it is hopefully enough for our planned usecases. A decent fix would involve switching to a TX-queue per socket, and a generic TX-queue for the whole LLCP link. This allows us to fully decouple the connection layer from the transport layer, as it should be. Change-Id: Ibd8742f7350a58459771f5036a049af3a487f783
* Immediately bounce back SYMM packet when initiator.Martijn Coenen2013-02-281-6/+19
| | | | | | | | | | | | | | On first establishment of the LLCP link, if we are the initiator, we waited the full LTO before sending the SYMM to the target. This will prevent the target from communicating with us for 750ms! Old Android implementations only connected LLCP on touch, but newer ones will immediately connect LLCP. To solve this, bounce the SYMM back immediately, to allow the target to start sending as soon as it wants to. Change-Id: I2fb09599798527f2e6f908b8ba362e0061120be2
* NDEF Type 3 tag reading with padding bytesSunil Jogi2012-11-271-1/+13
| | | | | | | | NDEF Type 3 tag reading was not ignoring the padding bytes, which leads to failure of parsing the NDEF data. This patch fix that problem. Bug: 7600630 Change-Id: I45cf1841bdc343503a8a12d622ac8470c3e64ce4
* am cbef2c80: Merge "HCI ANY_OPEN_PIPE on identity management gate crash fix"Jeff Hamilton2012-08-291-0/+1
|\ | | | | | | | | * commit 'cbef2c806acfba5b63963844fccfe3fae975d6bd': HCI ANY_OPEN_PIPE on identity management gate crash fix
| * Merge "HCI ANY_OPEN_PIPE on identity management gate crash fix"Jeff Hamilton2012-08-291-0/+1
| |\
| | * HCI ANY_OPEN_PIPE on identity management gate crash fixDejan REBRACA2012-08-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apparently, host identity management gate does not support HCI commands coming from another host (including host controller). This patch fixes a tombstone when receiving an HCI command from another host, but still doesn't have a mechanism to treat the command. Change-Id: Ib72df6bac8f503f2b66998ee6e687ae99c15d17b Author: Dejan Rebraca <dejanx.rebraca@intel.com> Signed-off-by: Dejan Rebraca <dejanx.rebraca@intel.com> Signed-off-by: Sebastian Niciarz <sebastian.niciarz@intel.com> Singed-off-by: Shuo Gao <shuo.gao@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com> Signed-off-by: Jack Ren <jack.ren@intel.com> Author-tracking-BZ: 42426
* | | am 1985108c: Merge "Support of topaz tag NFC Forum version number 1.1"Jeff Hamilton2012-08-291-1/+4
|\| | | | | | | | | | | | | | * commit '1985108ceba65f0b01d5c4c41da49073c5d01230': Support of topaz tag NFC Forum version number 1.1
| * | Support of topaz tag NFC Forum version number 1.1Dejan REBRACA2012-08-141-1/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The latest version of NFC forum Tag type 1 spec is 1.1. This version number needs to be supported by libnfc to support Topaz tags V1.1 with dynamic content. Version number is part of capability container which resides in segment 1 of EEPROM memory of the tag. For older versions of Tag type 1, NFC device may be backward compatible. Change-Id: Ibbfa720d2e34c2f2612579e368f31f4a5c66b465 Author: Dejan REBRACA <dejanx.rebraca@intel.com> Signed-off-by: Dejan REBRACA <dejanx.rebraca@intel.com> Signed-off-by: Sebastian Niciarz <sebastian.niciarz@intel.com> Singed-off-by: Shuo Gao <shuo.gao@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com> Signed-off-by: Jack Ren <jack.ren@intel.com> Author-tracking-BZ: 33236
* | phHal4Nfc_ADD: fix memcpy overlapNick Kralevich2012-07-171-5/+8
| | | | | | | | | | | | | | | | | | | | Don't call memcpy when src==dest. It's undefined. When memcpy overlap detection is enabled, this causes the NFC process to crash and burn. Bug: 6826770 Change-Id: I199af98e453953de288964f47248cb59af4deecb
* | phFriNfc_OvrHal: fix memcpy overlapNick Kralevich2012-07-171-1/+4
|/ | | | | | | | | | Don't use the API workaround when OvrHal->TranceiveInfo.sRecvData.buffer == pRecvdata->buffer. When memcpy overlap detection is enabled, this causes the NFC process to crash and burn. memcpy is undefined when src=dest. Bug: 6826770 Change-Id: Iebc8f82a4f86d560e764cef2229a7f86fa642783
* Revert "Added addr field in response of Jewel command"Martijn Coenen2012-06-141-63/+0
| | | | | | | This reverts commit c0da27e8f303bf459797f90f9f2e67c552ae8c27. Bug: 6666792 Change-Id: Icf6aa84a750d2e4855487a6e46959019a09e4a95
* Fix wrong extern variable sizeSunil Jogi2012-05-231-1/+1
| | | | | | | nxp_nfc_felica_timeout originally uint8_t but current source has uint32_t. Changed to uint8_t to fix the problem. Without fix it overwrite the other global memory region which can create problem in other section of code.
* Merge "Added recovery function when SE wired mode selected"Martijn Coenen2012-04-202-0/+16
|\
| * Added recovery function when SE wired mode selectedSunil Jogi2012-04-132-0/+16
| | | | | | | | | | | | | | | | Added a recovery function with delay when SE wired mode selected. This function will add extra delay before any abort when SE is in wired mode. This will allow SE to complete any operation and do not power off the SE immediately when wired mode transaction is on going.
* | Fix T2T makeReadonly.Martijn Coenen2012-04-191-1/+1
| | | | | | | | Change-Id: Ie4a87d23034cfdbb3c1db227a7f54c2e1a45c98c
* | Added addr field in response of Jewel commandSunil Jogi2012-04-171-0/+63
|/ | | | | | | | | Most of the Jewel command response includes the address which is sent as part of command. The response of Jewel command was missing address field. This patch fix that problem by adding the missing addr field. Bug: 5341397 Change-Id: Icba0b37dd9987bc34c3490fa12ebda51ac25ad1e
* Added support for tearing recovery for MIFARE Classic ReadonlySunil Jogi2012-04-023-14/+16
| | | | | | | | When readonly is interrupted in between next readonly call make remaining sectors readonly and return true. If all sectors are readonly then call to readonly returns error. Change-Id: Id47a77198b41d69b743f24259849e943954c7a58
* Mifare readonly support.Sunil Jogi2012-04-027-22/+455
| | | | | | | | This patch requires changes done in following projects submited as patches: 1. packages/apps/Nfc 2. frameworks/base Change-Id: I9036309d82dd897e77f6bc14c30fbde255bf955c
* Patch to support MIFARE with SAK 0x01Sunil Jogi2012-04-025-4/+9
| | | | Change-Id: Ifb1389d428855c2eea99390790af13f28571097a
* Don't dump nfc target/initiator modes to system log.Martijn Coenen2012-03-161-2/+2
| | | | Change-Id: I1938f348704f6fabefa6600ecf32ff7d6204d021
* am bbda0171: am 65ce3454: Merge "Fix one coding error of using a temporary ↵Nick Pelly2012-03-071-1/+1
|\ | | | | | | | | | | | | variable in the global structure NdefMap" * commit 'bbda017196474931e686669f0b6bc749f6dc1b0a': Fix one coding error of using a temporary variable in the global structure NdefMap
| * Fix one coding error of using a temporary variable in the global structure ↵Jack Ren2012-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NdefMap In the following code: the local variable PacketDataLength is a local variable in stack, but used in the ndefMap which is a global structure. When the function phFriNfc_NdefMap_EraseNdef( ) returns, the PacketDataLength will be freed, too. If it is used later via the pointer in NdefMap, will cause some of potential issues. Fix it by re-define it as static. NFCSTATUS phFriNfc_NdefMap_EraseNdef(phFriNfc_NdefMap_t *NdefMap) { NFCSTATUS status = NFCSTATUS_PENDING; static uint8_t PktData[3] = PH_FRINFC_NDEFMAP_EMPTY_NDEF_MSG; uint8_t MemOffset = PH_FRINFC_NDEFMAP_SEEK_BEGIN; uint32_t PacketDataLength = sizeof(PktData); ... /* Mifare card selected. Call Mifare Write */ status = phFriNfc_NdefMap_WrNdef( NdefMap, PktData, &PacketDataLength, MemOffset); break; ... } Change-Id: Iee278fe39749619aa44c620138eae85a46f6e4a5 Signed-off-by: Dejan REBRACA <dejanx.rebraca@intel.com> Signed-off-by: Ken Wahid <kenx.wahid@intel.com> Signed-off-by: Jack Ren <jack.ren@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
* | Support for handling of proprietry TLV in T4TSunil Jogi2012-03-051-1/+1
| | | | | | | | | | | | | | If CC file is including proprietory TLV then Check NDEF was returning tag is not NDEF compilant. This patch fix that problem. Change-Id: I28e7701c7d6e78de8b19b93d09789c09fa9357bd
* | Skip proprietry TLV for Type 2Sunil Jogi2012-03-051-1/+3
| | | | | | | | | | | | | | Skipping proprietry TLV for Type 2 reading if it is present. Earlier Type 2 tag was not detected as NDEF tag is proprietry TLV present. Change-Id: Ia3ca722790f4a990fe976617aecbbdf6a7d53570
* | (DEBUG) Add support for setting p2p modes.Martijn Coenen2012-02-172-3/+31
| | | | | | | | Change-Id: Ic6df1fc458cef2531119e5e5e2ef5f9a7b21a524
* | Fix NFCSTATUS_BUSY responses after doing p2p.Martijn Coenen2012-02-061-2/+3
| | | | | | | | | | | | | | LLCP state was not reset properly. Bug: 5971895 Change-Id: I4fda6ef7c78ae2730359cf5c90d887d205e57799
* | Fixed FRMR sending on invalid LLCP frame receivedSunil Jogi2012-02-062-12/+12
| | | | | | | | | | | | | | DSAP and SSAP were switched on with the other at multiple location in the code. This patch fix those. Change-Id: Iea8e499049a2cd4a234155a3044b875eb9c6ca7a
* | Handle inbound buffering in LLCP connectionless socketsSunil Jogi2012-01-303-67/+171
| | | | | | | | | | | | | | | | This enables the server to avoid losing packets, especially when receiving them in an aggregated packet. The size of the buffer is determined by the size of the working buffer provided by the application. Change-Id: Ia3c72e19fdb74e2a43390af5607c497c2275fe46
* | Fixed rejected receive request in LLCPSunil Jogi2012-01-301-1/+1
| | | | | | | | | | | | | | | | If phLibNfc_Llcp_Recv() is called in the callback of a previous phLibNfc_Llcp_Recv(), it could be rejected due to the bSocketRecvPending flag which was not properly reset. Change-Id: I6c41469480b50bb7adc9a721ec96f715e5d56a60
* | Fixed wrong callbacks callSunil Jogi2012-01-301-19/+17
| | | | | | | | | | | | Call the callback only if the context is not null. Change-Id: I783d9e8ddedb2546eff85837826703db189f9f59
* | Increase internal LLCP buffers to fit max MIUSunil Jogi2012-01-271-2/+2
| | | | | | | | | | | | | | | | Interal buffer increased to 2178 = 3 (max LLCP header size) + 128 (default MIU) + 2047 (max MIU) Change-Id: I3cc2ff705e74ae657d93b5e50a577b0e7e5ebfcf
* | Reset LLCP socket internal variables before next use.Sunil Jogi2012-01-271-0/+6
| | | | | | | | | | | | | | | | Some internal variables used in reveive window checkings were not reset on socket closure/re-opening. This was leading to have the send() function waiting forever for remote acknowledgments. Change-Id: Ic7741b004de80af3f851f620842d46c42f654804
* | Update for LLCP V(SA) internal variableSunil Jogi2012-01-271-6/+3
| | | | | | | | | | | | | | | | | | | | The V(SA) is an internal variable used in LLCP connection-oriented data links to check receive window conditions. It corresponds to the last frame number acknowledged by remote peer + 1. The patch makes sure this variable is updated evry time it is needed. Change-Id: Ie5ac925a6f1dfa19b22ac2b6e96659440d5daf21
* | LLCP 1.1: Fix some bugs.Martijn Coenen2012-01-272-3/+14
| | | | | | | | | | | | | | - Clear out send callback if send was not accepted. - Set transport busy status for RR/RNR frames. Change-Id: Idf8986f6b82995644b176247a644e36d2c879ebf
* | Adding support for handling maximum length supported by peerSunil Jogi2012-01-274-21/+34
| | | | | | | | | | | | | | Support for chaining is added based on maximum length supported by and passed in ATS by peer and maximum length supported by the device. Change-Id: I8f9f8468ff8ac9d3579bc8b6afbe3e2072e56de8
* | LLCP 1.1 implementation.Sunil Jogi2012-01-2710-108/+911
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, in LLCP v1.0, the only way to use the SDP (Service Discovery Protocol) service was to send a CONNECT frame containing the Service Name to the SDP service. This was implicitly preforming a connection request to the requested service. LLCP v1.1 introduced a way to discover services more efficiently and without implicit connection. It also enables connectionless services to have a service name. It is based on a new protocol based on a new SNL frame containing discovery requests and responses. This update comes with new APIs: - phLibNfc_Llcp_DiscoverServices() function can be used to discover remote services. It can take multiple service names and resolve all of them in a single call. - Register service name at bind time. Cache LLCP service name/sap pairs. In LLCP 1.1 specification defines at section 5.9 that any service lookup answer must be valid for the whole LLCP session duration. To enforce this, we cache the SAP/SN pairs locally and make sure that the applications don't break the cache. The stack remains fully retro-compatible with v1.0 devices. Change-Id: I052edd3838013cee65e7415d0ed01fc3e9cad36d
* | LLCP 1.1: allow pending operations on connectionless.Sunil Jogi2012-01-276-469/+595
| | | | | | | | | | | | | | | | | | | | | | | | | | The pending operations were handled at the connection-oriented sockets level, with no possibility for other transport types to handle pending operations. A dispatcher has been added at the generic transport level to remove this limitation. This feature is needed to implement LLCP v1.1. Change-Id: I69e37ba800d1c531396ca97ab0a0480e0f53d63f
* | Don't overwrite psUpperLayerContext when reconfiguring the SE.Martijn Coenen2012-01-202-54/+49
| | | | | | | | | | | | | | This fixes one of the crashes occuring when turning the screen off during p2p transfers. One remaining. Change-Id: I3e45be9b8f4be40350ba4dd9db7e596631206bd1
* | Clear out send/recv callbacks for connectionless sockets.Martijn Coenen2012-01-201-3/+14
| | | | | | | | | | | | | | | | | | | | When a connectionless socket is closed, Connectionless_Abort() is called, which in turn calls the send and receive callbacks to indicate abortion. But since these callbacks are not cleared out after a previous send/receive has completed, this can lead to spurious callbacks and consequently memory corruption. Change-Id: Iea7a34829c4db1cae3b49f33117b25b50205683f