31全志r58平台Android4.4.2下打开USB摄像头

2018/10/26 16:00

版本:V1.0

开发板:SC5806

1、系统编译:(略)

2、需要修改的文件:

W:\r58_android_v4.4\android\device\softwinner\octopus-common\hardware\camera\V4L2CameraDevice2.cpp

(这里不修改,你的USB摄像头是肯定打不开的!)

/****************************************************************************

* V4L2CameraDevice interface implementation.

***************************************************************************/

status_t V4L2CameraDevice::connectDevice(HALCameraInfo * halInfo)

{

F_LOG;

Mutex::Autolock locker(&mObjectLock);

if (isConnected())

{

LOGW("%s: camera device is already connected.", __FUNCTION__);

return NO_ERROR;

}

// open v4l2 camera device

int ret = openCameraDev(halInfo);

if (ret != OK)

{

return ret;

}

//get sensor type form driver

switch((v4l2_sensor_type)getSensorType()){

case V4L2_SENSOR_TYPE_YUV:

LOGV("the sensor is YUV sensor");

mSensor_Type = V4L2_SENSOR_TYPE_YUV;

break;

case V4L2_SENSOR_TYPE_RAW:

LOGV("the sensor is RAW sensor");

mSensor_Type = V4L2_SENSOR_TYPE_RAW;

break;

default:

if(mIsUsbCamera) {

LOGV("the sensor is UVC sensor wyb add 2018/10/26 13:58");

mSensor_Type = V4L2_SENSOR_TYPE_YUV;

}

else {

LOGE("get the sensor type failed  wyb add 2018/10/26 14:59");

goto END_ERROR;

}

}

halInfo->fast_picture_mode = (int)mSensor_Type; //set the CameraHardware Class fast_picture_mode member

memcpy((void*)&mHalCameraInfo, (void*)halInfo, sizeof(HALCameraInfo));

……

return UNKNOWN_ERROR;

}

bool V4L2CameraDevice::captureThread()

{

……

//get picture flag

mTakePictureFlag.dwval = buf.reserved;

if (mLastZoom != mNewZoom)

{

float widthRate = (float)mFrameWidth / (float)mVideoWidth;

float heightRate = (float)mFrameHeight / (float)mVideoHeight;

if (mIsThumbUsedForVideo && (widthRate > 4.0) && (heightRate > 4.0))

{

calculateCrop(&mRectCrop, mNewZoom, mMaxZoom, mFrameWidth/2, mFrameHeight/2); // for cts, to do

}

else

{

// the main frame crop

calculateCrop(&mRectCrop, mNewZoom, mMaxZoom, mFrameWidth, mFrameHeight);

}

mCameraHardware->setNewCrop(&mRectCrop);

// the sub-frame crop

if (mHalCameraInfo.fast_picture_mode)

{

calculateCrop(&mThumbRectCrop, mNewZoom, mMaxZoom, mThumbWidth, mThumbHeight);

}

mLastZoom = mNewZoom;

mZoomRatio = (mNewZoom * 2 * 100 / mMaxZoom + 100);

LOGV("CROP: [%d, %d, %d, %d]", mRectCrop.left, mRectCrop.top, mRectCrop.right, mRectCrop.bottom);

LOGV("thumb CROP: [%d, %d, %d, %d]", mThumbRectCrop.left, mThumbRectCrop.top, mThumbRectCrop.right, mThumbRectCrop.bottom);

}

if (mVideoFormat != V4L2_PIX_FMT_YUYV

&& mCaptureFormat == V4L2_PIX_FMT_YUYV)

{

#ifdef USE_MP_CONVERT

YUYVToYUV420C((void*)buf.m.offset,

(void*)(mVideoBuffer.buf_phy_addr[buf.index] | 0x40000000),

mFrameWidth,

mFrameHeight);

#else

if(mIsUsbCamera) {

YUYVToNV21(mMapMem.mem[buf.index],

(void*)mVideoBuffer.buf_vir_addr[buf.index],

mFrameWidth,

mFrameHeight);

}

else

{

YUYVToNV12(mMapMem.mem[buf.index],

(void*)mVideoBuffer.buf_vir_addr[buf.index],

mFrameWidth,

mFrameHeight);

}

#endif

}

// V4L2BUF_t for preview and HW encoder

V4L2BUF_t v4l2_buf;

if (mVideoFormat != V4L2_PIX_FMT_YUYV

&& mCaptureFormat == V4L2_PIX_FMT_YUYV)

{

v4l2_buf.addrPhyY = mVideoBuffer.buf_phy_addr[buf.index];

v4l2_buf.addrVirY = mVideoBuffer.buf_vir_addr[buf.index];

}

else

{

v4l2_buf.addrPhyY = buf.m.offset - BUFFER_PHY_OFFSET;

v4l2_buf.addrVirY = (unsigned int)mMapMem.mem[buf.index];

}

……

return true;

}

