I've built an Android app that uses tinyalsa through jni. When I call pcm_open
, I get:
cannot open device '/dev/snd/pcmC1D0c': Permission denied
Unlike this poster's case, I do see the file in question if I su -c 'ls /dev/snd'
. In fact, if I stat
this file and the directories above it, all the way up to the root directory, the permissions that stat
outputs conform to the permissions that I see on my ordinary linux workstation:
All of the directories are 0755/drwxr-xr-x
, and the file itself is 0660/crw-rw----
.
Why would Android deny me permission, and what do I need to do about it?
Despite this 755
permission on the directories above my device file, if I adb shell
and then ls /dev/snd
, I get Permission denied
!
Edit: it has been suggested that the resolution to this problem (which, incidentally, is still unresolved) will solve my alsa issue; I don't know if it will or not. My concern is that the source for pcm_open
calls open
on /dev/snd/pcmC1D1c
, and that file does not have any permissions set for a
(not o
or g
) users. Does the use of alsa require that I do something more than link libtinyalsa.so.1 when building my Android app?
Am I mistaken in my linking strategy? In my app's JNI modules, I included pcm.c
and pcm.h
from the primary tinyalsa repository and then followed standard procedure for opening an audio device with it.