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

NFC not working properly #57

Open
danielegobbetti opened this issue Oct 12, 2016 · 18 comments
Open

NFC not working properly #57

danielegobbetti opened this issue Oct 12, 2016 · 18 comments

Comments

@danielegobbetti
Copy link

When running AOSP 6.0.1 every attempt to use NFC and android beam (between Z3C and galaxy nexus) fail. Even "standard" NFC does not work. For instance this sequence of messages is repeated many times when bringing my yubikey neo next to the back of the device:

10-12 16:53:41.680  5075  5403 D NfcAdaptation: NfcAdaptation::HalDeviceContextDataCallback: len=4
10-12 16:53:41.681  5075  5312 I BrcmNfcNfa: NFC received ntf gid:0
10-12 16:53:41.681  5075  5312 I BrcmNfcNfa: nci_proc_core_ntf opcode:0x7
10-12 16:53:41.682  5075  5312 I BrcmNfcNfa: nfa_dm_nfc_response_cback () NFC_GEN_ERROR_REVT(0x500d)
10-12 16:53:41.682  5075  5312 I BrcmNfcNfa: nfa_dm_disc_data_cback ()
10-12 16:53:41.682  5075  5312 I BrcmNfcNfa: nfa_dm_disc_sm_execute (): state: DISCOVERY (1), event: INTF_ERROR_NTF(10) disc_flags: 0x1
10-12 16:53:41.683  5075  5312 I BrcmNfcNfa: nfa_dm_disc_sm_execute (): new state: DISCOVERY (1), disc_flags: 0x1
@danielegobbetti
Copy link
Author

FYI the same happens on android 7

@danielegobbetti
Copy link
Author

I hope that sonyxperiadev/kernel#954 helps, will test.

@danielegobbetti
Copy link
Author

danielegobbetti commented Nov 30, 2016

still not working unfortunately, but the errors seems to be at a different level:

