在线时间2221 小时
UID3253523
注册时间2016-3-21
NXP金币2869
该用户从未签到
超级版主
 
- 积分
- 24879
- 最后登录
- 2025-7-20
|
发表于 2018-12-24 13:09:51
|
显示全部楼层
LTIB已經太老, 我們已經不支持了. 請用YOCTO LINUX BSP.
Yocto BSP 的例子:
arch/arm/boot/dts/imx6qdl-sabresd.dtsi:
加上 MX6QDL_PAD_EIM_D29__GPIO3_IO29 0x80000000
gpio-keys {
compatible = "gpio-keys";
power {
label = "Wakeup Button";
gpios = <&gpio3 29 1>;
linux,code = <116>;
gpio-key,wakeup;
debounce-interval = <1>;
};
(1) Write a main() task, read /dev/input/event of your SW1 key.
Refer to :http://blog.csdn.net/zgrjkflmkyc/article/details/39499521
(2) In this main task, and open "/sys/power/state" file like this.
int stata_fd = open("/sys/power/state", O_RDWR);
char buf[]={"mem"};
then, when you read a event from SW1 key, write "mem" to "/sys/power/state"
write(stata_fd, buf, sizeof(buf)); //set Linux system enter sleep.
(3) When Linux system enter sleep, press SW1 of i.MX6SDB board , it wake up linux because of SW1(EIM_D29) has been registered a int wake up source.
|
|