diff options
authorAnnamalai Lakshmanan <>2012-06-06 12:45:16 +0530
committerAnnamalai Lakshmanan <>2012-06-06 12:50:46 +0530
commitb9372eacecb088c61409a412cae109bed5cecd01 (patch)
parent63348ab9d8af1d3497d41afc1c916c042b8dc9b7 (diff)
CameraHAL: modified device node probinglinaro_android_4.0.4
Modified the device node probing from last device node as USB Camera typically gets registered at last. There is one problem in probing (opening) device node starting from 0, as there are many Video Capture drivers in kernel that are typically not camera, and the open will succeed in them which should not be the case because they are not Camera driver. But, need an overall better mechanism of probing device nodes instead of opening all device nodes in /dev/video* Change-Id: I88f797ae12f15a11df3aae34143d343981e7dab0 Signed-off-by: Annamalai Lakshmanan <>
1 files changed, 3 insertions, 2 deletions
diff --git a/libcamera/CameraHardware.cpp b/libcamera/CameraHardware.cpp
index 4a2da1c..93299bc 100644
--- a/libcamera/CameraHardware.cpp
+++ b/libcamera/CameraHardware.cpp
@@ -28,6 +28,7 @@
#include <hal_public.h>
#include <ui/GraphicBufferMapper.h>
#include <gui/ISurfaceTexture.h>
+#define MAX_VIDEONODES 20
#define MIN_WIDTH 320
#define MIN_HEIGHT 240
#define CAM_SIZE "320x240"
@@ -241,7 +242,7 @@ status_t CameraHardware::startPreview()
#if 1
LOGI("startPreview: in startpreview \n");
mParameters.getPreviewSize(&width, &height);
- for( i=0; i<10; i++) {
+ for( i=MAX_VIDEONODES; i>=0; i--) {
LOGI("trying the node %s width=%d height=%d \n",devnode,width,height);
ret = camera.Open(devnode, width, height, PIXEL_FORMAT);
@@ -399,7 +400,7 @@ int CameraHardware::pictureThread()
mParameters.getPictureSize(&width, &height);
mParameters.getPreviewSize(&width, &height);
- for(i=0; i<10; i++) {
+ for(i=MAX_VIDEONODES; i>=0; i--) {
LOGI("trying the node %s \n",devnode);
ret = camera.Open(devnode, width, height, PIXEL_FORMAT);