高通 mm_qcamera_app test 学习

我们在高通8053的adb shell中使用

mm_camera_app的官方自带例程来测试摄像头的好坏。

/ # mm-qcamera-app 
Please Select Execution Mode:
0: Menu Based 1: Regression
0
Starting Menu based!!
===========================================
      Camera Sensor to be used:            
===========================================
A.  Primary Camera
Please enter your choice for sensor: 


代码的路径在  QCamera2\stack\mm-camera-test



int main()

{

    char tc_buf[3];

    int mode = 0;

    int rc = 0;



    printf("Please Select Execution Mode:\n");

    printf("0: Menu Based 1: Regression\n");

    fgets(tc_buf, 3, stdin);

    mode = tc_buf[0] - '0';

    if(mode == 0) {

      printf("\nStarting Menu based!!\n");

    } else if(mode == 1) {

      printf("Starting Regression testing!!\n");

      if(!mm_app_start_regression_test(1)) {

         printf("\nRegressiion test passed!!\n");

         return 0;

      } else {

        printf("\nRegression test failed!!\n");

        exit(-1);

      }

    } else {

       printf("\nPlease Enter 0 or 1\n");

       printf("\nExisting the App!!\n");

       exit(-1);

    }





    rc = submain();



    printf("Exiting application\n");



    return rc;

}

main里边实现了选择了基础测试和回归测试。


主要的逻辑在sub_main 里边实现,。

该文件叫mm_camera_main_menu.c 

包含的头文件

// Camera dependencies
#include "mm_qcamera_main_menu.h"
#include "mm_qcamera_app.h"
#include "mm_qcamera_dbg.h"
在main_menu.h里边包含了// Camera dependencies
#include "mm_camera_interface.h"
#include "mm_jpeg_interface.h"
可见是通过这里camera的interface接口的。在这个函数中解压hal层的so库,如下 

    my_cam_app->hal_lib.ptr = dlopen("libmmcamera_interface.so", RTLD_NOW);
    my_cam_app->hal_lib.ptr_jpeg = dlopen("libmmjpeg_interface.so", RTLD_NOW);
    if (!my_cam_app->hal_lib.ptr || !my_cam_app->hal_lib.ptr_jpeg) {
        LOGE("Error opening HAL library %s\n",  dlerror());
        return -MM_CAMERA_E_GENERAL;
    }
    *(void **)&(my_cam_app->hal_lib.get_num_of_cameras) =
        dlsym(my_cam_app->hal_lib.ptr, "get_num_of_cameras");
    *(void **)&(my_cam_app->hal_lib.mm_camera_open) =
        dlsym(my_cam_app->hal_lib.ptr, "camera_open");
    *(void **)&(my_cam_app->hal_lib.jpeg_open) =
        dlsym(my_cam_app->hal_lib.ptr_jpeg, "jpeg_open");
在安卓中我们的确找到了该so 库

/ # find . -name "libmmcamera_interface.so"

./usr/lib/libmmcamera_interface.so
/ # find . -name "libmmjpeg_interface.so"
find: ./sys/kernel/slab/L2TP/IPv6: No such file or directory
find: ./sys/kernel/slab/L2TP/IP: No such file or directory
./usr/lib/libmmjpeg_interface.so

sitemap