(如果不修改这里,将会出现不能拍照的情况)

W:\r58_android_v4.4\android\device\softwinner\octopus-f1\configs\camera.cfg

;-------------------------------------------------------------------------------

; 用于camera的配置

;

; 采用格式:

; key = key_value

; 注意: 每个key需要顶格写;

; key_value紧跟着key后面的等号后面, 位于同一行中;

; key_value限制大小为256字节以内;

;

;-------------------------------------------------------------------------------

;-------------------------------------------------------------------------------

; exif information of "make" and "model"

;-------------------------------------------------------------------------------

key_camera_exif_make = MAKE_AllWinner

key_camera_exif_model = MODEL_f1

;-------------------------------------------------------------------------------

; 1 for single camera, 2 for double camera

;-------------------------------------------------------------------------------

number_of_camera = 1

;-------------------------------------------------------------------------------

; CAMERA_FACING_BACK

; ov8858

;-------------------------------------------------------------------------------

camera_id = 0

;-------------------------------------------------------------------------------

; 1 for CAMERA_FACING_FRONT

; 0 for CAMERA_FACING_BACK

;-------------------------------------------------------------------------------

camera_facing = 0

;-------------------------------------------------------------------------------

; 1 for camera without isp(using built-in isp of Axx)

; 0 for camera with isp

;-------------------------------------------------------------------------------

use_builtin_isp = 0

;-------------------------------------------------------------------------------

; camera orientation (0, 90, 180, 270)

;-------------------------------------------------------------------------------

camera_orientation = 90

;-------------------------------------------------------------------------------

; driver device name

;-------------------------------------------------------------------------------

camera_device = /dev/video0

;-------------------------------------------------------------------------------

; device id

; for two camera devices with one CSI

;-------------------------------------------------------------------------------

device_id = 0

used_preview_size = 1

key_support_preview_size = 640x480

key_default_preview_size = 640x480

used_picture_size = 1

key_support_picture_size = 640x480

key_default_picture_size = 640x480

used_flash_mode = 0

key_support_flash_mode = on,off,auto,red-eye,torch

key_default_flash_mode = off

used_color_effect=0

key_support_color_effect = none,mono,negative,sepia,aqua

key_default_color_effect = none

used_frame_rate = 1

key_support_frame_rate = 25

key_default_frame_rate = 25

used_focus_mode = 1

key_support_focus_mode = auto,infinity,macro,fixed

key_default_focus_mode = auto

;used_scene_mode = 0

;key_support_scene_mode = auto,action,portrait,landscape,night,night-portrait,theatre,beach,snow,sunset,steadyphoto,fireworks,sports,party,candlelight,barcode,hdr

;key_default_scene_mode = auto

used_scene_mode = 1

key_support_scene_mode = auto,hdr

key_default_scene_mode = auto

used_white_balance = 1

key_support_white_balance = auto,incandescent,fluorescent,warm-fluorescent,daylight,cloudy-daylight

key_default_white_balance = auto

used_exposure_compensation = 1

key_max_exposure_compensation = 3

key_min_exposure_compensation = -3

key_step_exposure_compensation = 1

key_default_exposure_compensation = 0

used_zoom = 1

key_zoom_supported = true

key_smooth_zoom_supported = false

key_zoom_ratios = 100,120,150,200,230,250,300

key_max_zoom = 30

key_default_zoom = 0

key_horizonal_view_angle = 64

key_vertical_view_angle = 39.4

(配置录像的格式,点录像会出错,原因未知!)

W:\r58_android_v4.4\android\device\softwinner\octopus-f1\configs\media_profiles.xml

