当前位置: 首页 > news >正文

Android UEvent事件分析之Kernel上报电量

kernel-4.4\drivers\power\power_supply_core.c

当电量信息需要更新的时候,kernel会调用power_supply_changed_work这个工作队列,使用kobject_uevent函数往上发送uevent事件,action是KOBJ_CHANGE;

static void power_supply_changed_work(struct work_struct *work)
{
    unsigned long flags;
    struct power_supply *psy = container_of(work, struct power_supply,
                        changed_work);
 
    dev_dbg(&psy->dev, "%s\n", __func__);
 
    spin_lock_irqsave(&psy->changed_lock, flags);
    /*
     * Check 'changed' here to avoid issues due to race between
     * power_supply_changed() and this routine. In worst case
     * power_supply_changed() can be called again just before we take above
     * lock. During the first call of this routine we will mark 'changed' as
     * false and it will stay false for the next call as well.
     */
    if (likely(psy->changed)) {
        printk("power_supply_changed_work 1111 \n" );
  
http://www.lryc.cn/news/89711.html

相关文章:

  • C++ vector模板和deque的简单应用
  • 声明式事务控制
  • cisp pte模拟题
  • Docker容器 和 Kubernetes容器集群管理系统
  • 港联证券|资金疯狂涌入AI,这一板块涨幅超90%!万亿巨头继续狂飙
  • 短视频矩阵系统源码-开源开发php语言搭建
  • PFEA112-20 3BSE050091R20 张力控制器
  • Java springboot+vue生成报纸排版页面的新闻官网
  • Terra-Luna归零一年后:信任重建、加密未来路在何方?
  • Android 12.0 手动安装Persistent app失败的解决方案
  • Unity3D安装:从命令行安装 Unity
  • C++模板(详解)
  • WuThreat身份安全云-TVD每日漏洞情报-2023-05-25
  • android 12.0去掉recovery模式UI页面的选项
  • C++ vector类成员函数介绍
  • 【C++】二叉搜索树Binary Search Tree
  • Hover.css动画库的使用
  • Baumer工业相机堡盟工业相机如何通过文件保存和导入的方式保存和载入相机的各类参数(C#)
  • 封装设计!抽象BasePage,提升WEB自动化测试用例质量和效率
  • c primer plus学习笔记(一)
  • C语言2:说心里话
  • 任务19 简单个人电话号码查询系统
  • day4--链表内指定区间反转
  • HTTP状态码是什么?常用的状态码有什么?
  • 【软件分析/静态分析】学习笔记01——Introduction
  • Java数组
  • 【数据库原理入门】
  • 练习Vue烘培坊项目
  • API测试| 了解API接口测试| API接口测试指南
  • 使用canvas给图片添加水印