11-30 12:46:34.831  5105  8650 I NfcService: Enabling NFC
11-30 12:46:34.847  5105  8650 D BrcmNfcJni: nfcManager_doInitialize: enter; ver=NFCDROID-AOSP_M_00.01 nfa=NFA_PI_1.03.66+ NCI_VERSION=0x10
11-30 12:46:34.847  5105  8650 D BrcmNfcJni: PowerSwitch::initialize: level=PS-FULL (1)
11-30 12:46:34.848  5105  8650 D NfcAdaptation: bool CNfcConfig::readConfig(const char *, bool) Opened base config /etc/libnfc-brcm.conf
11-30 12:46:34.875  5105  8650 D NfcAdaptation: const CNfcParam *CNfcConfig::find(const char *) const found SCREEN_OFF_POWER_STATE=(0x1)
11-30 12:46:34.875  5105  8650 D BrcmNfcJni: PowerSwitch::initialize: desired screen-off state=1
11-30 12:46:34.875  5105  8650 D NfcAdaptation: NfcAdaptation::Initialize: enter
11-30 12:46:34.877  5105  8650 E NfcAdaptation: NfcAdaptation::Initialize: ver=NFCDROID-AOSP_M_00.01 nfa=NFA_PI_1.03.66+
11-30 12:46:34.877  5105  8650 D NfcAdaptation: const CNfcParam *CNfcConfig::find(const char *) const found NFA_STORAGE=/data/nfc
11-30 12:46:34.877  5105  8650 D NfcAdaptation: const CNfcParam *CNfcConfig::find(const char *) const found PROTOCOL_TRACE_LEVEL=(0xFFFFFFFF)
11-30 12:46:34.877  5105  8650 D NfcAdaptation: const CNfcParam *CNfcConfig::find(const char *) const found APPL_TRACE_LEVEL=(0xFF)
11-30 12:46:34.877  5105  8650 D BrcmNfcJni: initializeGlobalAppLogLevel: level=5
11-30 12:46:34.877  5105  8650 D NfcNciHal: crcChecksumVerifyIntegrity: filename=/data/nfc/nfaStorage.bin1
11-30 12:46:34.877  5105  8650 D NfcNciHal: crcChecksumVerifyIntegrity: data size=228
11-30 12:46:34.878  5105  8650 D NfcNciHal: crcChecksumVerifyIntegrity: filename=/data/nfc/nfaStorage.bin2
11-30 12:46:34.878  5105  8650 D NfcNciHal: crcChecksumVerifyIntegrity: filename=/data/nfc/nfaStorage.bin3
11-30 12:46:34.878  5105  8650 D NfcNciHal: crcChecksumVerifyIntegrity: filename=/data/nfc/nfaStorage.bin4
...
11-30 12:46:46.119  5105  5105 D BrcmNfcJni: nativeNfcTag_doRead: enter
11-30 12:46:46.119  5105  5105 I BrcmNfcNfa: NFA_RwReadNDef
11-30 12:46:46.120  5105  8654 I BrcmNfcNfa: NFA got event 0x0600
11-30 12:46:46.120  5105  8654 I BrcmNfcNfa: nfa_rw_handle_event event: NFA_RW_OP_REQUEST_EVT (0x600), flags: 00000061
11-30 12:46:46.120  5105  8654 I BrcmNfcNfa: nfa_rw_handle_op_req: op=0x01
11-30 12:46:46.121  5105  8654 I BrcmNfcNfa: nfa_sys_ptim_stop_timer b2602a0c
11-30 12:46:46.121  5105  8654 I BrcmNfcNfa: ptim timer stop
11-30 12:46:46.121  5105  8654 I BrcmNfcNfa: Stopped presence check timer (if started)
11-30 12:46:46.121  5105  8654 I BrcmNfcNfa: nfa_rw_read_ndef
11-30 12:46:46.122  5105  8654 E BrcmNfcNfa: Unable to allocate a buffer for reading NDEF (size=-1302377596)
11-30 12:46:46.122  5105  8654 I BrcmNfcNfa: nfa_dm_act_conn_cback_notify (): event:0xB
11-30 12:46:46.122  5105  8654 D BrcmNfcJni: nfaConnectionCallback: event= 11
11-30 12:46:46.123  5105  8654 D BrcmNfcJni: nfaConnectionCallback: NFA_READ_CPLT_EVT: status = 0x3
11-30 12:46:46.123  5105  8654 D BrcmNfcJni: nativeNfcTag_doReadCompleted: status=0x3; is reading=1
11-30 12:46:46.123  5105  8654 I BrcmNfcNfa: nfa_dm_act_conn_cback_notify (): event:0xB
11-30 12:46:46.123  5105  8654 D BrcmNfcJni: nfaConnectionCallback: event= 11
11-30 12:46:46.124  5105  8654 D BrcmNfcJni: nfaConnectionCallback: NFA_READ_CPLT_EVT: status = 0x3
11-30 12:46:46.124  5105  5105 D BrcmNfcJni: nativeNfcTag_doRead: exit
11-30 12:46:46.124  5105  8654 D BrcmNfcJni: nativeNfcTag_doReadCompleted: status=0x3; is reading=0

@danielegobbetti
Copy link
Author

NFC is not working even after flashing the latest legacy blobs (v13, released a few days ago), but I noticed that this page lists the NFC as "ok".

I cannot use it with a yubikey, or any other NFC tag I have around. What needs to be done to get it working?

@jerpelea
Copy link
Collaborator

jerpelea commented Sep 1, 2017

the nfc is using firmware from NXP git
please check that you track corect branch of the local manifest

@danielegobbetti
Copy link
Author

@jerpelea I was on n-mr1, and I noticed that the build guide now mentions n-mr1_3.10
However, the diff between the branches does not show anything in the nxp.xml file. I will try to build again and report back.

@rancidfrog yes that log flooding is the same issue I am experiencing regarding NFC. As for trying other ROMs, honestly I am afraid of switching to other kernels as I don't have the competence to understand which changes might be "dangerous" in there (overvolting, thermal limits, etc.)

@danielegobbetti
Copy link
Author

@rancidfrog I agree with you.
It was a shame that msm8974 was abandoned upstream and I do thank sony for providing patches against android 7 removing the need of Vulkan.
Regarding call issues I managed to patch in fluence support by reading some comments here, afterwards echo/fixed volume issue was resolved.
Camera is indeed in a very poor state (not only regarding focus, but also regarding the exposure etc.) which is truly a shame as I remember back in the original ROM days the camera of my Z3C was truly awesome (compared to galaxy nexus).

@jerpelea
Copy link
Collaborator