W:\r58_android_v4.4\android\device\softwinner\octopus-f1\BoardConfig.mk

W:\r58_android_v4.4\android\device\softwinner\octopus-f1\init.sun8i.rc

#gpu

insmod /system/vendor/modules/pvrsrvkm.ko

#    insmod /system/vendor/modules/dc_sunxi.ko

#csi module

#insmod /system/vendor/modules/videobuf-core.ko

#insmod /system/vendor/modules/videobuf-dma-contig.ko

#insmod /system/vendor/modules/cci.ko

#insmod /system/vendor/modules/actuator.ko

#insmod /system/vendor/modules/vfe_os.ko

#insmod /system/vendor/modules/vfe_subdev.ko

#insmod /system/vendor/modules/dw9714_act.ko

#insmod /system/vendor/modules/hi253.ko

#insmod /system/vendor/modules/ov8858_4lane.ko

#insmod /system/vendor/modules/vfe_v4l2.ko

# usb module / UVC

insmod /system/vendor/modules/videobuf2-core.ko

insmod /system/vendor/modules/videobuf2-memops.ko

insmod /system/vendor/modules/videobuf2-vmalloc.ko

insmod /system/vendor/modules/uvcvideo.ko

#facedetection module

insmod /system/vendor/modules/sunxi_fd.ko

W:\r58_android_v4.4\android\device\softwinner\octopus-f1\octopus_f1.mk

打开USB摄像头驱动/UVC

W:\r58_android_v4.4\lichee\linux-3.4\.config

1、打印等级调整

rootroot@cm88:/home/wwt/r58_android_v4/lichee/linux-3.4$ make ARCH=arm menuconfig

Device Drivers  --->

<*> Multimedia support  --->

[*]   Video capture adapters  --->

[*]   V4L USB devices  --->

--- V4L USB devices

< >   USB Video Class (UVC)

修改为:

<M>   USB Video Class (UVC)

[*]     UVC input events device support

W:\r58_android_v4.4\lichee\tools\pack\chips\sun8iw6p1\configs\f1\sys_config.fex

;--------------------------------------------------------------------------------

;vip (video input port) configuration

;vip_used: 0:disable 1:enable

;vip_mode: 0:sample one interface to one buffer 1:sample two interface to one buffer

;vip_dev_qty: The quantity of devices linked to capture bus

;

;vip_define_sensor_list: If you want use sensor detect function, please set vip_define_sensor_list = 1, and

;                                    verify that file /system/etc/hawkview/sensor_list_cfg.ini is properly configured!

;

;vip_dev(x)_pos: sensor position, "rear" or "front", if vip_define_sensor_list = 1,

;vip_dev(x)_pos must be configured!

;

;vip_dev(x)_isp_used 0:not use isp 1:use isp

;vip_dev(x)_fmt: 0:yuv 1:bayer raw rgb

;vip_dev(x)_stby_mode: 0:not shut down power at standby 1:shut down power at standby

;vip_dev(x)_vflip: flip in vertical direction 0:disable 1:enable

;vip_dev(x)_hflip: flip in horizontal direction 0:disable 1:enable

;vip_dev(x)_iovdd: camera module io power handle string, pmu power supply

;vip_dev(x)_iovdd_vol: camera module io power voltage, pmu power supply

;vip_dev(x)_avdd: camera module analog power handle string, pmu power supply

;vip_dev(x)_avdd_vol: camera module analog power voltage, pmu power supply

;vip_dev(x)_dvdd: camera module core power handle string, pmu power supply

;vip_dev(x)_dvdd_vol: camera module core power voltage, pmu power supply

;vip_dev(x)_afvdd: camera module vcm power handle string, pmu power supply

;vip_dev(x)_afvdd_vol: camera module vcm power voltage, pmu power supply

;x indicates the index of the devices which are linked to the same capture bus

;fill voltage in uV, e.g. iovdd = 2.8V, vip_devx_iovdd_vol = 2800000

;fill handle string as below:

;axp22_eldo3

;axp22_dldo4

;axp22_eldo2

;fill handle string "" when not using any pmu power supply

;--------------------------------------------------------------------------------

[csi0]

vip_used                 = 1

vip_mode                 = 0

