MTK 虚拟 sensor bring up (pick up) sensor2.0
pick up bring up sensor2.0
1.SCP侧的配置
(1) 放置驱动pickup.c
路径:
vendor/mediatek/proprietary/tinysys/scp/middleware/contexthub/VIRT_Driver
(2) 添加底层驱动文件编译开关
路径:
vendor/mediatek/proprietary/tinysys/scp/project/RVxx_A/project.mk
CFG_PICKUP_SUPPORT = yes
(3) 加入编译文件
路径:
vendor/mediatek/proprietary/tinysys/scp/project/RVxx_A//platform/features/chre.mk
######## pickup ########
ifeq ($(CFG_PICKUP_SUPPORT),yes)
C_FILES += $(SCP_MIDDLEWARE_DIR)/contexthub/VIRT_Driver/pickup.c
endif
(4) 增加数据上报方式
路径:
vendor/mediatek/proprietary/tinysys/scp/middleware/contexthub/contexthub_fw.h
#define SENSOR_TYPE_PICK_UP_GESTURE 25 /* these three type can be confirguratured */
typedef enum {
GESTURE_NONE,
SHAKE,
TAP,
TWIST,
FLIP,
SNAPSHOT,
ANSWERCALL,
PICKUP,
GESTURE_MAX
} gesture_type_t;
路径:
vendor/mediatek/proprietary/tinysys/scp/middleware/contexthub/contexthub_fw.c
uint8_t chreTypeToMtkType(uint8_t sensortype)
{
...
case SENS_TYPE_PICK_UP:
return SENSOR_TYPE_PICK_UP_GESTURE;
...
}
uint8_t mtkTypeToChreType(uint8_t sensortype)
{
...
case SENSOR_TYPE_PICK_UP_GESTURE:
return SENS_TYPE_PICK_UP;
...
}
static void initSensorReportingInfo(void)
{
...
sensorReportingMode[SENSOR_TYPE_PICK_UP_GESTURE] = onChange;
sensorAccurancyMode[SENSOR_TYPE_PICK_UP_GESTURE] = SENSOR_STATUS_ACCURACY_HIGH;
...
}
static void contextHubTransferOnChangeSensor(uint8_t mtk_type, const struct mtkActiveSensor *sensor)
{
case SENSOR_TYPE_PICK_UP_GESTURE:
case SENSOR_TYPE_FOD:
case SENSOR_TYPE_AOD:
case SENSOR_TYPE_NONUI:
osLog(LOG_INFO, "mtk_type: %d send flush action\n", mtk_type);
dummy.value[0] = (int32_t)(sensor->buffer.single[numSamples].idata);
break;
}
(5)修改SENS的type
路径:
/vendor/mediatek/proprietary/hardware/contexthub/firmware/inc/sensType.h
#define SENS_TYPE_PICK_UP 40
2.kernel层的配置
(1) 修改hf_sensor_type.h
注: type的顺序和ID的顺序需要对应
路径:
kernel-4.14/drivers/misc/mediatek/sensor/2.0/core/hf_sensor_type.h
enum {
...
SENSOR_TYPE_PICK_UP_GESTURE,
...
SENSOR_TYPE_SENSOR_MAX,
};
enum {
...
ID_PICK_UP_GESTURE,
...
ID_SENSOR_MAX,
};
(2) 修改mtk_nanohub.c
路径:
kernel-4.14/drivers/misc/mediatek/sensor/2.0/mtk_nanohub/mtk_nanohub.c
static void mtk_nanohub_init_sensor_info(void)
{
...
p = &sensor_state[SENSOR_TYPE_PICK_UP_GESTURE];
p->sensorType = SENSOR_TYPE_PICK_UP_GESTURE;
p->rate = SENSOR_RATE_ONCHANGE;
p->gain = 1;
strlcpy(p->name, "pickup", sizeof(p->name));
strlcpy(p->vendor, "mtk", sizeof(p->vendor));
...
}
static int mtk_nanohub_report_to_manager(struct data_unit_t *data)
{
...
case ID_PICK_UP_GESTURE:
event.timestamp = data->time_stamp;
event.sensor_type = id_to_type(data->sensor_type);
event.action = data->flush_action;
event.word[0] = data->smd_t.state;
break;
...
}
3.HAL层的修改
(1) 首先修改HfManager.cpp和kernel通信
路径: /vendor/mediatek/proprietary/hardware/sensor/2.0/core/HfManager.cpp
int HfLooper::eventConvertAll(sensors_event_t *dst, hf_manager_event *src) {
...
case SENSOR_TYPE_PICK_UP_GESTURE:
dst->type = 33171036;
dst->data[0] = (float)src->word[0] / gain;
ALOGE("SENSOR_TYPE_PICK_UP_GESTURE in hal data=%d\n", src->word[0]);
break;
...
}
(2) 添加sensortype:这个在55之前,不需要添加,应该是沿用了MTK的定义
(3) 加入通道
路径:
/vendor/mediatek/proprietary/hardware/sensor/2.0/hal/SensorContext.cpp
static int findChannel(int sensor_handle) {
switch (sensor_handle) {
...
case SENSOR_TYPE_PICK_UP_GESTURE:
return ORIGIN_CHANNEL;
...
}
}
(4) 修改sensorList
路径:
/vendor/mediatek/proprietary/hardware/sensor/2.0/hal/SensorList.cpp
memset(&sensor, 0, sizeof(struct sensor_t));
sensor.name = "pickup Wakeup";
sensor.vendor = "XXXX";
sensor.version = PICK_UP_VERSION;
sensor.handle = SENSOR_TYPE_PICK_UP_GESTURE;
sensor.type = XXXXXXX;
sensor.maxRange = PICK_UP_RANGE;
sensor.resolution = PICK_UP_RESOLUTION;
sensor.power = PICK_UP_POWER;
sensor.minDelay = PICK_UP_MINDELAY;
sensor.fifoReservedEventCount = PICK_UP_FIFO_RESERVE_COUNT;
sensor.fifoMaxEventCount = PICK_UP_FIFO_MAX_COUNT;
sensor.stringType = "XXX pick up sensor";
sensor.maxDelay = PICK_UP_MAXDELAY;
sensor.flags = SENSOR_FLAG_SPECIAL_REPORTING_MODE|SENSOR_FLAG_WAKE_UP;
mSensorList.push_back(sensor);
MTK 虚拟 sensor bring up (pick up) sensor2.0的更多相关文章
- MTK 虚拟 sensor bring up (pick up) sensor1.0
pick up bring up sensor1.0 1.pick up对比 2.SCP 1.添加驱动文件 2.添加编译环境(打开开关) 注:编译过程中如果显示内存不够 3.修改底层数据上报方式 3. ...
- 联发科 (MTK) sensor bring up
MT6768平台 1.添加驱动文件 2.添加硬件配置支持 3.添加硬件配置 4.添加编译配置 5.分配空间(非必要,当代码量超过当前空间大小时将会报错,根据报错log改大小即可.) 6.兼容配置 7. ...
- MTK 平台sensor arch 介绍-hal
MTK 平台sensor arch 介绍-hal 一:整体框架 二:具体流程简介 AP-HAL: (1)init & control flow 我们以前文的originchannel 的 ac ...
- MTK 平台sensor arch 介绍-scp
架构介绍 路径:vendor/mediatek/proprietary/tinysys/scp 1.[build]编译相关 2.[driver]scp 的driver,I2C,power,eint 3 ...
- 高通(QCOM)sensor bring up
高通7150平台 1.添加驱动文件 2.添加编译 3.配置json文件 4.高通默认配置 5.部分sensor外挂电源 6.遇到的问题 1.添加驱动文件 路径:adsp_proc/ssc/sensor ...
- 在IIS7.5上添加.NET4.0程序的虚拟目录时提示ASP.NET 4.0尚未在 Web 服务器上注册
使用VS2010创建web应用程序时出现如下提示: ASP.NET 4.0尚未在 Web 服务器上注册. 解决方法: 首先IIS应用程序池添加 net framework4.0版本. 接着找到C:\W ...
- Android sensor架构分析
一.其主要框架如下图所示: 二.sensor的JNI层:android_hardware_SensorManager.cpp (frameworks\base\core\jni) 注册JN ...
- Mtk Ft6306 touch 驱动 .
1.1. MTK Touch 驱动的组成Mtk Touch driver 驱动包括:Mtk platform 虚拟平台设备驱动.Module touch IC 驱动.Input subsys ...
- 高通HAL层之Sensor HAL
高通的HAL层其实分为两种,一种是直接从kernel这边报数据上来的,由sensor HAL层来监听,另一种是走ADSP的模式,HAL层是通过qmi的形式进行监听的: 走ADSP架构的可以看下面的博客 ...
随机推荐
- new String比字符串池浪费空间,为什么要用它?
对于下面程序中:ss0 = new String( "hello" );是用new()来新建对象的,存于堆中.每调用一次就会创建一个新的对象.当然从节省空间的角度来讲,肯定不如st ...
- 数据库number(4,3)表示什么
1 你看 number(4,3)是表示 这个数 一共有4位是有效位,后面的3 表示有3个是小数也就是这个数 只能是1.234,这样格式的 最大只能是9.999,2 number(3,4) 表示这个数 ...
- 简单的axios请求返回数据解构赋值
本地 data.json 文件 { "name": "大熊", "age": 18, "fnc": [ 1, 2, 3 ...
- 小程序tab栏可滑动,可点击居中demo
效果图: 代码: <view class="container"> <!-- tab导航栏 --> <!-- scroll-left属性可以控制滚动条 ...
- Thread中,run方法和start方法的区别
1. 通过调用Thread类中的start()方法可以启动一个线程,但是线程并不是立刻运行,而是处于就绪态,一旦获取cpu时间片,则会立即运行run()方法 2. start()方法实现了多线程运行, ...
- js知识梳理5:关于函数的要点梳理(1)
写在前面 注:这个系列是本人对js知识的一些梳理,其中不少内容来自书籍:Javascript高级程序设计第三版和JavaScript权威指南第六版,感谢它们的作者和译者.有发现什么问题的,欢迎留言指出 ...
- python---用顺序表实现双端队列
class Dqueue(object): """双端队列""" def __init__(self): self.__list = [] ...
- JavaSE常用类之Object类
1. hashCode方法 代码: package NeiBuLei; public class hashCode { public static void main(String[] args) { ...
- LinkedList实现
LinkedList源码实现: public class LinkedList<E> { private class Node{ public E e; public Node next; ...
- 计算机编码规则之:Base64编码
目录 简介 Base64和它的编码原理 Base64的变体 Base64的编码细节 总结 简介 我们知道计算机中的文件可以分为两种,一种是人肉眼可读的文本类文件,一种是肉眼不可读的二进制文件.一般来说 ...