Open lss4 opened 3 years ago
I'm having the same exact issue on my RP2 using Lineage OS 18.1 (Android 11) GSI.
It seems you can simply reproduce the issue by placing an NFC tag for reading.
You'll hear the NFC tag detection sound but it'll be interrupted shortly after as the NFC service crashes.
02-22 10:51:07.514 5543 5543 D NativeNfcTag: Connect to a tech with a different handle
02-22 10:51:07.597 5543 5543 D NativeNfcTag: Check NDEF Failed - status = 3
02-22 10:51:07.607 5543 5543 D NativeNfcTag: Check NDEF Failed - status = 3
02-22 10:51:07.607 5543 5543 D NativeNfcTag: Check NDEF Failed - status = 3
02-22 10:51:07.607 5543 5543 D NativeNfcTag: Connect to a tech with a different handle
02-22 10:51:07.628 5543 6037 E libnfc_nci: [ERROR:rw_mfc.cc(527)] RW_MfcDetectNDef
02-22 10:51:07.630 5543 6037 E libnfc_nci: [ERROR:rw_mfc.cc(876)] rw_mfc_readBlock: RW_MFC_SUBSTATE_WAIT_ACK
...
02-22 10:51:08.535 1095 6063 E NxpTml : _i2c_write() errno : 5
02-22 10:51:08.536 1095 6063 E NxpTml : PN54X - Error in I2C Write.....
02-22 10:51:08.536 1095 6065 E NxpHal : write error status = 0x1ff
02-22 10:51:08.536 1095 1095 E NxpHal : write_unlocked failed - PN54X Maybe in Standby Mode - Retry
02-22 10:51:08.542 1095 6063 E NxpTml : _i2c_write() errno : 5
02-22 10:51:08.542 1095 6063 E NxpTml : PN54X - Error in I2C Write.....
02-22 10:51:08.542 1095 6065 E NxpHal : write error status = 0x1ff
02-22 10:51:08.542 1095 1095 E NxpHal : write_unlocked failed - PN54X Maybe in Standby Mode - Retry
02-22 10:51:08.547 1095 6063 E NxpTml : _i2c_write() errno : 5
02-22 10:51:08.547 1095 6063 E NxpTml : PN54X - Error in I2C Write.....
02-22 10:51:08.547 1095 6065 E NxpHal : write error status = 0x1ff
02-22 10:51:08.547 1095 1095 E NxpHal : write_unlocked failed - PN54X Maybe in Standby Mode - Retry
02-22 10:51:08.553 1095 6063 E NxpTml : _i2c_write() errno : 5
02-22 10:51:08.553 1095 6063 E NxpTml : PN54X - Error in I2C Write.....
02-22 10:51:08.553 1095 6065 E NxpHal : write error status = 0x1ff
02-22 10:51:08.553 1095 1095 E NxpHal : write_unlocked failed - PN54X Maybe in Standby Mode - Retry
02-22 10:51:08.558 1095 6063 E NxpTml : _i2c_write() errno : 5
02-22 10:51:08.558 1095 6063 E NxpTml : PN54X - Error in I2C Write.....
02-22 10:51:08.558 1095 6065 E NxpHal : write error status = 0x1ff
02-22 10:51:08.559 1095 1095 E NxpHal : write_unlocked failed - PN54X Maybe in Standby Mode - Retry
02-22 10:51:08.564 1095 6063 E NxpTml : _i2c_write() errno : 5
02-22 10:51:08.564 1095 6063 E NxpTml : PN54X - Error in I2C Write.....
02-22 10:51:08.564 1095 6065 E NxpHal : write error status = 0x1ff
02-22 10:51:08.564 1095 1095 E NxpHal : write_unlocked failed - PN54X Maybe in Standby Mode (max count = 0x6)
02-22 10:51:08.716 5543 6037 E libnfc_nci: [ERROR:nfc_ncif.cc(1689)] reset notification!!:0xa0
02-22 10:51:08.716 5543 6037 E libnfc_nci: [ERROR:nfc_ncif.cc(137)] nfc_ncif_cmd_timeout
02-22 10:51:08.729 5543 6037 E libnfc_nci: [ERROR:NativeNfcManager.cpp(819)] nfaDeviceManagementCallback: NFA_DM_NFCC_TIMEOUT_EVT; abort
02-22 10:51:08.729 5543 6037 E libnfc_nci: [ERROR:NativeNfcManager.cpp(860)] nfaDeviceManagementCallback: crash NFC service
02-22 10:51:08.731 5543 5543 D NativeNfcTag: Check NDEF Failed - status = 3
02-22 10:51:08.735 5543 6037 F libc : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 6037 (Thread-3), pid 5543 (com.android.nfc)
02-22 10:51:08.737 5543 16226 D NativeNfcTag: Starting background presence check
...
02-22 10:51:08.795 5543 5596 D NativeNfcTag: Connect to a tech with a different handle
...
Then the same crash log as above.
The NFC service would attempt to recover but it'll eventually fail. The logcat seems to point to the QS tile handler...
And here's the question: Aside from the recovery failure I saw no other mentions of NFC in the logcat so it's possible the recovery never happened at all...
02-22 10:51:13.082 3219 3401 E NFC : NFC service dead - attempting to recover
02-22 10:51:13.082 3219 3401 E NFC : android.os.DeadObjectException
02-22 10:51:13.082 3219 3401 E NFC : at android.os.BinderProxy.transactNative(Native Method)
02-22 10:51:13.082 3219 3401 E NFC : at android.os.BinderProxy.transact(BinderProxy.java:550)
02-22 10:51:13.082 3219 3401 E NFC : at android.nfc.INfcAdapter$Stub$Proxy.getState(INfcAdapter.java:718)
02-22 10:51:13.082 3219 3401 E NFC : at android.nfc.NfcAdapter.isEnabled(NfcAdapter.java:851)
02-22 10:51:13.082 3219 3401 E NFC : at com.android.systemui.qs.tiles.NfcTile.handleUpdateState(NfcTile.java:136)
02-22 10:51:13.082 3219 3401 E NFC : at com.android.systemui.qs.tiles.NfcTile.handleUpdateState(NfcTile.java:42)
02-22 10:51:13.082 3219 3401 E NFC : at com.android.systemui.qs.tileimpl.QSTileImpl.handleRefreshState(QSTileImpl.java:378)
02-22 10:51:13.082 3219 3401 E NFC : at com.android.systemui.qs.tileimpl.QSTileImpl$H.handleMessage(QSTileImpl.java:603)
02-22 10:51:13.082 3219 3401 E NFC : at android.os.Handler.dispatchMessage(Handler.java:106)
02-22 10:51:13.082 3219 3401 E NFC : at android.os.Looper.loop(Looper.java:223)
02-22 10:51:13.082 3219 3401 E NFC : at android.os.HandlerThread.run(HandlerThread.java:67)
02-22 10:51:13.084 3219 3401 E NFC : could not retrieve NFC service during service recovery
02-22 10:51:13.085 3219 3401 E NFC : Failed to recover NFC Service.
UPDATE: Don't know if this might be relevant. This is on master. The actual code in GSI build may differ.
It's possible the NFC is having a transport error or is timing out for some reason. This particular case block is the same for NFA_DM_NFCC_TRANSPORT_ERR_EVT
and NFA_DM_NFCC_TIMEOUT_EVT
, and is the only place where abort()
appears in this function.
Supposedly the system should be trying to recover the NFC service afterwards. However, either that never happened or that the recovery attempts failed without emitting any logs, the only logcat relevant to NFC was the DeadObjectException
that came from the QS tiles, and NFC no longer works. (EDIT: It's possible this issue was known, and this particular commit appears to be a fix...)
This issue persists on v304. NFC still crashes and would not recover.
Don't know if there is anything else helpful I could provide to help investigating...
This issue persists on v304. NFC still crashes and would not recover.
Don't know if there is anything else helpful I could provide to help investigating...
I'm guessing this is still an issue?
This issue persists on v304. NFC still crashes and would not recover. Don't know if there is anything else helpful I could provide to help investigating...
I'm guessing this is still an issue?
As of the April build of PalladiumOS GSI, yes. Which GSI are you currently on?
This issue persists on v304. NFC still crashes and would not recover. Don't know if there is anything else helpful I could provide to help investigating...
I'm guessing this is still an issue?
As of the April build of PalladiumOS GSI, yes. Which GSI are you currently on?
I've been trying Lineage 18.1 with each release. Still no luck after the May update.
This issue persists on v304. NFC still crashes and would not recover. Don't know if there is anything else helpful I could provide to help investigating...
I'm guessing this is still an issue?
As of the April build of PalladiumOS GSI, yes. Which GSI are you currently on?
I've been trying Lineage 18.1 with each release. Still no luck after the May update.
Does the phenomenon similar?
The current phenomenon is, upon system startup, NFC appears to be present and initialized, but as soon as you try to use it or after a couple of minutes, NFC service dies (due to an abort()
call, which can be found in the source code as there is only a single occurrence of it) and never recovers.
Maybe try getting a kernel dmesg when that happens, to see what exactly happened. You can type dmesg
after entering a root shell (after rooted using Magisk).
This issue persists on v304. NFC still crashes and would not recover. Don't know if there is anything else helpful I could provide to help investigating...
I'm guessing this is still an issue?
As of the April build of PalladiumOS GSI, yes. Which GSI are you currently on?
I've been trying Lineage 18.1 with each release. Still no luck after the May update.
Does the phenomenon similar?
The current phenomenon is, upon system startup, NFC appears to be present and initialized, but as soon as you try to use it or after a couple of minutes, NFC service dies (due to an
abort()
call, which can be found in the source code as there is only a single occurrence of it) and never recovers.Maybe try getting a kernel dmesg when that happens, to see what exactly happened. You can type
dmesg
after entering a root shell (after rooted using Magisk).
I have switched back to 17.1 as my daily driver, so I unfortunately can not check.
I took a kernel dmesg the moment when I touched a NFC card which would cause NFC service to die.
[ 210.917780] i2c_geni 88c000.i2c: i2c error :-107
[ 210.917814] nq-nci 1-0028: nfc_write: failed to write -107
[ 210.925683] i2c_geni 88c000.i2c: i2c error :-107
[ 210.925698] nq-nci 1-0028: nfc_write: failed to write -107
[ 210.931351] i2c_geni 88c000.i2c: i2c error :-107
[ 210.931366] nq-nci 1-0028: nfc_write: failed to write -107
[ 210.936986] i2c_geni 88c000.i2c: i2c error :-107
[ 210.936997] nq-nci 1-0028: nfc_write: failed to write -107
[ 210.942649] i2c_geni 88c000.i2c: i2c error :-107
[ 210.942666] nq-nci 1-0028: nfc_write: failed to write -107
[ 210.948182] i2c_geni 88c000.i2c: i2c error :-107
[ 210.948200] nq-nci 1-0028: nfc_write: failed to write -107
Actually similar messages appear before this, but NFC service is still alive at that moment.
[ 76.440220] i2c_geni 88c000.i2c: i2c error :-107
[ 76.440235] nq-nci 1-0028: nfc_write: failed to write -107
NFC is not recovering at all as nothing related shows up in the logcat, except the QS panel keeps complaining about unable to obtain NFC status due to DeadObjectException
, since NFC service recovery never really happened.
Has any progress been made on this bug? It seems to be the only major one affecting our device.
I don't think I could continue following the issue, as I might have broken the NFC contact when I replaced the phone's swollen battery (nothing happens when I touched a card on it). I didn't really see anything that looked like a NFC contact when I was replacing the battery, so I'm not sure.
However, it seems the issue persists as of the latest OctaviOS build. After a while NFC service dies and disappears from Connected Devices options.
It doesn't seem to be GSI specific, as my new phone, Motorola Edge S Pro (pstar
), has working NFC with recent GSI builds (including OctaviOS). It's probably vendor-related.
You can try to add LEGACY_MIFARE_READER=1
in your libnfc-nci.conf (usually it's placed in /vendor/etc/). It has fixed issue with reading Mifare on HTC U12+.
However, it seems the issue persists as of the latest OctaviOS build.
Same here. Still suffering from this issue...
You can try to add
LEGACY_MIFARE_READER=1
in your libnfc-nci.conf (usually it's placed in /vendor/etc/).
This sounds so tempting and amazingly easy. I tried to apply it, but I cannot get my /vendor/etc/
folder or the underlying vendor
partition to be remounted with read-write permissions, in any common way.
It seems like the only way is to create an entire Magisk module for the sake of appending a single line to a configuration file, just to try out if it even works at all.
Out of desperation, I created a Magisk Module, just to append this single line LEGACY_MIFARE_READER=1
.
And it actually worked. 🥳 🎉 Still can't believe, this is not a given.
However, now the SIM service does not work at all. I cannot imagine in what way NFC is related to SIM service, but smartphones gonna smartphone, always break from the tiniest modifications, possible....
Another reboot of the device seems to have fixed the disabled SIM service issue.
I cannot believe, this issue is finally fixed.
I will test a while, if it will keep working.
GSI: Nusantara 2.5.1 (Android 11, January security patch)
NFC doesn't work correctly on my device with this GSI. Since I don't really know a good means to report the issue directly to Igor-s7 I'm putting this here.
Simply put, the NFC service works upon startup, but after some NFC operations, or simply a few minutes after boot, the service would crash and never recover.
The following can be found in the logcat.
Also, I'm attaching the tombstone related to the logcat error messages here. tombstone_05.gz