I am trying to implement an Android Application where it makes use of tinyalsa: pcm_open() API. I get "cannot open device (0) for card(2): Permission denied" error when I tried to launch the application from Android Studio that attempts to open an audio stream from 8MIC-PRI-MX8 mic array board. Note: 8MIC-PRI-MX8 mic array board appears as an alsa device "/dev/snd/pcmC2D0c" on i.Mx 8mmini EVK.
However, the application launches fine if I build it outside of Android Studio and run it on the device with (adb) root permissions via command line.
This leads me to believe that I need to root EVK_8mm in order to gain access to "/dev/snd/pcmC2D0c" alsa device. I started following the steps decribed here GitHub - 0xFireball/root_avd: Rooting the Android Studio AVDs
Then, I hit a road block when I tried to run following commands:
$ adb remount
dm_verity is enabled on the vendor partition.
Use "adb disable-verity" to disable verity.
$ adb disable-verity
Device is locked. Please unlock the device first
I came across this thread How to remount /system - 8.1 imx8m where it provides steps to remount the device. I started following the steps below:
1. Unlock the device.
a. Boot up the device.
b. Choose Settings -> Developer Options -> OEM Unlocking to enable OEM unlocking.
c. Enter Fastboot mode on the device. Execute the following command on the target side:
reboot bootloader
d. Unlock the device. Execute the following command on the host side:
fastboot oem unlock
e. Wait until the unlock process is complete.
Again, I ran into another problem here where fastboot was unable to find the device and indefinitely stuck in <Waiting for device>.
I updated the Device USB driver with ADB Device driver trough Windows Device Manager as suggested here How To Fix Fastboot Device Not Recognised Problem | WtfAndroid
But, it does not solve the issue.
Just to rule out any setup issue, I tried to repeat above steps on my Google Pixel 3XL and fastboot has no problem finding the device.
Please advise. Thanks so much.