简单使用:
(1)定义一个结构体
struct early_suspend Test_early_suspend;
(2)注册:
Test_early_suspend .level = 0x02;//EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1; //等级,等级大小和suspend顺序一致,和resume顺序相反
//即此次休眠执行在EARLY_SUSPEND_LEVEL_BLANK_SCREEN 之后执行。
Test_early_suspend .suspend = test_suspend;
Test_early_suspend .resume = tset_resume;
register_early_suspend(&Test_early_suspend );
(3)休眠唤醒函数的实现
static void test_suspend (struct early_suspend *handler)
{
print_debug("run to %s\n", __func__);
}
static void tset_resume (struct early_suspend *handler)
{
print_debug("run to %s\n", __func__);
}
(4)模块删除时取消:
unregister_early_suspend(&Test_early_suspend );
阅读(2435) | 评论(0) | 转发(0) |