When I connect WebCamera(Logitech C170) to Demo board(sabresd_6dq-eng 4.2.2),
I can see the following messages:
<6>usb 2-1.4.4: new high speed USB device number 9 using fsl-ehci
<6>uvcvideo: Found UVC 1.00 device Webcam C170 (046d:082b)
<6>input: Webcam C170 as /devices/platform/fsl-ehci.1/usb2/2-1/2-1.4/2-1.4.4/2-1
.4.4:1.0/input/input6
And the device is /dev/video2
(file video0,video1 exist,but hardware not installed)
But when I use
int cameraCount = Camera.getNumberOfCameras();
to get the count of cameras.
It always returns zero....
How to register my camera?
解決済! 解決策の投稿を見る。
这个问题找到了解决办法,我写下来,希望对有同样的疑问的人有帮助
首先,开机后通过logcat如下log
01-01 08:00:04.220: I/CameraService(2227): CameraService started (pid=2227)
01-01 08:00:04.220: E/CameraService(2227): Could not load camera HAL module
它是CameraService.cpp输出的,也就是service启动了,但是hw_get_module失败了
if (hw_get_module(CAMERA_HARDWARE_MODULE_ID,
(const hw_module_t **)&mModule) < 0) {
ALOGE("Could not load camera HAL module");
mNumberOfCameras = 0;
}
之后调查mx6/libcamera下的Android.mk发现,BOARD_HAVE_IMX_CAMERA为true时才会编译。
于是把/device/fsl/imx6/BoardConfigCommon.mk中的BOARD_HAVE_IMX_CAMERA改为了true。
编译安卓后libcameraservice.so就会被生成了
将生成的ramdisk.img解压到某个目录,然后修改init.freescale.rc
将back_camera改写成uvc
setprop back_camera_name uvc
重新打包ramdisk.img后打包boot.img
烧写boot.img, system.img,启动后,有两个camera的图标(估计是一个前置,一个后置)。其中一个点击后,可以启动摄像头实现拍照和录像
这个问题找到了解决办法,我写下来,希望对有同样的疑问的人有帮助
首先,开机后通过logcat如下log
01-01 08:00:04.220: I/CameraService(2227): CameraService started (pid=2227)
01-01 08:00:04.220: E/CameraService(2227): Could not load camera HAL module
它是CameraService.cpp输出的,也就是service启动了,但是hw_get_module失败了
if (hw_get_module(CAMERA_HARDWARE_MODULE_ID,
(const hw_module_t **)&mModule) < 0) {
ALOGE("Could not load camera HAL module");
mNumberOfCameras = 0;
}
之后调查mx6/libcamera下的Android.mk发现,BOARD_HAVE_IMX_CAMERA为true时才会编译。
于是把/device/fsl/imx6/BoardConfigCommon.mk中的BOARD_HAVE_IMX_CAMERA改为了true。
编译安卓后libcameraservice.so就会被生成了
将生成的ramdisk.img解压到某个目录,然后修改init.freescale.rc
将back_camera改写成uvc
setprop back_camera_name uvc
重新打包ramdisk.img后打包boot.img
烧写boot.img, system.img,启动后,有两个camera的图标(估计是一个前置,一个后置)。其中一个点击后,可以启动摄像头实现拍照和录像
Use LegacyCamera时,I can see the following messages:
01-02 08:07:40.350: V/CameraHolder(4024): open camera 0
01-02 08:07:40.350: E/CameraService(2229): Camera HAL module not loaded
01-02 08:07:40.350: E/CameraHolder(4024): fail to connect Camera
01-02 08:07:40.350: E/CameraHolder(4024): java.lang.RuntimeException: Fail to connect to camera service
01-02 08:07:40.350: E/CameraHolder(4024): at android.hardware.Camera.native_setup(Native Method)
01-02 08:07:40.350: E/CameraHolder(4024): at android.hardware.Camera.<init>(Camera.java:340)
01-02 08:07:40.350: E/CameraHolder(4024): at android.hardware.Camera.open(Camera.java:302)
01-02 08:07:40.350: E/CameraHolder(4024): at com.android.camera.CameraHolder.open(CameraHolder.java:131)
01-02 08:07:40.350: E/CameraHolder(4024): at com.android.camera.Util.openCamera(Util.java:267)
01-02 08:07:40.350: E/CameraHolder(4024): at com.android.camera.Camera$4.run(Camera.java:1100)
01-02 08:07:40.350: E/CameraHolder(4024): at java.lang.Thread.run(Thread.java:856)
I tried to modify com.android.camera.Camera/Camera.java,let it open camera2,but failed.
01-02 09:26:30.690: V/CameraHolder(4896): open camera 2
01-02 09:26:30.690: W/audio_hw_primary(2229): out_write_primary
01-02 09:26:30.690: W/audio_hw_primary(2229): out_write_primary
01-02 09:26:30.690: E/CameraService(2229): Camera HAL module not loaded
01-02 09:26:30.690: E/CameraHolder(4896): fail to connect Camera
01-02 09:26:30.690: E/CameraHolder(4896): java.lang.RuntimeException: Fail to connect to camera service
01-02 09:26:30.690: E/CameraHolder(4896): at android.hardware.Camera.native_setup(Native Method)
01-02 09:26:30.690: E/CameraHolder(4896): at android.hardware.Camera.<init>(Camera.java:340)
01-02 09:26:30.690: E/CameraHolder(4896): at android.hardware.Camera.open(Camera.java:302)
01-02 09:26:30.690: E/CameraHolder(4896): at com.android.camera.CameraHolder.open(CameraHolder.java:131)
01-02 09:26:30.690: E/CameraHolder(4896): at com.android.camera.Util.openCamera(Util.java:267)
01-02 09:26:30.690: E/CameraHolder(4896): at com.android.camera.Camera$4.run(Camera.java:1105)
01-02 09:26:30.690: E/CameraHolder(4896): at java.lang.Thread.run(Thread.java:856)
Does anyone know why?
Hi jiang
if you are learning you may be interested to run unit-test with this camera
Best regards
igor
Hi,
Jiang
Are you using Android BSP?
Thank you for your reply.
No, I am learning development of BSP.