Hi,
I had IMX6SLEVK and connected with OV5640 Camera Module. I am using Android Kitkat 4.4.2 from freescale website.
I tested the OV5640 with two ways. But both results are failed.
1. I edit the ../myandroid/device/fsl/evksl/init.rc and compile source myandroid.
setprop back_camera_name csi | |
setprop back_camera_orient 0 | |
setprop front_camera_name uvc | |
setprop front_camera_orient 0 |
and OV5640 camera detected as /dev/video0 in filesystem .
I open the camera default application in Android. It shows the "Camera error" and "Can't connect the camera".
Log :
root@evk_6sl:/ # logcat | grep cam
W/PackageManager( 2480): Package com.android.camera desires unavailable shared library com.google.android.media.effects; ignoring!
I/ActivityManager( 2480): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.camera/.Camera} from pid 2646
I/ActivityManager( 2480): Start proc com.android.camera for activity com.android.camera/.Camera: pid=2932 uid=10028 gids={50028, 1028, 1015}
V/CameraHolder( 2932): open camera 0
I/CameraClient( 2132): Opening camera 0
I/FslCameraHAL( 2132): camera_device open: 0
E/FslCameraHAL( 2132): can not open camera devpath:
E/CameraClient( 2132): Could not open camera 0: -22
I/CameraClient( 2132): Destroying camera 0
W/CameraBase( 2932): An error occurred while connecting to camera: 0
E/CameraHolder( 2932): java.lang.RuntimeException: Fail to connect to camera service
E/CameraHolder( 2932): at com.android.camera.CameraHolder.open(CameraHolder.java:131)
E/CameraHolder( 2932): at com.android.camera.Util.openCamera(Util.java:267)
E/CameraHolder( 2932): at com.android.camera.Camera$4.run(Camera.java:1100)
V/camera ( 2932): surfaceChanged. w=592. h=444
I/ActivityManager( 2480): Displayed com.android.camera/.Camera: +834ms
130|root@evk_6sl:/ # logcat | grep HAL |
I/FslCameraHAL( 2132): camera_device open: 0
I/FslCameraHAL( 2132): initialize name:uvc, path:
I/FslCameraHAL( 2132): DeviceAdapter: Create uvc device
E/FslCameraHAL( 2132): can not open camera devpath:
E/FslCameraHAL( 2132): CameraHal: DeviceAdapter initialize failed
2. I edit the ../myandroid/device/fsl/evksl/init.rc and compile source myandroid.
setprop back_camera_name csi | |
setprop back_camera_orient 0 | |
setprop front_camera_name csi | |
setprop front_camera_orient 0 |
and OV5640 camera detected as /dev/video0 in filesystem .
I open the camera default application in Android. It shows the "Camera error" and "Can't connect the camera".
LOG:
root@evk_6sl:/ # logcat | grep cam
W/PackageManager( 2482): Package com.android.camera desires unavailable shared library com.google.android.media.effects; ignoring!
I/ActivityManager( 2482): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.camera/.Camera bnds=[137,231][203,297]} from pid 2647
I/ActivityManager( 2482): Start proc com.android.camera for activity com.android.camera/.Camera: pid=2937 uid=10028 gids={50028, 1028, 1015}
V/CameraHolder( 2937): open camera 0
E/CameraService( 2133): CameraService::connect X (pid 2937) rejected (invalid cameraId 0).
W/CameraBase( 2937): An error occurred while connecting to camera: 0
E/CameraHolder( 2937): java.lang.RuntimeException: Fail to connect to camera service
E/CameraHolder( 2937): at com.android.camera.CameraHolder.open(CameraHolder.java:131)
E/CameraHolder( 2937): at com.android.camera.Util.openCamera(Util.java:267)
E/CameraHolder( 2937): at com.android.camera.Camera$4.run(Camera.java:1100)
V/camera ( 2937): surfaceChanged. w=592. h=444
I/ActivityManager( 2482): Displayed com.android.camera/.Camera: +857ms
I/ActivityManager( 2482): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.camera/.Camera bnds=[137,231][203,297]} from pid 2647
V/CameraHolder( 2937): open camera 0
E/CameraService( 2133): CameraService::connect X (pid 2937) rejected (invalid cameraId 0).
W/CameraBase( 2937): An error occurred while connecting to camera: 0
E/CameraHolder( 2937): java.lang.RuntimeException: Fail to connect to camera service
E/CameraHolder( 2937): at com.android.camera.CameraHolder.open(CameraHolder.java:131)
E/CameraHolder( 2937): at com.android.camera.Util.openCamera(Util.java:267)
E/CameraHolder( 2937): at com.android.camera.Camera$4.run(Camera.java:1100)
V/camera ( 2937): surfaceChanged. w=592. h=444
I/ActivityManager( 2482): Displayed com.android.camera/.Camera: +646ms
^C
Please suggest any suggestion to get camera successfully.
Thanks and regards,
vinothraj.
Hi vinothraj,
please confirm the following items:
(1) check if 'csi' was included in bootargs in u-boot parameters.
if not , add 'csi' to bootargs.
(2)check BSP and confirm if CSI pins IOMUXING are correct.
(3)check if the path of init.rc is correct.
I remember init.rc is in myandroid/device/fsl/imx/evk_6sl/, and after finding correct init.rc, if "setprop back_camera_name csi" is not ok, you can try to modify it as:
setprop back_camera_name ov5640
(4) analysis for the issue
From your log, It seems that camera HAL didn't find /dev/video0 device, so prompt you can't open camera0 or can't connect camera. After checking above items, if camera can't also normally work, you can trace camera HAL source code: myandroid/hardware/imx/mx6/libcamera2/
Hope above suggestion can help you !
Regards,
weidong
Hi weidong.sun,
I confirm you some details about my work.
(1) I included 'csi' to bootargs in u-boot parameters.
(2) I included the correct IOMUXING for CSI pins in BSP.
(3) I edited the correct init.rc file in ../myandroid/device/fsl/evksl/ .
I already mentioned correct init.rc path in my last post.
I also modified the init.rc file separately with below lines:
setprop back_camera_name ov5640
setprop back_camera_name ov5640_camera
But it has no improvement. Same log came.
(4) Yes, camera HAL did not find the /dev/video0 . may I specify the camera path in ../myandroid/device/fsl/evksl/init.rc file ?
(5) And also i traced the Camera HAL source code :
The trace does not go to : myandroid/hardware/imx/mx6/libcamera2/ .
It goes to myandroid/hardware/imx/mx6/libcamera/ .
Is it right or wrong camera HAL source code ?
How can i change the myandroid/hardware/imx/mx6/libcamera/ to myandroid/hardware/imx/mx6/libcamera2/ .
thanks,
vinothraj
OK, vinothraj,
I wil check source code again, and reply you next week.
Regards,
weidong
Hi vinothraj,
Yes, you are right. I confirmed that i.MX6SL EVK uses libcamera, not libcamera2, so please use:
"setprop back_camera_name csi" in init.rc
then add some LOG information to trace camera HAL source code, to find the reason why camera HAL didn't find correct path( /dev/video0), I feel if camera HAL can normally open /dev/video0, the issue you met should be solved.
Regards,
Weidong
Hi weidong.sun,
yes I also changed the "setprop back_camera_name csi" and "setprop front_camera_name csi" separately in init.rc. But i cannot able to get camera succesfully.
I also add some log information in libcamera. But i get bit confused to trace the log.
Any other way to check weather the camera is working or not?
Because first i check the camera os ported successfully or not?
I can able to see the i2c address of the camera using i2cdetect command. but i do not know how to check the camera is ported or not?
Kindly give any suggestion.
thanks,
vinothraj
Hi vinothraj,
In file CameraModule.cpp, there is a line of 'sprintf(dev_node, "/dev/%s", dir_entry->d_name);', you can print the content of "dev_node" to see if it is correct path of the camera device.
Regards,
Weidong
Hi weidong.sun,
i already added the log in file CameraModule.cpp.
if (strncmp(dir_entry->d_name, "video", 5)) | |
continue; | |
sprintf(dev_node, "/dev/%s", dir_entry->d_name); |
FLOGE(" dev_node :%s",dev_node);
if ((fd = open(dev_node, O_RDWR, O_NONBLOCK)) < 0) | |
continue; | |
if (ioctl(fd, VIDIOC_QUERYCAP, &v4l2_cap) < 0) { |
FLOGE(" video capability error");
close(fd); | |
fd = 0; | |
continue; |
in init.rc file
setprop back_camera_name csi
setprop back_camera_orient 0
setprop front_camera_name uvc
setprop front_camera_orient 0
and i compiled and booted
root@evk_6sl:/ # logcat | grep cam
W/PackageManager( 2506): Package com.android.camera desires unavailable shared library com.google.android.!
I/ActivityManager( 2506): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] 6
I/ActivityManager( 2506): Start proc com.android.camera for activity com.android.camera/.Camera: pid=3199 }
V/CameraHolder( 3199): open camera 0
I/CameraClient( 2133): Opening camera 0
I/FslCameraHAL( 2133): camera_device open: 0
E/FslCameraHAL( 2133): camera_device open: 0
E/FslCameraHAL( 2133): cameraid : 0
E/FslCameraHAL( 2133): num_cameras: 1
I/FslCameraHAL( 2133): init device name is csi
ialize name:uvc, path:
I/FslCameioctl_g_ifparm yzw==>Enter ioctl_g_ifparm[drivers/media/video/mxc/capture/ov5640.c]
raHAL( 2133):vin1 sensor vin clock_curr=mclk=24000000
name:uvc
I/FslCameraHAL( 2133): DeviceAdapter: vin1 hehe Create uvc device
E/FslCameraHAL( 2133): info.name: uvc
E/FslCameraHAL( 2133): info.devPath:
E/FslCameraHAL( 2133): sensor name :uvc
Einit yzw==>Enter ioctl_init return 0[drivers/media/video/mxc/capture/ov5640.c]
/FslCameraHAL( 2133): v4l entry
E/FslCameraHAL( 2133): v4l entry
E/FslCameraHAL( 2133): v4l entry
E/FslCameraHAL( 2133): dev_node :/dev/video0
E/FslCameraHAL( 2133): video capability error
E/FslCameraHAL( 2133): v4l entry
E/FslCameraHAL( 2133): dev_node :/dev/video1
E/FslCameraHAL( 2133): video capability error
E/FslCameraHAL( 2133): info.name: uvc
E/FslCameraHAL( 2133): info.devPath:
E/FslCameraHAL( 2133): can not open camera devpath:
E/FslCameraHAL( 2133): CameraHal: vin1 DeviceAdapter initialize failed
E/CameraClient( 2133): Could not open camera 0: -22
I/CameraClient( 2133): Destroying camera 0
W/CameraBase( 3199): An error occurred while connecting to camera: 0
E/CameraHolder( 3199): java.lang.RuntimeException: Fail to connect to camera service
E/CameraHolder( 3199): at com.android.camera.CameraHolder.open(CameraHolder.java:131)
E/CameraHolder( 3199): at com.android.camera.Util.openCamera(Util.java:267)
E/CameraHolder( 3199): at com.android.camera.Camera$4.run(Camera.java:1100)
V/camera ( 3199): surfaceChanged. w=592. h=444
I/ActivityManager( 2506): Displayed com.android.camera/.Camera: +1s802ms
(1) i added uvc and csi in init.rc file.But in the logcat only shows the uvc. E/FslCameraHAL( 2133): info.name: uvc
(2) i detect /dev/video0. but it goes video capability error log. what it means?
problem in driver file of OV5640 or any other? because i changed some changes in the ov5640 driver file.
Regards,
vinothraj.
Hi vinothraj,
Did you see the value of dev_node ?
I feel you should use "LOGI(" dev_node :%s",dev_node);" to print value of dev_node in android log.
After booting, on command line , run "logcat", atfer displaying is over, starting camera.apk to check the value of dev_node.
could you try it on and tell me the value ?
I checked your log, I found uvc camera was loaded, it was not correct, it means ov5640.cpp was not loaded, so could you add some information in ov5640.cpp to check if the file was used ?
Regards,
Weidong
Hi weidong.sun,
i added "ALOGI(" dev_node :%s",dev_node);" in file CameraModule.cpp .
if (ioctl(fd, VIDIOC_QUERYCAP, &v4l2_cap) < 0) {
FLOGE("video capability error"); //this log is printed in logcat so /dev/video have not video capability.so only get device path is failed
close(fd);
fd = 0;
continue;
But same output came when booting,
E/FslCameraHAL( 2133): dev_node :/dev/video0
E/FslCameraHAL( 2133): video capability error
E/FslCameraHAL( 2133): v4l entry
E/FslCameraHAL( 2133): dev_node :/dev/video1
E/FslCameraHAL( 2133): video capability error
And also added the information in ov5640.cpp .
in that logcat it could not reach the information added in the ov5640.cpp .
regards,
vinothraj