From c204213c41b31b425ef727cfef57db792d5d38b0 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 27 Jun 2012 10:55:42 +0800 Subject: [PATCH] camera rk30: rk_camera_querycap func has bug of quering orintation. --- drivers/media/video/rk30_camera_oneframe.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/rk30_camera_oneframe.c b/drivers/media/video/rk30_camera_oneframe.c index 4ae49bec4371..b576178e4693 100755 --- a/drivers/media/video/rk30_camera_oneframe.c +++ b/drivers/media/video/rk30_camera_oneframe.c @@ -1741,14 +1741,25 @@ static int rk_camera_querycap(struct soc_camera_host *ici, { struct rk_camera_dev *pcdev = ici->priv; char orientation[5]; + int i; strlcpy(cap->card, dev_name(pcdev->icd->pdev), sizeof(cap->card)); - if (strcmp(dev_name(pcdev->icd->pdev), pcdev->pdata->info[0].dev_name) == 0) { - sprintf(orientation,"-%d",pcdev->pdata->info[0].orientation); + memset(orientation,0x00,sizeof(orientation)); + for (i=0; ipdata->info[i].dev_name!=NULL) && (strcmp(dev_name(pcdev->icd->pdev), pcdev->pdata->info[i].dev_name) == 0)) { + sprintf(orientation,"-%d",pcdev->pdata->info[i].orientation); + } + } + + if (orientation[0] != '-') { + RKCAMERA_TR("%s: %s is not registered in rk29_camera_platform_data, orientation apply default value",__FUNCTION__,dev_name(pcdev->icd->pdev)); + if (strstr(dev_name(pcdev->icd->pdev),"front")) + strcat(cap->card,"-270"); + else + strcat(cap->card,"-90"); } else { - sprintf(orientation,"-%d",pcdev->pdata->info[1].orientation); + strcat(cap->card,orientation); } - strcat(cap->card,orientation); cap->version = RK_CAM_VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; -- 2.34.1