sonyxperiadev / bug_tracker

Empty repository that is used as a bugtracker for Open Devices project
52 stars 13 forks source link

[Nagara][PDX224] Fingerprint service fails to initialise due to missing device #796

Open faenil opened 1 year ago

faenil commented 1 year ago

Platform: Nagara Device: pdx224 (Xperia 5 IV) Kernel version: 5.10 from android-13.0.0_r30 branch (commit: a4a72efafecae951d7faa8e2946bdbc4f2f826bb) Android version: android-13.0.0_r30, repo-update'd Software binaries version: 64.0.H.4.18 + SW_binaries_for_Xperia_Android_13_5.10_v1b_nagara.zip

The target is -eng variant

Previously working on n/a

Description Fingerprint service fails to initialise and crashes in a loop. Log excerpt below:

02-27 11:28:49.910  1024  1024 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
02-27 11:28:49.910  1024  1024 F DEBUG   : Build fingerprint: 'Sony/aosp_xqcq54/pdx224:13/TQ1A.230205.002/eng.faenil.20230224.001727:eng/test-keys'
02-27 11:28:49.910  1024  1024 F DEBUG   : Revision: '0'
02-27 11:28:49.910  1024  1024 F DEBUG   : ABI: 'arm64'
02-27 11:28:49.910  1024  1024 F DEBUG   : Timestamp: 1970-02-27 11:28:49.904183903+0000
02-27 11:28:49.910  1024  1024 F DEBUG   : Process uptime: 1s
02-27 11:28:49.910  1024  1024 F DEBUG   : Cmdline: /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.1-service.sony
02-27 11:28:49.883   998   998 I dpmd    : type=1400 audit(0.0:661): avc: denied { call } for scontext=u:r:dpmd:s0 tcontext=u:r:diag:s0 tclass=binder permissive=1
02-27 11:28:49.910  1024  1024 F DEBUG   : pid: 980, tid: 980, name: android.hardwar  >>> /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.1-service.sony <<<
02-27 11:28:49.910  1024  1024 F DEBUG   : uid: 1000
02-27 11:28:49.910  1024  1024 F DEBUG   : tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
02-27 11:28:49.910  1024  1024 F DEBUG   : pac_enabled_keys: 000000000000000f (PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY)
02-27 11:28:49.910  1024  1024 F DEBUG   : signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
02-27 11:28:49.910  1024  1024 F DEBUG   : Abort message: 'terminating with uncaught exception of type 15FormatException: Failed to open fingerprint device! fd=-1, strerror=No such file or directory'
02-27 11:28:49.910  1024  1024 F DEBUG   :     x0  0000000000000000  x1  00000000000003d4  x2  0000000000000006  x3  0000007ff3e6e1b0
02-27 11:28:49.910  1024  1024 F DEBUG   :     x4  736f646277641f73  x5  736f646277641f73  x6  736f646277641f73  x7  7f7f7f7f7f7f7f7f
02-27 11:28:49.912   985   985 E cnss-daemon: NL group_id 13, cnss_nl.family_id 35
02-27 11:28:49.918  1035  1035 I ueventd : firmware: loading 'adsp.b08' for '/devices/platform/soc/3000000.remoteproc-adsp/firmware/adsp.b08'
02-27 11:28:49.921  1024  1024 F DEBUG   :     x8  00000000000000f0  x9  000000715dbc19e0  x10 0000000000000001  x11 000000715dbffb14
02-27 11:28:49.921  1024  1024 F DEBUG   :     x12 000000003b9ac9ff  x13 000000007fffffff  x14 0000000000000d36  x15 0000000014316b74
02-27 11:28:49.921  1024  1024 F DEBUG   :     x16 000000715dc63d50  x17 000000715dc419a0  x18 0000007161522000  x19 00000000000003d4
02-27 11:28:49.922  1024  1024 F DEBUG   :     x20 00000000000003d4  x21 00000000ffffffff  x22 0000007ff3e6e2e0  x23 ffffff80ffffffc8
02-27 11:28:49.922  1024  1024 F DEBUG   :     x24 000000715dc65f70  x25 0000000000000000  x26 0000000000000000  x27 0000000000000000
02-27 11:28:49.922  1024  1024 F DEBUG   :     x28 0000000000000000  x29 0000007ff3e6e230
02-27 11:28:49.922  1024  1024 F DEBUG   :     lr  000000715dbf1718  sp  0000007ff3e6e190  pc  000000715dbf1744  pst 0000000000001000
02-27 11:28:49.922  1024  1024 F DEBUG   : backtrace:
02-27 11:28:49.922  1024  1024 F DEBUG   :       #00 pc 0000000000051744  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164) (BuildId: a233a8c1a23ee63f36f4b138880288f3)
02-27 11:28:49.922  1024  1024 F DEBUG   :       #01 pc 000000000004910c  /apex/com.android.vndk.v33/lib64/libc++.so (abort_message+248) (BuildId: a5247afe9d3506dcb8946ad5a5671997)
02-27 11:28:49.922  1024  1024 F DEBUG   :       #02 pc 00000000000492bc  /apex/com.android.vndk.v33/lib64/libc++.so (demangling_terminate_handler()+208) (BuildId: a5247afe9d3506dcb8946ad5a5671997)
02-27 11:28:49.922  1024  1024 F DEBUG   :       #03 pc 0000000000049e30  /apex/com.android.vndk.v33/lib64/libc++.so (std::__terminate(void (*)())+12) (BuildId: a5247afe9d3506dcb8946ad5a5671997)
02-27 11:28:49.922  1024  1024 F DEBUG   :       #04 pc 00000000000494cc  /apex/com.android.vndk.v33/lib64/libc++.so (__cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*)+28) (BuildId: a5247afe9d3506dcb8946ad5a5671997)
02-27 11:28:49.922  1024  1024 F DEBUG   :       #05 pc 0000000000049438  /apex/com.android.vndk.v33/lib64/libc++.so (__cxa_throw+116) (BuildId: a5247afe9d3506dcb8946ad5a5671997)
02-27 11:28:49.922  1024  1024 F DEBUG   :       #06 pc 000000000000a030  /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.1-service.sony (egistec::EgisFpDevice::EgisFpDevice()+136) (BuildId: cebea304e7b75ad4ee78df949234d912)
02-27 11:28:49.922  1024  1024 F DEBUG   :       #07 pc 000000000000ee48  /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.1-service.sony (main+44) (BuildId: cebea304e7b75ad4ee78df949234d912)
02-27 11:28:49.922  1024  1024 F DEBUG   :       #08 pc 000000000004a064  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+96) (BuildId: a233a8c1a23ee63f36f4b138880288f3)