vip_dev_qty              = 1

vip_define_sensor_list     = 0

;vip_csi_pck              = port:PE00<2><default><default><default>

vip_csi_mck              = port:PE01<2><default><default><default>

;vip_csi_hsync            = port:PE02<2><default><default><default>

;vip_csi_vsync            = port:PE03<2><default><default><default>

;vip_csi_d0               =

;vip_csi_d1               =

;vip_csi_d0               = port:PE04<2><default><default><default>

;vip_csi_d1               = port:PE05<2><default><default><default>

;vip_csi_d2               = port:PE06<2><default><default><default>

;vip_csi_d3               = port:PE07<2><default><default><default>

;vip_csi_d4               = port:PE08<2><default><default><default>

;vip_csi_d5               = port:PE09<2><default><default><default>

;vip_csi_d6               = port:PE10<2><default><default><default>

;vip_csi_d7               = port:PE11<2><default><default><default>

;vip_csi_d8               = port:PE12<2><default><default><default>

;vip_csi_d9               = port:PE13<2><default><default><default>

vip_csi_sck               = port:PE14<2><default><default><default>

vip_csi_sda               = port:PE15<2><default><default><default>

vip_dev0_mname           = "imx179"

vip_dev0_pos             = "rear"

vip_dev0_lane            = 4

vip_dev0_twi_id          = 0

vip_dev0_twi_addr        = 0x20

vip_dev0_isp_used        = 1

vip_dev0_fmt             = 1

vip_dev0_stby_mode       = 1

vip_dev0_vflip           = 1

vip_dev0_hflip           = 1

vip_dev0_iovdd           = "axp81x_dldo3"

vip_dev0_iovdd_vol       = 1800000

vip_dev0_avdd            = "axp81x_dldo4"

vip_dev0_avdd_vol        = 2700000

vip_dev0_dvdd            = "axp81x_eldo1"

vip_dev0_dvdd_vol        = 1200000

vip_dev0_afvdd           = "axp81x_dldo3"

vip_dev0_afvdd_vol       = 2800000

vip_dev0_power_en        =

vip_dev0_reset           = port:PE16<1><default><default><default>

vip_dev0_pwdn            = port:PE17<1><default><default><default>

vip_dev0_flash_en        =

vip_dev0_flash_mode      =

vip_dev0_af_pwdn         =

vip_dev0_act_used        = 1

vip_dev0_act_name        = "dw9714_act"

vip_dev0_act_slave       = 0x18

vip_dev1_mname           = "ov8865_4lane"

vip_dev1_pos             = "front"

vip_dev1_lane            = 4

vip_dev1_twi_id          = 0

vip_dev1_twi_addr        = 0x21

vip_dev1_isp_used        = 1

vip_dev1_fmt             = 1

vip_dev1_stby_mode       = 1

vip_dev1_vflip           = 0

vip_dev1_hflip           = 0

vip_dev1_iovdd           = "axp81x_dldo3"

vip_dev1_iovdd_vol       = 2800000

vip_dev1_avdd            = "axp81x_dldo4"

vip_dev1_avdd_vol        = 2800000

vip_dev1_dvdd            = "axp81x_eldo3"

vip_dev1_dvdd_vol        = 1200000

vip_dev1_afvdd           = "axp81x_dldo3"

vip_dev1_afvdd_vol       = 2800000

vip_dev1_power_en        =

vip_dev1_reset           = port:PB02<1><default><default><default>

vip_dev1_pwdn            = port:PB03<1><default><default><default>

vip_dev1_flash_en        =

vip_dev1_flash_mode      =

vip_dev1_af_pwdn         =

vip_dev1_act_used        = 1

vip_dev1_act_name        = "ad5820_act"

vip_dev1_act_slave       = 0x18

现阶段调出来的效果就是640x480分辨率拍照,其它拍照分辨率和录像正在尝试中!

