How to access external usb camera on unrooted android devices -
i want access extern usb cameras via v4l on android.
i tried simplewebcam. after slight modifications of original source codes, achieved make work on rooted android device. however, on unrooted devices, keeps complaining "not have permission access "/dev/video*". checked permission of /dev/video* "ls -l /dev/video*", , got
crw-rw---- system camera 81, 0 2015-08-18 18:31 video0
i understand means /dev/video* owned system, , readable/writable users in group "camera". think if add
<uses-permission android:name="android.permission.camera" />
in manifest of app, user id of app added group "camera", app allowed read data /dev/video*.
but, still complains "not have permission access /dev/video*" now.
i tried
<uses-permission android:name="android.permission.camera" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" />
, still not working.
do miss somthing or misunderstand somthing. or discussion appreciated.
the codes used open device
int opendevice(int i) { struct stat st; sprintf(dev_name,"/dev/video%d",i); if (-1 == stat (dev_name, &st)) { loge("cannot identify '%s': %d, %s", dev_name, errno, strerror (errno)); return error_local; } if (!s_ischr (st.st_mode)) { loge("%s no device", dev_name); return error_local; } fd = open (dev_name, o_rdwr);// | o_nonblock, 0); if (-1 == fd) { loge("cannot open '%s': %d, %s", dev_name, errno, strerror (errno)); return error_local; } return success_local; }
the return value of open -1, logcat:
cannot open '/dev/video3': 13, permission denied
i achieve read images external usb camera on unrooted android devices using opensource project named uvccamera. here link, https://github.com/saki4510t/uvccamera
Comments
Post a Comment