Symptoms The device overheats while it keeps trying to start fingerprint service (and other crashing services)

How to reproduce Build the kernel via the build-clang-shared.sh script (prebuilt kernel for this device is not yet released) Build and flash the OS image. Boot the device. Wait for a few minutes and notice the temperature increase.

Additional context first_logcat_5Apr.zip

MarijnS95 commented 1 year ago

Failed to open fingerprint device! fd=-1, strerror=No such file or directory

Alin asked me to port the fingerprint on the kernel side (and then perform the usual validation suite in userspace) before definitively releasing this, but I've been hampered by unstable devices. Fortunately you just caught and fixed the biggest derailer in #795 and I have a long weekend coming up, will test and push the port on Friday!

faenil commented 1 year ago

amazing, thanks for the update, I will skip and focus on something else then :rocket:

MarijnS95 commented 1 year ago

Turns out Nagara isn't as easy to port, it has been a few platforms since that happened. I still have to refactor more parts of the HAL but the basics are there to support the new DMA-BUF heap API over ION (and after some digging, there's a helper library I'll use instead of manually doing the switcheroo):

https://github.com/MarijnS95/vendor-sony-oss-fingerprint/commits/dma-heap

Then for the kernel side the IRQ pin remains high and the hardware always returns ID 0, probably missing some setup or doing the setup (most likely resets) wrong. When flipping IRQ polarity the scanner gets all the way into enroll (because the HAL isn't deathlooping itself on some inexistant Finger event) but then never raises the IRQ when a finger is presented as if the HW is dormant. I strongly doubt it'd get this far if it doesn't touch the memory so something - likely the TZapp itself - is alive and pretending the HW is too.

Here's the kernel part, but be careful with it:

https://github.com/MarijnS95/kernel/commits/nagara-egistec

I'll do some more digging through the downstream kernel driver later in hopes of uncovering its dirty secrets.

flightmansam commented 1 year ago

@MarijnS95 Did you ever find the solution to this?

MarijnS95 commented 1 year ago

@flightmansam I've been away for a while and haven't yet had an opportunity to figure out what should be changed in the HAL to support this new sensor. The DMAbufheap changes have already been finished and merged though.

flightmansam commented 1 year ago

Thanks so much!

I am hankering to build AOSP/LineageOS for my XQ-CQ72.

Best,

Sam