wake on wlan无线唤醒_睡眠后重启才能连接WiFi

wake on wlan无线唤醒_睡眠后重启才能连接WiFi(1)添加头文件:       #include “core.h”      在core.h文件中有:       #ifdef CONFIG_HAS_EARLYSUSPEND             #include        #endif (2)在wifi驱动ath6kl结构体中添加early_suspend结构:        #ifdef CO

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

1)添加头文件:

        #include “core.h”

       在core.h文件中有:

        #ifdef CONFIG_HAS_EARLYSUSPEND

              #include <linux/earlysuspend.h>

        #endif

 

2)在wifi驱动ath6kl结构体中添加early_suspend结构:

        #ifdef CONFIG_HAS_EARLYSUSPEND

               struct early_suspend early_suspend;

               bool screen_off;

        #endif

 

3)在wifi驱动的电源管理文件pm.c中填充early_suspend结构体,并将其向android电源管理系统注册

         #ifdef CONFIG_HAS_EARLYSUSPEND

               ar->screen_off = false;

               ar->early_suspend.suspend = ath6kl_early_suspend;

               ar->early_suspend.resume = ath6kl_late_resume;

               ar->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN;

               register_early_suspend(&ar->early_suspend);

        #endif

        所有注册到系统中的early_suspend结构都会按level值按顺序加入到全局链表early_suspend_handlers中。 

       希望执行early suspend的设备,他的设备驱动程序需要向电源管理系统注册,该结构体用于向电源管理系统注册earlysuspend/lateresume,当电源管理系统启动suspend流程时,回调函数suspend会被调用,相反,resume的最后阶段,回调函数resume会被调用,level字段用于调整该结构体在注册链表中的位置,suspend时,level的数值越小,回调函数的被调用的时间越早resume时则反过来。

       Android在earlysuspend.h预先定义了3level等级

       enum {

                 EARLY_SUSPEND_LEVEL_BLANK_SCREEN = 50,

                 EARLY_SUSPEND_LEVEL_STOP_DRAWING = 100,

                 EARLY_SUSPEND_LEVEL_DISABLE_FB = 150,

       };

      具体请见附件kernel/include/linux/earlysuspend.h

 

4)在wifi驱动电源管理文件pm.c取消early_suspend结构体的注册:

         #ifdef CONFIG_HAS_EARLYSUSPEND

                 unregister_early_suspend(&ar->early_suspend);

         #endif

 

5)定义相关suspendresume函数:

       #ifdef CONFIG_HAS_EARLYSUSPEND

static void ath6kl_early_suspend(struct early_suspend *handler)

{

        struct ath6kl *ar = container_of(handler, struct ath6kl, early_suspend);

        if (ar)

                ar->screen_off = true;

}

static void ath6kl_late_resume(struct early_suspend *handler)

{

        struct ath6kl *ar = container_of(handler, struct ath6kl, early_suspend);

        if (ar)

                ar->screen_off = false;

}

#endif


 

附:kernel/include/linux/earlysuspend.h

#ifndef _LINUX_EARLYSUSPEND_H

#define _LINUX_EARLYSUSPEND_H

#ifdef CONFIG_HAS_EARLYSUSPEND

#include <linux/list.h>

#endif

/* The early_suspend structure defines suspend and resume hooks to be called

 * when the user visible sleep state of the system changes, and a level to

 * control the order. They can be used to turn off the screen and input

 * devices that are not used for wakeup.

 * Suspend handlers are called in low to high level order, resume handlers are

 * called in the opposite order. If, when calling register_early_suspend,

 * the suspend handlers have already been called without a matching call to the

 * Suspend handlers are called in low to high level order, resume handlers are

 * called in the opposite order. If, when calling register_early_suspend,

 * the suspend handlers have already been called without a matching call to the

 * resume handlers, the suspend handler will be called directly from

 * register_early_suspend. This direct call can violate the normal level order.

 */

enum {

        EARLY_SUSPEND_LEVEL_BLANK_SCREEN = 50,

        EARLY_SUSPEND_LEVEL_STOP_DRAWING = 100,

        EARLY_SUSPEND_LEVEL_DISABLE_FB = 150,

};

struct early_suspend {

#ifdef CONFIG_HAS_EARLYSUSPEND

        struct list_head link;

        int level;

        void (*suspend)(struct early_suspend *h);

        void (*resume)(struct early_suspend *h);

#endif

};

#ifdef CONFIG_HAS_EARLYSUSPEND

void register_early_suspend(struct early_suspend *handler);

void unregister_early_suspend(struct early_suspend *handler);

#else

#define register_early_suspend(handler) do { } while (0)

#define unregister_early_suspend(handler) do { } while (0)

#endif

#endif

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/192266.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • ITextPDF7

    ITextPDF7ITextPDF前言版本说明itext7-core=7.1.13相关链接:itextpdf官网地址:https://itextpdf.com/enitextpdf官方文档:https://kb.itextpdf.com/home/it7kbitextpdf官方github地址:https://github.com/itext/itext7itextpdfmaven地址:https://mvnrepository.com/artifact/com.itextpdf/itext

    2022年6月29日
    66
  • 转:在线检测网页错误工具

    转:在线检测网页错误工具

    2021年8月25日
    50
  • idea激活码20213月最新在线激活「建议收藏」

    idea激活码20213月最新在线激活,https://javaforall.net/100143.html。详细ieda激活码不妨到全栈程序员必看教程网一起来了解一下吧!

    2022年3月15日
    252
  • java applet介绍,Java Applet教程介绍[通俗易懂]

    java applet介绍,Java Applet教程介绍[通俗易懂]Applet是一种特殊类型的程序,嵌入在网页中以生成动态内容。它在浏览器中运行,并在客户端运行。小程序的优势小程序有很多优点。它们如下:它在客户端工作,因此响应时间更少。担保的它可以由在许多平台下运行的浏览器执行,包括Linux,Windows,MacOs等。小程序的缺点客户端浏览器需要插件才能执行applet。你知道吗小程序的层次结构如上图所示,Applet类扩展了Panel。…

    2022年7月7日
    16
  • 【Android布局】在程序中设置android gravity 和 android layout Gravity属性

    【Android布局】在程序中设置android gravity 和 android layout Gravity属性【Android布局】在程序中设置androidgravity和androidlayoutGravity属性

    2022年7月26日
    1
  • MapReduce编程快速入门

    MapReduce编程快速入门MapReduce编程规范用户编写的程序分成三个部分:Mapper,Reducer,Driver(提交运行mr程序的客户端)Mapper阶段继承Mapper类(1)用户自定义的Mapper要继承自己的父类(2)Mapper的输入数据是KV对的形式(KV的类型可自定义)(3)Mapper中的业务逻辑写在map()方法中(4)Mapper的输出数据是KV对的形式(KV的类型可自定义)(5)map()方法(maptask进程)对每一个<K,V>调用一次Reducer阶段继承Reduce

    2022年6月16日
    31

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号