1. 程式人生 > >[RK3399][Android7.1]除錯筆記 --- 只使用UVC攝像頭

[RK3399][Android7.1]除錯筆記 --- 只使用UVC攝像頭

rk3399平臺可以支援多種不同介面的Camera,如MIPI, DVP, UVC camera。
對於DVP,MIPI的Camera,對應的配置是放在cam_board.xml的。
因此如果只使用UVC Camera,那麼只要移除此檔案就可以了。

改動如下:

kris@eco:~/rk3399/hardware/rockchip/camera$ g df 05bbf408a60a86518afb9c629425250f34675117 a449a767c730d97174add652954ccd0f48ae4eed
diff --git a/Config/rk32xx_camera.mk b/Config/rk32xx_camera.mk
index 2
ad54f8..5635398 100644 --- a/Config/rk32xx_camera.mk +++ b/Config/rk32xx_camera.mk @@ -44,8 +44,9 @@ PRODUCT_COPY_FILES += \ hardware/rockchip/camera/SiliconImage/isi/drv/GS8604/calib/GS8604_lens_9569A2.xml:system/etc/GS8604_lens_9569A2.xml \ hardware/rockchip/camera/SiliconImage/isi/drv/GS8604/calib/GS8604_lens_40100A.xml:system
/etc/GS8604_lens_40100A.xml \ hardware/rockchip/camera/SiliconImage/isi/drv/OV2680/calib/OV2680.xml:system/etc/OV2680.xml \ - hardware/rockchip/camera/SiliconImage/isi/drv/HM5040/calib/HM5040.xml:system/etc/HM5040.xml \ - hardware/rockchip/camera/Config/cam_board_rk3399.xml:system/etc/cam_board.xml + hardware/rockchip/camera/SiliconImage/isi/drv/HM5040/calib/HM5040.xml:system
/etc/HM5040.xml + #Kris,180703,We only use usb camera. + #hardware/rockchip/camera/Config/cam_board_rk3399.xml:system/etc/cam_board.xml

改動之後,camera_get_number_of_cameras()中的讀取cam_board.xml的程式碼就會失效,相關程式碼:

int camera_get_number_of_cameras(void)
{
....
    profiles = camera_board_profiles::getInstance();
    nCamDev = profiles->mDevieVector.size();
    LOGD("board profiles cam num %d\n", nCamDev);
    //由於讀取不到配置,所以nCamDev為0.
    if (nCamDev>0){
        camera_board_profiles::LoadSensor(profiles);
        char sensor_ver[32];

        for (i=0; (i<nCamDev); i++) 
        {  
            LOGE("load sensor name(%s) connect %d\n", profiles->mDevieVector[i]->mHardInfo.mSensorInfo.mSensorName, profiles->mDevieVector[i]->mIsConnect);
            if(profiles->mDevieVector[i]->mIsConnect==1){
                rk_sensor_info *pSensorInfo = &(profiles->mDevieVector[i]->mHardInfo.mSensorInfo);

                camInfoTmp[cam_cnt&0x01].pcam_total_info = profiles->mDevieVector[i];     
                strncpy(camInfoTmp[cam_cnt&0x01].device_path, pSensorInfo->mCamsysDevPath, sizeof(camInfoTmp[cam_cnt&0x01].device_path));
                strncpy(camInfoTmp[cam_cnt&0x01].driver, pSensorInfo->mSensorDriver, sizeof(camInfoTmp[cam_cnt&0x01].driver));
                unsigned int SensorDrvVersion = profiles->mDevieVector[i]->mLoadSensorInfo.mpI2cInfo->sensor_drv_version;
                memset(version,0x00,sizeof(version));
                sprintf(version,"%d.%d.%d",((SensorDrvVersion&0xff0000)>>16),
                        ((SensorDrvVersion&0xff00)>>8),SensorDrvVersion&0xff);

                if(pSensorInfo->mFacing == RK_CAM_FACING_FRONT){     
                    camInfoTmp[cam_cnt&0x01].facing_info.facing = CAMERA_FACING_FRONT;                  
                } else {
                    camInfoTmp[cam_cnt&0x01].facing_info.facing = CAMERA_FACING_BACK;
                } 

                memset(sensor_ver,0x00,sizeof(sensor_ver));
                if (strlen(pSensorInfo->mSensorName) < (sizeof(sensor_ver)-16))
                    sprintf(sensor_ver,"%s%s%s","sys_graphic.",pSensorInfo->mSensorName,".ver");
                else 
                    sprintf(sensor_ver,"%s",pSensorInfo->mSensorName);                
                property_set(sensor_ver, version);  

                camInfoTmp[cam_cnt&0x01].facing_info.orientation = pSensorInfo->mOrientation;
                cam_cnt++;

                unsigned int CamsysDrvVersion = profiles->mDevieVector[i]->mCamsysVersion.drv_ver;
                memset(version,0x00,sizeof(version));
                sprintf(version,"%d.%d.%d",((CamsysDrvVersion&0xff0000)>>16),
                    ((CamsysDrvVersion&0xff00)>>8),CamsysDrvVersion&0xff);
                property_set(CAMERAHAL_CAMSYS_VERSION_PROPERTY_KEY,version);
            }
        }
    }
....
}