Android: how to grant 666 privs to a device via ueventd.rc

zontar picture zontar · Aug 8, 2013 · Viewed 7.8k times · Source

I need to access an USB camera connected to my (rooted) Android. I'm on a Samsung Galaxy S4 with Android 4.2.2. I want to access it with a normal app, so I need the device to be world readable.

I can connect via shell and type

root@android:/ # su
root@android:/ # cd /dev
root@android:/dev # chmod 666 video4

and it works. But each time I disconnect the camera, and reconnect it, I have to do it again.

Via shell I can remount the root file system r/w

mount -o rw,remount -t rootfs rootfs /

and then edit the file /ueventd.rc (actually it's /ueventd.qcom.rc )

and add

/dev/video*               0666   system     camera

But even if I put 666 I only get

root@android:/dev # ls -la video4                                              
crw-rw---- system   camera    81,  18 2013-08-08 10:14 video4

Is there a way to grant a 666 permission permanently? So that each time I connect the camera it gets the right file permissions?

Thanks

Answer

Alex Cohn picture Alex Cohn · May 12, 2014

After you replace the /ueventd.qcom.rc file, you must restart /sbin/ueventd service. Actually, it will restart automatically, you only need to find it ps u, and kill the pid.

Note that Samsung restores rootfs on every reboot. The way I handle it, I keep the changed copy of ueventd.qcom.rc in /data/local/tmp, and issue

su -c mount -o remount,rw /
su -c cp /data/local/tmp/ueventd.qcom.rc /
ps ueventd

>

USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME
root      198   1     1136   448   ffffffff 00000000 S /sbin/ueventd

kill198