4

I have configured v4l2 on my android device. I plug the webcam and see that /dev/video4 node is created. But when I try to open it from my JNI layer it says "Permission denied"

I have tried the following

1) Change the permission of /dev/video4 so that it is Read-Write for all (0666)

2) Added the android.permission.camera in the android manifest xml (originally /dev/video4 was created by system and camera group had rw access.)

None of them work. Any ideas on how to solve it?

umläute
  • 28,885
  • 9
  • 68
  • 122
user2125869
  • 41
  • 1
  • 2

2 Answers2

0

I faced a similar problem on Android 4.4.2 (Sasmung Galaxy S5 SM-G900F). I found that changing permissions for /dev/video4 did not help. But chown did the trick:

su -c chown 10209:10209 /dev/video4

(here, 10209 was the UID alloated by Android to my app).

PS this did not resolve my major problem: kernel panic when my app was reading video frames from the particular usb camera.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
0

This sounds like the same issue I had with SE Linux permissions on Lollipop. See my answer here.

In short, you can:

  • disable SE Linux (until reboot) by running (as root) echo 0 > /sys/fs/selinux/enforce
  • hack your Cyanogenmod build and add allow untrusted_app video_device:chr_file rw_file_perms; to external/sepolicy/untrusted_app.te.
Community
  • 1
  • 1
jkoreska
  • 7,210
  • 2
  • 18
  • 21