31全志r58平台Android4.4.2下打开USB摄像头的更多相关文章

  1. 02全志r58平台Android4.4.4下关闭内核中的CPU的开启关闭提示

    02全志r58平台Android4.4.4下关闭内核中的CPU的开启关闭提示 2017/8/18 13:53 版本:V1.0 开发板:SC5806(全志R58平台) SDK:android4.4.4 ...

  2. 51全志R58平台Android4.4下Camera的HAL层修改

    51全志R58平台Android4.4下Camera的HAL层修改 2018/11/7 15:20 版本:V1.0 开发板:SC5806 1.系统编译: (略) 2.全志R58平台Android4.4 ...

  3. 全志R58平台的GPIO引脚控制

    全志R58平台的GPIO引脚控制 2017/8/18 15:50 版本:V1.0 开发板:SC5806(全志R58平台) SDK:android4.4.4 本文以GPIO引脚PD24为例,在开发板的背 ...

  4. 全志R58平台调通s5k5eya(RAW+MIPI)

    全志R58平台调通s5k5eya(RAW+MIPI) 2017/5/31 10:30 版本:V1.1 1.前期使用的是s5k5eyx的ISP的固件/tuning 文件 Y:\s5k5eya_r58_d ...

  5. 460在全志r16平台tinav3.0系统下使用i2c-tools

    460在全志r16平台tinav3.0系统下使用i2c-tools 2018/9/6 19:05 版本:V1.0 开发板:SC3817R SDK:tina v3.0 1.01原始编译全志r16平台ti ...

  6. 04全志R58平台编译内核需要选择的配置

    04全志R58平台编译内核需要选择的配置 2018/11/6 14:19 版本:V1.0 开发板:SC5806 1.系统编译:(略) 每次系统编译/内核的时候都需要选3次N: * * Xtables ...

  7. 461在全志r16平台tinav3.0系统下使用地磁计QMC5883L

    461在全志r16平台tinav3.0系统下使用地磁计QMC5883L 2018/9/7 14:08 版本:V1.0 开发板:SC3817R SDK:tina v3.0 (基本确认全志tina v3. ...

  8. centos下安装usb摄像头驱动

    centos安装在虚拟机下,win7下能正常使用摄像头. 虚拟机显示监测到摄像头,但驱动安装失败. terminal下输入yum install cheese,提示是否安装,输入y确认下载,大概100 ...

  9. 在virtualbox(win7)下使用USB摄像头

    解决方法: 去https://www.virtualbox.org/wiki/Downloads下载VirtualBox 4.3.8 Oracle VM VirtualBox Extension Pa ...

随机推荐

  1. jQuery之简单的表单验证

    html部分: <body> <form method="post" action=""> <div class="in ...

  2. 【转】Pro Android学习笔记(四):了解Android资源(下)

    处理任意的XML文件 自定义的xml文件放置在res/xml/下,可以通过R.xml.file_name来获取一个XMLResourceParser对象.下面是xml文件的例子: <rootna ...

  3. Camera Vision - video surveillance on C#

    转自:http://blog.csdn.net/xyz_lmn/article/details/6072897 http://www.codeproject.com/KB/audio-video/ca ...

  4. Flutter汇总贴

    Fluuter常遇到的问题 Flutter从入门到进阶实战携程网App_汇总贴 Flutter教程网 http://www.flutterj.com/ 第三季:https://jspang.com/p ...

  5. c# sleep 例子-线程挂起

    using System; using System.Threading; public class arr { public static void Main() { //int[] arr; // ...

  6. C# 获取外网IP和运营商和城市

    /// <summary> /// 获取客户端外网IP,省份,城市,运营商 /// 2012年12月18日 15:07 /// </summary> public class ...

  7. laravel ajax提交登陆存储session,并输出

    前端输出session {{ Session::get('username') }} ajax提交 <div>{{ Session::get('username') }}</div& ...

  8. IT兄弟连 Java语法教程 变量1

    什么是变量 在Java程序中,变量是基本的存储单元.是在程序运行中值可以改变的一块内存区域.变量是通过标识符(变量名).变量类型及可选的初始化器来定义的,此外,所有的变量都有作用域,作用域定义了变量的 ...

  9. IOS UILabel的一些使用小技巧

    1. 你在iOS6的需要NSLineBreakByWordWrapping 为了您的代码试试这个: NSString *string = @"bla"; CGSize s = [s ...

  10. JavaWeb案例: 文件下载 基于tomcat8 默认编码为UTF-8

    package cn.itcast.download; import javax.servlet.ServletException; import javax.servlet.ServletOutpu ...