首页
chatGPT
关于
友链
其它
统计
更多
壁纸
留言
Search
1
cgroup--(4)cgroup v1和cgroup v2的详细介绍
6,537 阅读
2
修改Linux Kernel defconfig的标准方法
6,452 阅读
3
Android系统之VINTF(1)manifests&compatibility matrices
6,056 阅读
4
使用git生成patch和应用patch
3,572 阅读
5
c语言的__attribute__
3,184 阅读
默认分类
文章收集
学习总结
算法
环境配置
知识点
入门系列
vim
shell
Git
Make
Android
Linux
Linux命令
内存管理
Linux驱动
Language
C++
C
Rust
工具
软件工具
Bug
COMPANY
登录
Search
标签搜索
Rust
shell
Linux
c
uboot
Vim
vintf
Linux驱动
Android
device_tree
git
DEBUG
arm64
链表
数据结构
IDR
内核
ELF
gcc
ARM
adtxl
累计撰写
380
篇文章
累计收到
16
条评论
首页
栏目
默认分类
文章收集
学习总结
算法
环境配置
知识点
入门系列
vim
shell
Git
Make
Android
Linux
Linux命令
内存管理
Linux驱动
Language
C++
C
Rust
工具
软件工具
Bug
COMPANY
页面
chatGPT
关于
友链
其它
统计
壁纸
留言
搜索到
380
篇与
的结果
2024-01-09
Android sensor hal框架
1. 简介2. 驱动大部分传感器都会使用iio驱动框架,以light sensor为例3. sensor hal3.1 sensor hal 2.0接口sensor hal 2.0的几个接口说明,参考ISensors.halgetSensorsList()getSensorsList() generates (vec<SensorInfo> list);getSensorsList()函数用于获取当前设备的所有可用的sensors,返回值为SensorInfo,该结构体定义如下,struct SensorInfo { /** * handle that identifies this sensors. This handle is used to reference * this sensor throughout the HAL API. */ int32_t sensorHandle; /** * Name of this sensor. * All sensors of the same "type" must have a different "name". */ string name; /** vendor of the hardware part */ string vendor; /** * version of the hardware part + driver. The value of this field * must increase when the driver is updated in a way that changes the * output of this sensor. This is important for fused sensors when the * fusion algorithm is updated. */ int32_t version; /** this sensor's type. */ SensorType type; /** * type of this sensor as a string. * * When defining an OEM specific sensor or sensor manufacturer specific * sensor, use your reserve domain name as a prefix. * e.g. com.google.glass.onheaddetector * * For sensors of known type defined in SensorType (value < * SensorType::DEVICE_PRIVATE_BASE), this can be an empty string. */ string typeAsString; /** maximum range of this sensor's value in SI units */ float maxRange; /** smallest difference between two values reported by this sensor */ float resolution; /** rough estimate of this sensor's power consumption in mA */ float power; /** * this value depends on the reporting mode: * * continuous: minimum sample period allowed in microseconds * on-change : 0 * one-shot :-1 * special : 0, unless otherwise noted */ int32_t minDelay; /** * number of events reserved for this sensor in the batch mode FIFO. * If there is a dedicated FIFO for this sensor, then this is the * size of this FIFO. If the FIFO is shared with other sensors, * this is the size reserved for that sensor and it can be zero. */ uint32_t fifoReservedEventCount; /** * maximum number of events of this sensor that could be batched. * This is especially relevant when the FIFO is shared between * several sensors; this value is then set to the size of that FIFO. */ uint32_t fifoMaxEventCount; /** * permission required to see this sensor, register to it and receive data. * Set to "" if no permission is required. Some sensor types like the * heart rate monitor have a mandatory require_permission. * For sensors that always require a specific permission, like the heart * rate monitor, the android framework might overwrite this string * automatically. */ string requiredPermission; /** * This value is defined only for continuous mode and on-change sensors. * It is the delay between two sensor events corresponding to the lowest * frequency that this sensor supports. When lower frequencies are requested * through batch()/setDelay() the events will be generated at this frequency * instead. * It can be used by the framework or applications to estimate when the * batch FIFO may be full. * * NOTE: periodNs is in nanoseconds where as maxDelay/minDelay are in * microseconds. * * continuous, on-change: maximum sampling period allowed in * microseconds. * * one-shot, special : 0 */ int32_t maxDelay; /** Bitmask of SensorFlagBits */ bitfield<SensorFlagBits> flags; }; setOperationMode()setOperationMode设置模块的模式,有两种选择,SENSOR_HAL_NORMAL_MODE - Normal operation. Default state of the module.SENSOR_HAL_DATA_INJECTION_MODE - Loopback mode.Data is injected for the supported sensors by the sensor service in this mode.setOperationMode(OperationMode mode) generates (Result result);activate()activate()用来activate/de-activate一个sensor,在de-activate一个sensor后,尚未写入事件队列的现有传感器事件必须立即丢弃,以便后续的激活不会得到陈旧的传感器事件(即在后续激活之前生成的事件)。enabled设置为true激活一个传感器,设置为false停用一个传感器。activate(int32_t sensorHandle, bool enabled) generates (Result result);initialize()initialize()函数用于初始化hal的快速消息队列Fast Message Queues (FMQ)和回调函数。快速消息队列(FMQ)用于在框架和HAL之间发送数据。回调由HAL用于通知框架异步事件,例如动态传感器的连接。事件FMQ用于将传感器事件从HAL传输到框架。使用 eventQueueDescriptor 创建事件FMQ。只能将数据写入事件FMQ,不得从事件FMQ读取数据,因为框架是唯一的读取者。收到传感器事件后,HAL将传感器事件写入事件FMQ。一旦HAL完成将传感器事件写入事件FMQ,HAL必须通知框架可以读取和处理传感器事件。有两种方式实现:调用事件FMQ的 EventFlag::wake() 函数,使用 EventQueueFlagBits::READ_AND_PROCESS在事件FMQ的 writeBlocking() 函数中将写通知设置为 EventQueueFlagBits::READ_AND_PROCESS。// Initialize the Sensors HAL's Fast Message Queues (FMQ) and callback. // @param eventQueueDescriptor Fast Message Queue descriptor that is used to // create the Event FMQ which is where sensor events are written. The // descriptor is obtained from the framework's FMQ that is used to read // sensor events. // @param wakeLockDescriptor Fast Message Queue descriptor that is used to // create the Wake Lock FMQ which is where wake_lock events are read // from. The descriptor is obtained from the framework's FMQ that is // used to write wake_lock events. // @param sensorsCallback sensors callback that receives asynchronous data // from the Sensors HAL. // @return result OK on success; BAD_VALUE if descriptor is invalid (such // as null) @entry @callflow(next = {"getSensorsList"}) initialize(fmq_sync<Event> eventQueueDescriptor, fmq_sync<uint32_t> wakeLockDescriptor, ISensorsCallback sensorsCallback) generates (Result result);batch()设置传感器的参数,包括采样频率和最大报告延迟。此函数可在传感器处于激活状态时调用,此时不能导致任何传感器测量数据的丢失:从一个采样率过渡到另一个采样率不能导致事件丢失,也不能从高最大报告延迟过渡到低最大报告延迟导致事件丢失。/* @param sensorHandle 要更改的传感器句柄。 @param samplingPeriodNs 指定传感器样本周期,以纳秒为单位。 @param maxReportLatencyNs 在事件被采样到报告时间之前允许的延迟时间。 @return 成功时返回 OK,如果任何参数无效则返回 BAD_VALUE。 */ batch(int32_t sensorHandle, int64_t samplingPeriodNs, int64_t maxReportLatencyNs) generates ( Result result); flush()刷新将向指定传感器的“批处理模式”FIFO末尾添加一个 FLUSH_COMPLETE 元数据事件,并刷新FIFO。如果FIFO为空或传感器不支持批处理(FIFO大小为零),则返回 SUCCESS,并在事件流中添加一个简单的 FLUSH_COMPLETE 事件。这适用于除单次触发传感器之外的所有传感器。如果传感器是单次触发传感器,刷新必须返回 BAD_VALUE,并且不生成任何刷新完成的元数据。如果在调用 flush() 时传感器处于非活动状态,flush() 必须返回 BAD_VALUE。// Trigger a flush of internal FIFO. flush(int32_t sensorHandle) generates (Result result);injectSensorData()当设备处于 NORMAL 模式时,调用此函数将操作环境数据推送到设备。在此操作中,事件始终为 SensorType::AdditionalInfo 类型。当设备处于 DATA_INJECTION 模式时,此函数还用于注入传感器事件。无论 OperationMode 如何,注入的 SensorType::ADDITIONAL_INFO 类型事件不应路由回传感器事件队列。// Inject a single sensor event or push operation environment parameters to device. injectSensorData(Event event) generates (Result result);registerDirectChannel()使用提供的共享内存信息注册直接通道。在返回时,传感器硬件负责将内存内容重置为初始值(取决于内存格式设置)。// Register direct report channel. registerDirectChannel(SharedMemInfo mem) generates (Result result, int32_t channelHandle); SharedMemInfo结构体定义如下, /** * Shared memory information for a direct channel */ struct SharedMemInfo { SharedMemType type; // shared memory type SharedMemFormat format; uint32_t size; // size of the memory region, in bytes handle memoryHandle; // shared memory handle, it is interpreted // depending on type field, see SharedMemType. }; /** * Direct channel shared memory types. See struct SharedMemInfo. */ @export(name="direct_mem_type_t", value_prefix="SENSOR_DIRECT_MEM_TYPE_") enum SharedMemType : int32_t { // handle contains 1 fd (ashmem handle) and 0 int. ASHMEM = 1, // handle definition matches gralloc HAL. GRALLOC }; /** * Direct channel lock-free queue format, this defines how the shared memory is * interpreted by both sensor hardware and application. * * @see SharedMemInfo. */ @export(name="direct_format_t", value_prefix="SENSOR_DIRECT_FMT_") enum SharedMemFormat : int32_t { SENSORS_EVENT = 1, // shared memory is formated as an array of data // elements. See SensorsEventFormatOffset for details. // Upon return of channel registration call, the // shared memory space must be formated to all 0 by HAL. };unregisterDirectChannel()注销先前使用 registerDirectChannel 注册的直接通道,并移除在该直接通道中配置的所有活动传感器报告。// Unregister direct report channel. unregisterDirectChannel(int32_t channelHandle) generates (Result result);configDirectReport()此函数启动、修改速率或停止在特定直接通道中传感器的直接报告。// Configure direct sensor event report in direct channel. configDirectReport( int32_t sensorHandle, int32_t channelHandle, RateLevel rate ) generates ( Result result, int32_t reportToken); /** * Direct report rate level definition. Except for SENSOR_DIRECT_RATE_STOP, each * rate level covers the range (55%, 220%] * nominal report rate. For example, * if config direct report specify a rate level SENSOR_DIRECT_RATE_FAST, it is * legal for sensor hardware to report event at a rate greater than 110Hz, and * less or equal to 440Hz. Note that rate has to remain steady without variation * before new rate level is configured, i.e. if a sensor is configured to * SENSOR_DIRECT_RATE_FAST and starts to report event at 256Hz, it cannot * change rate to 128Hz after a few seconds of running even if 128Hz is also in * the legal range of SENSOR_DIRECT_RATE_FAST. Thus, it is recommended to * associate report rate with RateLvel statically for single sensor. */ @export(name="direct_rate_level_t", value_prefix="SENSOR_DIRECT_RATE_") enum RateLevel : int32_t { STOP, // stop NORMAL, // nominal 50Hz FAST, // nominal 200Hz VERY_FAST, // nominal 800Hz }; 3.2 具体hal实现可参考Android12源码中两个google的实现:device/generic/goldfish/sensors/device/google/trout/hal/sensors/2.0
2024年01月09日
222 阅读
0 评论
0 点赞
2024-01-02
此内容被密码保护
加密文章,请前往内页查看详情
2024年01月02日
21 阅读
0 评论
0 点赞
2023-12-30
青龙面板的使用
仅记录问题,非从0到1教程1. 使用docker安装青龙由于机器已经装好了docker,所以直接安装即可,docker run -dit \ --name QL \ --hostname QL \ --restart always \ -p 5700:5700 \ -v $PWD/QL/config:/ql/config \ -v $PWD/QL/log:/ql/log \ -v $PWD/QL/db:/ql/db \ -v $PWD/QL/scripts:/ql/scripts \ -v $PWD/QL/jbot:/ql/jbot \ whyour/qinglong:latest如果使用的是阿里云服务器之类的,还需要从服务器console中放行5700端口。安装完成后,使用ip:5700即可访问青龙面板,根据提示完成安装即可。2.配置青龙面板2.1 安装依赖NodeJs这里要特别注意,安装request库,和python中的requests要区别开来,都要安装的。request crypto-js prettytable dotenv jsdom date-fns tough-cookie tslib ws@7.4.3 ts-md5 jsdom -g jieba fs form-data json5 global-agent png-js @types/node require typescript js-base64 axios momentPython3requests canvas ping3 jieba PyExecJS aiohttpLinuxbizCode bizMsg lxm如果pip因为网络问题安装失败,可以设置下docker里的源,pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ pip install --upgrade pip2.2 定时规则0 0 7 * * ? 表示每天 7 点触发第1个是秒,第2个是分,第3个是时,第4个是每月的哪日,第5个是哪月,第6个是每周的周几。数字之间空格隔开。 不限制的用*号替代,定期的时间用“?”替代,间隔运行时间用“*/数字”替代 同一个时间位多个选项用","连接,同一个时间位一个区间用“-”连接。 每天执行,在天位或者周位用"?"都行 一般设置每天执行一次就行0 0 1 * * ? 具体示例如下: 0 0 1 * * ? #每天 1 点触发 0 10 1 ? * * #每天 1:10 触发 */5 * * * * ? #每隔 5 秒执行一次 0 */1 * * * ? #每隔 1 分钟执行一次 0 0 2 1 * ? * #每月 1 日的凌晨 2 点执行一次 0 0 1 * * ? #每天 23 点执行一次 0 0 1 * * ? #每天凌晨 1 点执行一次 0 0 1 1 ? * #每月 1 日凌晨 1 点执行一次 0 26,29,33 * * * ? #在 26 分、29 分、33 分执行一次 0 0 0,13,18,21 * * ? #每天的 0 点、13 点、18 点、21 点都执行一次 0 0 10,14,16 * * ? #每天上午 10 点,下午 2 点,4 点执行一次 0 0/30 9-17 * * ? #每天朝九晚五工作时间内每半小时执行一次 0 * 14 * * ? #每天下午 2 点到 2:59 期间的每 1 分钟触发 0 */5 14 * * ? #每天下午 2 点到 2:55 期间的每 5 分钟触发 0 */5 14,18 * * ? #每天下午 2 点到 2:55 期间和下午 6 点到 6:55 期间的每 5 分钟触发 0 0-5 14 * * ? #每天下午 2 点到 2:05 期间的每 1 分钟触发 2.3 创建订阅本质上安装是从GitHub上获取数据,如果服务器和GitHub的连接网络不好,可能无法获取成功要多试几次,或者选择其他的仓库地址,或者换一个时间点去拉取.20231231可使用https://github.com/shufflewzc/faker2.git,参考下面两篇blog:https://cloud.tencent.com/developer/article/1936297https://blog.csdn.net/u011027547/article/details/130703685根据网上教程,遇到的github网络问题,暂时通过这个方案搞定https://www.dujin.org/19464.html
2023年12月30日
764 阅读
0 评论
0 点赞
2023-12-29
此内容被密码保护
加密文章,请前往内页查看详情
2023年12月29日
14 阅读
0 评论
0 点赞
2023-12-27
此内容被密码保护
加密文章,请前往内页查看详情
2023年12月27日
18 阅读
0 评论
0 点赞
2023-12-21
此内容被密码保护
加密文章,请前往内页查看详情
2023年12月21日
14 阅读
0 评论
0 点赞
2023-12-14
常用的Android keyevent事件
keyevent1.keyevent事件有一张对应的表,可以直接发送对应的数字,也可以方式字符串,如下两个方法都能实现back键。打开cmd输入指令方法一:> adb shell input keyevent KEYCODE_BACK方法二:> adb shell input keyevent 42.常用的keyevent事件解锁(KEYCODE_NOTIFICATION): adb shell input keyevent 83向上(KEYCODE_DPAD_UP):adb shell input keyevent 19向下(KEYCODE_DPAD_DOWN):adb shell input keyevent 20向左(KEYCODE_DPAD_LEFT):adb shell input keyevent 21向右(KEYCODE_DPAD_RIGHT):adb shell input keyevent 22keyevent事件对应数字0 –> “KEYCODE_UNKNOWN” 1 –> “KEYCODE_MENU” 2 –> “KEYCODE_SOFT_RIGHT” 3 –> “KEYCODE_HOME” 4 –> “KEYCODE_BACK” 5 –> “KEYCODE_CALL” 6 –> “KEYCODE_ENDCALL” 7 –> “KEYCODE_0” 8 –> “KEYCODE_1” 9 –> “KEYCODE_2” 10 –> “KEYCODE_3” 11 –> “KEYCODE_4” 12 –> “KEYCODE_5” 13 –> “KEYCODE_6” 14 –> “KEYCODE_7” 15 –> “KEYCODE_8” 16 –> “KEYCODE_9” 17 –> “KEYCODE_STAR” 18 –> “KEYCODE_POUND” 19 –> “KEYCODE_DPAD_UP” 20 –> “KEYCODE_DPAD_DOWN” 21 –> “KEYCODE_DPAD_LEFT” 22 –> “KEYCODE_DPAD_RIGHT” 23 –> “KEYCODE_DPAD_CENTER” 24 –> “KEYCODE_VOLUME_UP” 25 –> “KEYCODE_VOLUME_DOWN” 26 –> “KEYCODE_POWER” 27 –> “KEYCODE_CAMERA” 28 –> “KEYCODE_CLEAR” 29 –> “KEYCODE_A” 30 –> “KEYCODE_B” 31 –> “KEYCODE_C” 32 –> “KEYCODE_D” 33 –> “KEYCODE_E” 34 –> “KEYCODE_F” 35 –> “KEYCODE_G” 36 –> “KEYCODE_H” 37 –> “KEYCODE_I” 38 –> “KEYCODE_J” 39 –> “KEYCODE_K” 40 –> “KEYCODE_L” 41 –> “KEYCODE_M” 42 –> “KEYCODE_N” 43 –> “KEYCODE_O” 44 –> “KEYCODE_P” 45 –> “KEYCODE_Q” 46 –> “KEYCODE_R” 47 –> “KEYCODE_S” 48 –> “KEYCODE_T” 49 –> “KEYCODE_U” 50 –> “KEYCODE_V” 51 –> “KEYCODE_W” 52 –> “KEYCODE_X” 53 –> “KEYCODE_Y” 54 –> “KEYCODE_Z” 55 –> “KEYCODE_COMMA” 56 –> “KEYCODE_PERIOD” 57 –> “KEYCODE_ALT_LEFT” 58 –> “KEYCODE_ALT_RIGHT” 59 –> “KEYCODE_SHIFT_LEFT” 60 –> “KEYCODE_SHIFT_RIGHT” 61 –> “KEYCODE_TAB” 62 –> “KEYCODE_SPACE” 63 –> “KEYCODE_SYM” 64 –> “KEYCODE_EXPLORER” 65 –> “KEYCODE_ENVELOPE” 66 –> “KEYCODE_ENTER” 67 –> “KEYCODE_DEL” 68 –> “KEYCODE_GRAVE” 69 –> “KEYCODE_MINUS” 70 –> “KEYCODE_EQUALS” 71 –> “KEYCODE_LEFT_BRACKET” 72 –> “KEYCODE_RIGHT_BRACKET” 73 –> “KEYCODE_BACKSLASH” 74 –> “KEYCODE_SEMICOLON” 75 –> “KEYCODE_APOSTROPHE” 76 –> “KEYCODE_SLASH” 77 –> “KEYCODE_AT” 78 –> “KEYCODE_NUM” 79 –> “KEYCODE_HEADSETHOOK” 80 –> “KEYCODE_FOCUS” 81 –> “KEYCODE_PLUS” 82 –> “KEYCODE_MENU” 83 –> “KEYCODE_NOTIFICATION” 84 –> “KEYCODE_SEARCH” 85 –> “TAG_LAST_KEYCODE”
2023年12月14日
112 阅读
0 评论
0 点赞
2023-11-24
此内容被密码保护
加密文章,请前往内页查看详情
2023年11月24日
15 阅读
0 评论
0 点赞
2023-11-23
此内容被密码保护
加密文章,请前往内页查看详情
2023年11月23日
17 阅读
0 评论
0 点赞
2023-11-14
uboot2021打开DEBUG
uboot中定义了很多DEBUG宏控制的打印,在调试一些模块时可以打开DEBUG宏,方便查找问题。打开方法在include/common.h头文件中定义这个宏即可,加上下面几行#ifndef DEBUG #define DEBUG #endif然后重新编译即可,编译的时候遇到一个小问题,提示一些符号找不到,看了下也不需要,直接注释掉了。diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 3a07f36c..ee64fbdc 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -562,7 +562,7 @@ static void vidconsole_putc(struct stdio_dev *sdev, const char ch) ret = vidconsole_put_char(dev, ch); if (ret) { #ifdef DEBUG - console_puts_select_stderr(true, "[vc err: putc]"); +//console_puts_select_stderr(true, "[vc err: putc]"); #endif } video_sync(dev->parent, false); @@ -579,7 +579,7 @@ static void vidconsole_puts(struct stdio_dev *sdev, const char *s) char str[30]; snprintf(str, sizeof(str), "[vc err: puts %d]", ret); - console_puts_select_stderr(true, str); +// console_puts_select_stderr(true, str); #endif
2023年11月14日
184 阅读
0 评论
0 点赞
1
...
4
5
6
...
38