jerpelea commented Sep 1, 2017

The best state for msm8974 was on android 6.0. With android 7.0 support was dropped by the SOC vendor. We are doing our best to keep devices as open source and updated as possible but unfortunately this means that the old ones can not keep up

@Myself5
Copy link

Myself5 commented Sep 1, 2017

@rancidfrog so please, show me the OnePlus Phone that works on AOSP and has an opensource camera HAL. Theres a big difference between releasing blobs that work with a CAF based ROM, and developing almost everything from the ground up to work with AOSP (which is what Sony does).

The new devices (tone, yoshino, loire) all learned from the history. maple (the Xperia XZ Premium) was DD ready a week after the official device release. That is a first for devices that were not made by Google. Even the OnePlus 5 was not having that. Cause against public belief, there was a lot of work needed to get the OnePlus 5 working. Some of the code that was worked in the process originated from The Sony Open Devices Program. (Yes, your OP5s NFC works because I fixed that.)

I'm not going to say that everything went buttersmooth with shinano and kitakami (and I was part of the stock blob based bringup on both of them due to that reason) BUT the newer devices are more than awesome.

So instead of spreading hate across all the forums, please limit it (especially in this thread) to helping with bugfixes.

@danielegobbetti as shinano has been abandoned I suggest to try the LineageOS devicetrees for shinano. They utilize the stock camera blobs (sadly for that the stock kernel and the stock camera hal is needed too).

P.S. Sorry, not sorry for the long truth.

@danielegobbetti
Copy link
Author

danielegobbetti commented Sep 2, 2017

@Myself5 , @jerpelea , I just added a new message after a long time because I noticed in the official page that lists the working bits, that NFC status is OK, and in my self compiled version that follows the instructions (to the best of my knowledge) this is not the case. :)
Since I am possibly doing something wrong, I wanted to understand what. As I can now confirm, even with the correct branch tracked in the local repo and the most recent binary blobs, NFC is NOT working for me. My test devices are a yubikey NEO and several NDEF tags (hence no mifare- card). I would appreciate if there was someone else who could try it, to understand whether it's me doing something wrong or the guides needing perhaps an update.

@Myself5 thanks for the advice, @jerpelea thanks for doing what you can. I realize it's not easy! 👍

@jerpelea
Copy link
Collaborator

jerpelea commented Sep 2, 2017

next weekend I will fire up a shinano build to check what happens

@Myself5
Copy link

Myself5 commented Sep 2, 2017

oh also @danielegobbetti as you seem to have specific issues with your Ubikey, does that maybe help you: CarbonROM/android_external_libnfc-nci@292e0e6 ?

@danielegobbetti
Copy link
Author

@Myself5 sorry for the late reply. Unfortunately the code in my working directory is already correct (git blame follows):

^e9df6ba (The Android Open Source Project 2012-12-13 14:55:37 -0800 2017)     case NFA_DM_RF_DISCOVER_NTF:
^e9df6ba (The Android Open Source Project 2012-12-13 14:55:37 -0800 2018)         nfa_dm_disc_new_state (NFA_DM_RFST_W4_ALL_DISCOVERIES);
^e9df6ba (The Android Open Source Project 2012-12-13 14:55:37 -0800 2019)         nfa_dm_notify_discovery (p_data);
^e9df6ba (The Android Open Source Project 2012-12-13 14:55:37 -0800 2020)         break;

@danielegobbetti
Copy link
Author

I noticed that the build guides were updated (removing the part with cherry picks). I built again and NFC is still not working here.

Also, @jerpelea, it's almost "next weekend" 👐 😉 :-)

@jerpelea
Copy link
Collaborator

jerpelea commented Sep 8, 2017

i know what i promissed :)
the cherry-pickes form the guide were moved to github in a script

@danielegobbetti
Copy link
Author

@jerpelea thanks! Looking forward to your results. Removing the (manually applied) cherry picks is a very welcome change! 👍

@jerpelea
Copy link
Collaborator

@danielegobbetti I tested the NFC and I send a picture using beam between Z3 and X both running AOSP

@danielegobbetti
Copy link
Author

@jerpelea thanks for testing. That is indeed weird as I cannot get it to work. Perhaps it's time for me to do a clean build, but my issue is mostly that Z3C is my daily driver :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants