Hi,

I have been looking into this problem myself, although I haven't had much 
time yet. I didn't find the root cause of the problem (i.e. who exactly 
opens the device before my attempt), but I have a workaround (at least 
until I can dig deeper and eliminate the real cause).

I don't know if you want to access the device from java, or native code, 
but the same approach should works for both cases:

Java: Construct a file observer instance for "/dev", with CREATE mask. When 
onEvent is called check, if for what you have been notified for is a video 
device and open it, if so. Open should succeed (based on the tests I have 
done so far).
Native: since FileObserver is based in inotify, the same thing should work 
using the native inotify API.

Important: your application must run prior to attaching the camera.

Let me know this approach has worked for you, or if you have found a more 
elegant solution, I'd be very interested.

Andras

On Wednesday, February 6, 2013 6:00:06 AM UTC+1, abhishek jain wrote:
>
> Hi Peter,
>
> I know on phone with singed image it is not possible but once you have 
> rooted phone with patch in kernel (configuration ) to enable v4l driver you 
> should see video0 node as a character device and after giving permission 
> 0666 in board specific rc application should be able to access directly. 
>
> Please check this link http://www.youtube.com/watch?v=fCN6VUyUl9o
>
> I have done all this but not sure why i am getting EBUSY error on open 
> function when trying to open /dev/video0 ( this error number is 16 : device 
> or resource busy). I don't know who else is using /dev/video0 or what is 
> the cause of it. 
>
> Thanks
> Himanshu Jain
>
> On Wednesday, January 23, 2013 12:56:13 PM UTC-8, Peter Teoh wrote:
>>
>> Due to security control, I don't think it is possible to directly access 
>> the camera via the /dev devices.  U have to write an app and let Dalvik 
>> gives u the access to the camera via manifest.
>>
>> http://developer.android.com/guide/topics/media/camera.html#custom-camera
>>
>>
>> http://stackoverflow.com/questions/3783124/how-do-i-access-the-camera-on-android-phones
>>
>> On Thu, Jan 17, 2013 at 1:14 PM, abhishek jain <intelc...@gmail.com>wrote:
>>
>>> Hello,
>>>
>>> I have been struggling with an issue related to v4l enabling in Android 
>>> Kernel. Please suggest me appropriate place to post my question i found 
>>> this email for contacting on linux-media website. I am trying to connect 
>>> external UVC camera with android device. 
>>>
>>> What i have done so far , I enabled v4l configuration in kernel and i do 
>>> see in log UVC driver get loaded after enabling  as well as 
>>> video_device_register return 0 and picked up video node 0. But what is the 
>>> problem is when i application trying to access /dev/video0 it always shows 
>>> device busy can not open. 
>>>
>>> I have tried all permutation combination by assigning 0666 permission in 
>>> init.rc , init.<board>.rc or uevetd.<board>.rc .
>>>
>>> But no luck please guide me how can i do it ?  I am trying with Logitech 
>>> C270 webcam and it does support v4l. 
>>>
>>> Thank you 
>>>
>>> -- 
>>> unsubscribe: android-kerne...@googlegroups.com
>>> website: http://groups.google.com/group/android-kernel
>>
>>
>>
>>
>> -- 
>> Regards,
>> Peter Teoh 
>>
>

-- 
-- 
unsubscribe: android-kernel+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-kernel
--- 
You received this message because you are subscribed to the Google Groups 
"Android Linux Kernel Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-kernel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to