[RK3399][Android7.1] 调试笔记 --- 三颗以上USB Camera的支持
Platform: RK3399
OS: Android 7.1
Kernel: v4.4.83
需求
需要支持三个USB Camera,系统默认支持的是两颗。
解决方法:
以下是rockchip给的patch,不过是有缺失的:
diff --git a/CameraHal/CameraHal_Module.cpp b/CameraHal/CameraHal_Module.cpp
index 27e0f54..fa99a38 100755
--- a/CameraHal/CameraHal_Module.cpp
+++ b/CameraHal/CameraHal_Module.cpp
@@ -684,6 +684,7 @@ int camera_get_number_of_cameras(void)memset(&camInfoTmp[0],0x00,sizeof(rk_cam_info_t));memset(&camInfoTmp[1],0x00,sizeof(rk_cam_info_t));
+ memset(&camInfoTmp[2],0x00,sizeof(rk_cam_info_t));profiles = camera_board_profiles::getInstance();nCamDev = profiles->mDevieVector.size();
@@ -691,25 +692,25 @@ int camera_get_number_of_cameras(void)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));
+ camInfoTmp[cam_cnt].pcam_total_info = profiles->mDevieVector[i];
+ strncpy(camInfoTmp[cam_cnt].device_path, pSensorInfo->mCamsysDevPath, sizeof(camInfoTmp[cam_cnt].device_path));
+ strncpy(camInfoTmp[cam_cnt].driver, pSensorInfo->mSensorDriver, sizeof(camInfoTmp[cam_cnt].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;
+ camInfoTmp[cam_cnt].facing_info.facing = CAMERA_FACING_FRONT; } else {- camInfoTmp[cam_cnt&0x01].facing_info.facing = CAMERA_FACING_BACK;
+ camInfoTmp[cam_cnt].facing_info.facing = CAMERA_FACING_BACK;} memset(sensor_ver,0x00,sizeof(sensor_ver));
@@ -719,7 +720,7 @@ int camera_get_number_of_cameras(void)sprintf(sensor_ver,"%s",pSensorInfo->mSensorName); property_set(sensor_ver, version); - camInfoTmp[cam_cnt&0x01].facing_info.orientation = pSensorInfo->mOrientation;
+ camInfoTmp[cam_cnt].facing_info.orientation = pSensorInfo->mOrientation;cam_cnt++;unsigned int CamsysDrvVersion = profiles->mDevieVector[i]->mCamsysVersion.drv_ver;
@@ -762,22 +763,22 @@ int camera_get_number_of_cameras(void)LOGD("Video device(%s): video capture not supported.\n",cam_path);} else {rk_cam_total_info* pNewCamInfo = new rk_cam_total_info();
- memset(camInfoTmp[cam_cnt&0x01].device_path,0x00, sizeof(camInfoTmp[cam_cnt&0x01].device_path));
- strcat(camInfoTmp[cam_cnt&0x01].device_path,cam_path);
- memset(camInfoTmp[cam_cnt&0x01].fival_list,0x00, sizeof(camInfoTmp[cam_cnt&0x01].fival_list));
- memcpy(camInfoTmp[cam_cnt&0x01].driver,capability.driver, sizeof(camInfoTmp[cam_cnt&0x01].driver));
- camInfoTmp[cam_cnt&0x01].version = capability.version;
+ memset(camInfoTmp[cam_cnt].device_path,0x00, sizeof(camInfoTmp[cam_cnt].device_path));
+ strcat(camInfoTmp[cam_cnt].device_path,cam_path);
+ memset(camInfoTmp[cam_cnt].fival_list,0x00, sizeof(camInfoTmp[cam_cnt].fival_list));
+ memcpy(camInfoTmp[cam_cnt].driver,capability.driver, sizeof(camInfoTmp[cam_cnt].driver));
+ camInfoTmp[cam_cnt].version = capability.version;if (strstr((char*)&capability.card[0], "front") != NULL) {- camInfoTmp[cam_cnt&0x01].facing_info.facing = CAMERA_FACING_FRONT;
+ camInfoTmp[cam_cnt].facing_info.facing = CAMERA_FACING_FRONT;} else {- camInfoTmp[cam_cnt&0x01].facing_info.facing = CAMERA_FACING_BACK;
+ camInfoTmp[cam_cnt].facing_info.facing = CAMERA_FACING_BACK;} ptr = strstr((char*)&capability.card[0],"-");if (ptr != NULL) {ptr++;
- camInfoTmp[cam_cnt&0x01].facing_info.orientation = atoi(ptr);
+ camInfoTmp[cam_cnt].facing_info.orientation = atoi(ptr);} else {- camInfoTmp[cam_cnt&0x01].facing_info.orientation = 0;
+ camInfoTmp[cam_cnt].facing_info.orientation = 0;}memset(version,0x00,sizeof(version));
@@ -1031,6 +1032,7 @@ int camera_get_number_of_cameras(void)strcpy(pNewCamInfo->mHardInfo.mSensorInfo.mSensorName, SOC_CAM_NAME);pNewCamInfo->mIsIommuEnabled = capability.reserved[0];
+ LOGD("mIsIommuEnabled=%d----------",pNewCamInfo->mIsIommuEnabled);if (strstr((char*)&capability.card[0], "front") != NULL) {pNewCamInfo->mHardInfo.mSensorInfo.mFacing = 1;} else {@@ -1095,6 +1097,7 @@ int camera_get_number_of_cameras(void)memcpy(&gCamInfos[0], &camInfoTmp[0], sizeof(rk_cam_info_t));memcpy(&gCamInfos[1], &camInfoTmp[1], sizeof(rk_cam_info_t));
+ memcpy(&gCamInfos[2], &camInfoTmp[2], sizeof(rk_cam_info_t));property_get("ro.sf.hwrotation", property, "0");
diff --git a/CameraHal/CameraHal_Module.h b/CameraHal/CameraHal_Module.h
index bac86d6..66bcd81 100755
--- a/CameraHal/CameraHal_Module.h
+++ b/CameraHal/CameraHal_Module.h
@@ -11,8 +11,8 @@ using namespace android;#define CAMERA_DEFAULT_PREVIEW_FPS_MIN 8000 //8 fps#define CAMERA_DEFAULT_PREVIEW_FPS_MAX 15000#endif
-#define CAMERAS_SUPPORT_MAX 2
-#define CAMERAS_SUPPORTED_SIMUL_MAX 1
+#define CAMERAS_SUPPORT_MAX 3
+#define CAMERAS_SUPPORTED_SIMUL_MAX 3#define CAMERA_DEVICE_NAME "/dev/video"#define CAMERA_MODULE_NAME "RK29_ICS_CameraHal_Module"diff --git a/CameraHal/CameraHal_board_xml_parse.cpp b/CameraHal/CameraHal_board_xml_parse.cpp
old mode 100644
new mode 100755
index fcbab39..35e4d72
--- a/CameraHal/CameraHal_board_xml_parse.cpp
+++ b/CameraHal/CameraHal_board_xml_parse.cpp
@@ -1519,11 +1519,12 @@ int camera_board_profiles::CheckSensorSupportDV(rk_cam_total_info* pCamInfo)ALOGD("(%s) UVC camera resolution(%dx%d) is support \n", pCamInfo->mHardInfo.mSensorInfo.mSensorName, pDVInfo->mWidth, pDVInfo->mHeight);}else if(strcmp(pCamInfo->mHardInfo.mSensorInfo.mSensorName, SOC_CAM_NAME)==0){- if(pDVInfo->mIsSupport)
+ if(pDVInfo->mIsSupport){pDVInfo->mAddMask = 0;
- else{+ ALOGD("(%s) SOC camera resolution(%dx%d) is support \n", pCamInfo->mHardInfo.mSensorInfo.mSensorName, pDVInfo->mWidth, pDVInfo->mHeight);
+ }else{pDVInfo->mAddMask = 1;
- ALOGD("(%s) SOC camera resolution(%dx%d) is support \n", pCamInfo->mHardInfo.mSensorInfo.mSensorName, pDVInfo->mWidth, pDVInfo->mHeight);
+ //ALOGD("(%s) SOC camera resolution(%dx%d) is support \n", pCamInfo->mHardInfo.mSensorInfo.mSensorName, pDVInfo->mWidth, pDVInfo->mHeight);}}else{
@@ -1543,6 +1544,7 @@ int camera_board_profiles::CheckSensorSupportDV(rk_cam_total_info* pCamInfo)if ((unsigned int)(ISI_FPS_GET(pCaps->caps.Resolution)) >= pDVInfo->mFps) {pDVInfo->mFps = ISI_FPS_GET(pCaps->caps.Resolution);pDVInfo->mAddMask = 0;
+ ALOGD("(%s) mipi camera resolution(%dx%d) is support \n", pCamInfo->mHardInfo.mSensorInfo.mSensorName, pDVInfo->mWidth, pDVInfo->mHeight);}}l = l->p_next;
@@ -1603,10 +1605,12 @@ int camera_board_profiles::WriteDevNameTOXML(camera_board_profiles* profiles, chcontinue;}- for(i=0; (i<(int)nCamNum && i<2); i++){+ for(i=0; (i<(int)nCamNum /*&& i<2*/); i++){fprintf(fpdst, "<!-- videoname%d=\"%s\" index=%d facing=%d --> \n", i, profiles->mDevideConnectVector[i]->mHardInfo.mSensorInfo.mSensorName,profiles->mDevideConnectVector[i]->mDeviceIndex, profiles->mDevideConnectVector[i]->mHardInfo.mSensorInfo.mFacing);
+ LOGD("videoname%d=\"%s\" index=%d facing=%d-----rk",i, profiles->mDevideConnectVector[i]->mHardInfo.mSensorInfo.mSensorName,
+ profiles->mDevideConnectVector[i]->mDeviceIndex, profiles->mDevideConnectVector[i]->mHardInfo.mSensorInfo.mFacing);}isWrite=1; }
@@ -1811,7 +1815,7 @@ int camera_board_profiles::ModifyMediaProfileXML( camera_board_profiles* profilelong front_fptmp = 0,back_fptmp = 0;char *leave_line, *leave_line1, *leave_line2;- xml_fp_pos_s fp_pos[2];
+ xml_fp_pos_s fp_pos[3]; xml_video_element_s find_element;src_fp = fopen(src_xml_file, "r");
@@ -1848,12 +1852,24 @@ int camera_board_profiles::ModifyMediaProfileXML( camera_board_profiles* profilegoto alter_exit; }+ fp_pos[2].camid = 2;
+ fp_pos[2].camid_start = 0;
+ fp_pos[2].camid_end = 0;
+ ret = XMLFseekCamIDPos(src_fp, &fp_pos[2]);
+ if(ret < 0 || fp_pos[2].camid_end <= fp_pos[2].camid_start){+ ALOGE("find camid(%d) failed\n", fp_pos[2].camid);
+ err = -3;
+ goto alter_exit;
+ }
+find_element.isAddMark = 1;find_element.n_cameraId = -1;find_element.n_frameRate = 0;find_element.n_width = 0;find_element.n_height = 0;
- if(fp_pos[0].camid_end>0 && fp_pos[0].camid_start>0 && fp_pos[1].camid_end>0 && fp_pos[1].camid_start>0){+ if(fp_pos[0].camid_end>0 && fp_pos[0].camid_start>0 &&
+ fp_pos[1].camid_end>0 && fp_pos[1].camid_start>0 &&
+ fp_pos[2].camid_end>0 && fp_pos[2].camid_start>0){fseek(src_fp,0,SEEK_SET); fseek(dst_fp,0,SEEK_SET);@@ -1945,6 +1961,8 @@ int camera_board_profiles::ModifyMediaProfileXML( camera_board_profiles* profilefind_element.n_cameraId = 0;else if(now_fp_pos>fp_pos[1].camid_start && now_fp_pos<fp_pos[1].camid_end)find_element.n_cameraId = 1;
+ else if(now_fp_pos>fp_pos[2].camid_start && now_fp_pos<fp_pos[2].camid_end)
+ find_element.n_cameraId = 2;elsefind_element.n_cameraId = -1;@@ -2033,7 +2051,7 @@ int camera_board_profiles::ProduceNewXml(camera_board_profiles* profiles)size_t nCamNum =profiles->mDevideConnectVector.size();//verrify media_xml_device is supported by board xml
- for(int i=0; (i<profiles->xml_device_count && i<2); i++)
+ for(int i=0; (i<profiles->xml_device_count && i<nCamNum); i++){res |= ConnectDevHaveDev(profiles, (profiles->mXmlDevInfo + i));}
@@ -2047,6 +2065,7 @@ int camera_board_profiles::ProduceNewXml(camera_board_profiles* profiles)//if((int)nCamNum>=1){ if((int)nCamNum>=1 && fileexit == -1){LOG1("enter produce new xml\n");
+ LOGD("nCamNum=%d",nCamNum);//new xml file namestrlcpy(default_file, RK_DEFAULT_MEDIA_PROFILES_XML_PATH, sizeof(default_file));strlcpy(dst_file, RK_DST_MEDIA_PROFILES_XML_PATH, sizeof(dst_file));
开机后Camera HAL层模块函数ModifyMediaProfileXML()会提示找不到 camid(2), 这是由于系统的media_profiles.xml是基于 media_profiles_default.xml创建的, 此文件位于 device/rockchip/common下面。
因此,只要在此文件中添加对应camera id 2的 CamcorderProfiles栏位就可以正常了。
添加四颗以上的USB Camera方法同理。
[RK3399][Android7.1] 调试笔记 --- 三颗以上USB Camera的支持相关推荐
- [RK3399][Android7.1] 调试笔记 --- 系统默认时钟配置
OS: Android 7.1 Board: Firefly-RK3399 Kernel: v4.4.55 分两个模块,一个是cpu,还有一个是pmu模块,这里只举例cpu,cpu又分在两个文件中定义 ...
- android手机底噪,[RK3399][Android7.1] 调试笔记 --- Codec播放音乐会有底噪
Platform: RK3399 OS: Android 7.1 Kernel: v4.4.83 背景: 移植完Codec RT5640之后,发现播放声音的时候底部有噪声. 用示波器测量到的左右声道波 ...
- [RK3399][Android7.1] 调试笔记 --- I2S1工作输出是12MHz问题
Platform: RK3399 OS: Android 7.1 Kernel: v4.4.83 现象: 使用I2S1通道,测量到的I2S MCLK是12MHz. 理论上应该是11.288MHz. 原 ...
- [RK3399][Android7.1] 调试笔记 --- 使用ADC芯片ES7243遇到的问题
Platform: RK3399 OS: Android 7.1 Kernel: v4.4.83 用途: ES7243模块用于环形麦克场景时,采集的是音频播放的声音,然后采到之后回送到CPU,和麦克录 ...
- [RK3399][Android7.1] 调试笔记 --- USB type-c插入后无法识别到
Platform: RK3399 OS: Android 7.1 Kernel: v4.4.83 现象: 用update.img制作了一个升级包之后可以升级,但是无法识别到type-c. Log: 插 ...
- [RK3399][Android7.1] 调试笔记 --- sdcard守护进程启动位置
Platform: RK3399 OS: Android 7.1 Kernel: v4.4.83 Board: Firefly-RK3399 之前版本sdcard守护进程都是放在init.rc中启动: ...
- [RK3399][Android7.1] 调试笔记 --- CPU_B_SLEEP引脚改动引起系统无法开机
Platform: RK3399 OS: Android 7.1 Kernel: v4.4.83 朋友按照参考设计和firefly的板子做的硬件,无法开机. 一开始只能进入maskrom,能下载,但是 ...
- android 修改系统参数设置,2021-05-15 [RK3399][Android7.1] 调试笔记 ---显示参数动态设置接口...
系统环境: Platform: RK3399 OS: Android 7.1 Kernel: v4.4.83 接口代码所在位置为: /frameworks/base/core/java/android ...
- [RK3399][Android7.1] 调试笔记 --- DDR中clock相关配置
OS: Android 7.1 Board: Firefly-RK3399 Kernel: v4.4.55 把这个拎出来说是因为在调试ddr default rate的时候对这部分有些误区. dmc中 ...
最新文章
- 改进AI/ML部署的5种方法
- Python 之 Numpy (三)运算
- 前端工程化工具Fekit分析
- [力扣leetcode39]组合总和及回溯法
- springboot md5加密_SpringSecurity入门-SpringBoot集成SpringSecurity
- 【渝粤教育】电大中专新媒体营销实务 (6)作业 题库
- C/C++基础语法,赶紧收藏好哟~
- python文档字符串格式_Python字符串及文本模式方法详解
- Recommendation
- 长连接与心跳包 Persistent connection and HearBeats
- 贴片SMD制作PCB封装详细设计规范和步骤
- JavaScript(JS)网页--动态生成表格
- 批量修改文件夹内文件格式
- 关于部分网页打不开的解决方法详解
- 我和谷歌共同成长----Andriod(安卓)开发(持续更新)
- Ghost之远程终端管理
- 【Unity3D日常开发】Unity3D中实现屏幕坐标和3维空间坐标的转化
- 黑客狂野利用零日漏洞:小米三星也中招,安卓手机最易受此漏洞的攻击?
- word怎么添加水印 word添加水印后为什么看不见
- java 创建对象的init_Java 对象创建过程。init 方法和 clinit方法。