RK3288 USB UVC camera 摄像头 VIDIOC_DQBUF Failed!!! err[I/O error]

RK3288     Android5.1   多个品牌USB摄像头

 

同一块主板和代码,大部分品牌的USB摄像头可以正常使用,只有某一款USB摄像头不能使用。

插上摄像头,底层可以识别到摄像头。

<6>[ 47.479515] usb 3-1.4: new high-speed USB device number 5 using usb20_host
<6>[ 47.696548] usb 3-1.4: New USB device found, idVendor=058f, idProduct=2657
<6>[ 47.696719] usb 3-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
<6>[ 47.696825] usb 3-1.4: Product: PC Camera
<6>[ 47.696908] usb 3-1.4: Manufacturer: Alcor Micro, Corp.
<6>[ 47.708510] uvcvideo: Found UVC 1.00 device PC Camera (058f:2657)
<6>[ 47.718236] input: PC Camera as /devices/ff540000.usb/usb3/3-1/3-1.4/3-1.4:1.0/input/input5

但是每次打开摄像头app都显示“无法连接到相机”,上层 log 如下。

D/CameraHal(  177): setParameters(583): setParameters(583): Set preview size 800x600
... ...
D/CameraHal(  177): startPreview(177): startPreview177:preview_w = 800,preview_h = 600,drv_w = 800,drv_h = 600
D/CameraHal(  177): cameraSetSize(476): cameraSetSize(476):IN, w = 800,h = 600
... ...
E/CameraHal(  177): getFrame(614): getFrame(614): VIDIOC_DQBUF Failed!!! err[I/O error]
E/CameraHal(  177): getFrame(620): getFrame(620): camera driver or device may be error, so notify CAMERA_MSG_ERROR

 

最后官方的回复如下:

USB摄像头800x600分辨率输出有问题,强制使用1280x960,同时保留1280x720为录像使用,由软件剪切到1280x720

diff --git a/CameraHal/CameraUSBAdapter.cpp b/CameraHal/CameraUSBAdapter.cpp
index b88dd17..adb446b 100644
--- a/CameraHal/CameraUSBAdapter.cpp
+++ b/CameraHal/CameraUSBAdapter.cpp
@@ -134,8 +134,8 @@ void CameraUSBAdapter::initDefaultParameters(int camFd)

     params.set(KEY_PREVIEW_W_FORCE,"0");
     params.set(KEY_PREVIEW_H_FORCE,"0");
-    params.set(CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES, parameterString.string());
-    params.setPreviewSize(640,480);
+    params.set(CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES, "1280x960,1280x720");
+    params.setPreviewSize(1280, 960);
     /*picture size setting*/      
     params.set(CameraParameters::KEY_SUPPORTED_PICTURE_SIZES, parameterString.string());        
     params.setPictureSize(mCamDriverFrmWidthMax,  mCamDriverFrmHeightMax);   

按照官方的 patch 修改后,摄像头可以正常使用。

 

如果出现可以预览,不能拍照的问题,还需要更改拍照的分辨率

diff --git a/CameraHal/CameraUSBAdapter.cpp b/CameraHal/CameraUSBAdapter.cpp
index b88dd17..adb446b 100644
--- a/CameraHal/CameraUSBAdapter.cpp
+++ b/CameraHal/CameraUSBAdapter.cpp
@@ -134,8 +134,8 @@ void CameraUSBAdapter::initDefaultParameters(int camFd)

     params.set(KEY_PREVIEW_W_FORCE,"0");
     params.set(KEY_PREVIEW_H_FORCE,"0");
     params.set(CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES, "1280x960,1280x720");
     params.setPreviewSize(1280, 960);
     /*picture size setting*/      
-    params.set(CameraParameters::KEY_SUPPORTED_PICTURE_SIZES, parameterString.string());        
-    params.setPictureSize(mCamDriverFrmWidthMax,  mCamDriverFrmHeightMax);
+    params.set(CameraParameters::KEY_SUPPORTED_PICTURE_SIZES, "1280x960,1280x720");        
+    params.setPictureSize(1280, 960);

 

posted @ 2018-05-23 11:19  LeeAaron  阅读(7125)  评论(0编辑  收藏  举报