20230520查找中国移动的APP在RK3566下调用UVC摄像头出错
2023/5/20 23:34
SDK:Android12
RK3566平台 android12 UVC camera 没插摄像头,但是/dev/video0-13标号被占用,是啥原因导致的
板子上也没有摄像头
【板子没有接CSI/MIPI接口的I2C通道的摄像头】
1、查找/dev/videoX尝试确认问题:
v4l2-ctl --list-devices
确定有多余的东西
v4l2-ctl --list-formats-ext --device /dev/video9
v4l2-ctl --list-formats-ext --device /dev/video9
rk3566_s:/ # v4l2-ctl --list-devices
rkisp-statistics (platform: rkisp):
/dev/video12
/dev/video13
rkcif (platform:rkcif_mipi_lvds):
/dev/video0
/dev/video1
/dev/video2
/dev/video3
/dev/video4
rkisp_mainpath (platform:rkisp-vir0):
/dev/video5
/dev/video6
/dev/video7
/dev/video8
/dev/video9
/dev/video10
/dev/video11
应该是2手(SDK),没有其他开发板了,所以没测试过。
只对比过之前公司一个项目是其他公司的板子,上面也是RK3566和Android11,是正常的。
怀疑rkcif (platform:rkcif_mipi_lvds)这些节点是RK自己生成的
2、SDK的编译步骤:
source build/envsetup.sh
lunch rk3566_s-userdebug
./build.sh -AUCKu -d rk3566-evb2-lp4x-v10
E/Camera-JNI: android_hardware_Camera_getCameraInfo: Unknown camera ID 114
RK3566使用Android12(linux-5.10)
<11>[ 529.484636][ T1] init: Control message: Could not find 'aidl/SurfaceFlinger' for ctl.interface_start from pid: 231 (/system/bin/servicemanager)
<11>[ 530.460081][ T1] init: Control message: Could not find 'aidl/SurfaceFlinger' for ctl.interface_start from pid: 231 (/system/bin/servicemanager)
<11>[ 530.485531][ T1] init: Control message: Could not find 'aidl/SurfaceFlinger' for ctl.interface_start from pid: 231 (/system/bin/servicemanager)
<14>[ 530.832660][ T1] init: starting service 'surfaceflinger'...
卡在开机了起不来
3、这里的100改为0就可以
/media/imab/data/rk/RK3566/hardware/interfaces/camera/device/3.4/default /ExternalCamerautils.cpp (hardware)
Z:\RK3588-sdk\hardware\interfaces\camera\device\3.4\default\ExternalCameraUtils.cpp
int AllocatedV4L2Frame::getData(uint8_t** outData, size_t* dataSize) {
if (outData == nullptr || dataSize == nullptr) {
ALOGE("%s: outData(%p)/dataSize(%p) must not be null", __FUNCTION__, outData, dataSize);
return -1;
}
*outData = mData.data();
*dataSize = mData.size();
return 0;
}
AllocatedV4L2Frame::~AllocatedV4L2Frame() {}
} // namespace implementation
} // namespace V3_6
} // namespace device
namespace external {
namespace common {
namespace {
const int kDefaultCameraIdOffset = 0; // 100
const int kDefaultJpegBufSize = 5 << 20; // 5MB
const int kDefaultNumVideoBuffer = 4;
const int kDefaultNumStillBuffer = 2;
const int kDefaultOrientation = 0; // suitable for natural landscape displays like tablet/TV
// For phone devices 270 is better
} // anonymous namespace
const char* ExternalCameraConfig::kDefaultCfgPath = "/vendor/etc/external_camera_config.xml";
结论:
移动云APP是调用的camera1接口,那个接口应该是被camera2接口取代了,那里面对camera id的判断逻辑有点问题。
而我们现在的USB camera的id默认会加100的offset值,比如说设备节点是/dev/video14,camera id就是114。
这样导致在那里面会直接抛异常,现在就是在camera的HAL层生成camera id时去掉那个offset值,直接和设备节点保持匹配就能适配camera1了。
这样干之后会有其他后果不!比如和i2c摄像头冲突
不会的,如果有其他摄像头会排在usb camera前面
cvitek晶视的cv1826也出现这种情况了
从video100开始:
/dev/video100
/dev/video102
/dev/video103
/dev/video104
/dev/video105
/dev/video106
/dev/video107
/dev/video109
RK3566+Android12:我那个代码是4.19
Z:\smartpen\linux\build\cv1826_wevb_0005a\.config
CV1826:# Linux/arm 4.19.164 Kernel Configuration