31全志r58平台Android4.4.2下打开USB摄像头
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摄像头的更多相关文章
- 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 ...
- 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 ...
- 全志R58平台的GPIO引脚控制
全志R58平台的GPIO引脚控制 2017/8/18 15:50 版本:V1.0 开发板:SC5806(全志R58平台) SDK:android4.4.4 本文以GPIO引脚PD24为例,在开发板的背 ...
- 全志R58平台调通s5k5eya(RAW+MIPI)
全志R58平台调通s5k5eya(RAW+MIPI) 2017/5/31 10:30 版本:V1.1 1.前期使用的是s5k5eyx的ISP的固件/tuning 文件 Y:\s5k5eya_r58_d ...
- 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 ...
- 04全志R58平台编译内核需要选择的配置
04全志R58平台编译内核需要选择的配置 2018/11/6 14:19 版本:V1.0 开发板:SC5806 1.系统编译:(略) 每次系统编译/内核的时候都需要选3次N: * * Xtables ...
- 461在全志r16平台tinav3.0系统下使用地磁计QMC5883L
461在全志r16平台tinav3.0系统下使用地磁计QMC5883L 2018/9/7 14:08 版本:V1.0 开发板:SC3817R SDK:tina v3.0 (基本确认全志tina v3. ...
- centos下安装usb摄像头驱动
centos安装在虚拟机下,win7下能正常使用摄像头. 虚拟机显示监测到摄像头,但驱动安装失败. terminal下输入yum install cheese,提示是否安装,输入y确认下载,大概100 ...
- 在virtualbox(win7)下使用USB摄像头
解决方法: 去https://www.virtualbox.org/wiki/Downloads下载VirtualBox 4.3.8 Oracle VM VirtualBox Extension Pa ...
随机推荐
- OpenCode:template
ylbtech-OpenCode: 1.返回顶部 2.返回顶部 3.返回顶部 4.返回顶部 5.返回顶部 6.返回顶部 作者:ylbtech出处:http://ylbtec ...
- Lagom学习 六 Akka Stream
lagom中的stream 流数据处理是基于akka stream的,异步的处理流数据的.如下看代码: 流式service好处是: A: 并行: hellos.mapAsync(8, name -& ...
- jvm虚拟机androidy移植-编译篇
有这个必要吗?都过时的东西了,android上的Dalvik效率不够高吗,不够逼格吗? 是的但有总东西是不是我们这些码农能决定的,领导和项目需求才是你要关心的,毕竟工作要向领导汇报,项目要去挣钱钱,但 ...
- JAVA + SELENIUM--环境搭建
一.安装JDK 可在JAVA官网http://www.java.com/zh_CN/download/ 中下载最新的JDK,并按提示安装 环境变量配置:我的电脑右键-->属性--&g ...
- [poj1986]Distance Queries(LCA)
解题关键:LCA模板题 复杂度:$O(n\log n)$ #pragma comment(linker, "/STACK:1024000000,1024000000") #incl ...
- font-size: 0;解决元素间的空白间隙
看别人的代码看到过font-size:0这个设置,不明白为何这样操作,后来研究一下才明白:这是像素级还原设计稿很有用的设置,因为元素节点有文本节点,在缩进代码时会占据宽度,这么说不好理解,演示如下: ...
- 7.13实习培训日志 Docker
静态博客github地址 静态博客github地址轻量版 Docker Docker镜像 Docker镜像概念 Docker镜像下载时的分层体现:一层层下载,下载过程中给出了每一层的 ID 的前 12 ...
- Razor与HTML混合输出陷阱与技巧
3,Razor与HTML混合输出陷阱与技巧 属性名称误判 有时候我们必须让html内容与razor语句紧接在一起, eg: 您好,a先生 假设变量名称为ViewBag.Name, 您好, ...
- 点击实现CSS样式切换
如图所示 代码如下图: 特别要注意的是:a标签不会继承上级的color,所以要单独为其设置 参看代码(并非上图代码)如下: <!DOCTYPE html> <html> < ...
- Unity 5.6中的混合光照(下)
https://mp.weixin.qq.com/s/DNQFsWpZm-ybIlF3DTAk2A 在<Unity 5.6中的混合光照(上)>中,我们介绍了混合模式,以及Subtracti ...