Openwrt Support RESET Button (5)
1 Scope of Document
This document describes how to support reset button under openwrt system
2 Requiremen
2.1 Function Requirement
NA
2.2 Performance Requirement
NA
3 Hardware Overview
NA
4 Functional Description
4.1 Functional Block Diagram
NA
5 Porting
5.1 Kernel porting
Change dts for support reset button
gpio-keys-polled {
compatible = "gpio-keys-polled";
#address-cells = <1>;
#size-cells = <0>;
poll-interval = <20>;
reset {
label = "reset";
gpios = <&gpio0 1 1>;
linux,code = <0x198>;
};
};
corresponding to platfrom resoure struct
struct gpio_keys_button {
/* Configuration parameters */
unsigned int code; /* input event code (KEY_*, SW_*) *///上报事件的code
int gpio;//所用的gpio引脚
int active_low;//是否低电平有效
const char *desc; //该按键的描述符
unsigned int type; /* input event type (EV_KEY, EV_SW, EV_ABS) */
int wakeup; /* configure the button as a wake-up source */
int debounce_interval; /* debounce ticks interval in msecs */
bool can_disable;
int value; /* axis value for EV_ABS */
};
5.2 System configure
Reference: https://openwrt.org/docs/techref/sysupgrade
Openwrt official innet use /bin/sysupgreade to do system upgrade
We can extrace the simplest implementation method:
#!/bin/sh
add_conffiles() {
rm $1 2>/dev/null
local file="$1"
( find $(sed -ne '/^[[:space:]]*$/d; /^#/d; p' \
/lib/upgrade/keep.d/* 2>/dev/null) \
-type f 2>/dev/null;
opkg list-changed-conffiles) | sort -u > "$file"
return 0
}
do_save_conffiles() {
local conf_tar="$1"
local conf_files="$2"
tar zcf "$conf_tar" -T "$conf_files" 2>/dev/null
# rm -f "$2"
}
do_restore_conffiles() {
[ -e "$1" ] && tar -C /tmp/tmptest -xzf "$1"
}
if [ "$1" == "backup" ]
then
add_conffiles /mnt/backfile
do_save_conffiles /mnt/backfile.tar.gz /mnt/backfile
else
mkdir /tmp/tmptest > 2>/dev/null
do_restore_conffiles /mnt/backfile.tar.gz
# need add do restart relate system service
fi
Openwrt Support RESET Button (5)的更多相关文章
- Openwrt Support MINI-PCIE EC20 (6)
1 Scope of Document This document describes MINI PCIE usb hardware design, for EC20 4G module 2 ...
- OpenWRT中的按键和灯的GPIO控制实现_转
本文转自:OpenWRT中的按键和灯的GPIO控制实现 基于BarrierBreaker版本,基于AR9331 AP121 Demo单板 来进行描述 1.灯 A.在mach-ap121.c中,定义了灯 ...
- OpenWRT中的按键和灯的GPIO控制实现
基于BarrierBreaker版本,基于AR9331 AP121 Demo单板 来进行描述 1.灯 A.在mach-ap121.c中,定义了灯所对应的GPIO定义: #define AP121_GP ...
- JSF 2 button and commandButton example
In JSF 2.0, both <h:button /> and <h:commandButton /> tags are used to render HTML input ...
- Windows phone常用控件之Button
Button类:表示一个响应 ButtonBase.Click 事件的 Windows 按钮控件. 继承层次结构: 命名空间: System.Windows.Controls ClickMode ...
- 项目中经常用到的reset.css文件
html,body{width:100%; height: auto;} *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box- ...
- 表单提交中的input、button、submit的区别
1.input[type=submit] 我们直接来看例子: 代码如下: <form> <input name="name"> <input type ...
- 【译文】CSS技术:如何正确的塑造button样式!
, but useful for */ display: inline-block; text-align: center; text-decoration: none; /* create a sm ...
- input 和 button元素 作为提交、重置、按钮功用的区别。
首先,input元素和button元素 都是可以作为普通按钮.提交按钮.重置按钮的. <input type="button" value="button" ...
随机推荐
- IOS项目中的细节处理,如更改状态栏等等
一,状态栏更改为白色 1 在info.plist中添加一个字段:view controller -base status bar 为NO 2 在需要改变状态栏颜色的ViewController中在Vi ...
- 在函数后面加上const
1.现象 在c++类中,有些成员函数在声明时,后面加了const,如 2.作用 ①.提高程序可读性,可以一眼看出此函数不能修改类成员变量: ②.提高程序可靠性,此函数试图修改成员变量时,编译器会通不过
- vim的加密和解密?
vim中出现的错误提示含义: 参考: http://blog.csdn.net/u014599371/article/details/43955169 E488: trailing character ...
- Wireshark分析RabbitMQ
消费者Code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using ...
- JavaScript:正则表达式 分组2
继续上一篇的写,这篇复杂点. 分组+范围 var reg=/([abcd]bc)/g; var str="abcd bbcd cbcd dbcd"; console.log(str ...
- TeeChart入门
此链接可以作为参考http://tech.sina.com.cn/s/2008-07-07/1612722495.shtml 需要添加引用 using Steema.TeeChart;//tchart ...
- 【附5】springboot之配置文件
本文转载自http://www.jianshu.com/p/80621291373b,作者:龙白一梦 我的boss 代码从开发到测试要经过各种环境,开发环境,测试环境,demo环境,线上环境,各种环境 ...
- jquery 浏览器打印
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...
- IDEA快捷键复习使用
https://www.jetbrains.com/help/idea/meet-intellij-idea.html 快捷键可以极快地进行代码编辑整理,在IDEA的快捷键中,除了有几个好像特别难按之 ...
- HTML5 Plus 拍照或者相册选择图片上传
HBuilder+HTML5 Plus+MUI实现拍照或者相册选择图片上传,利用HTML5 Plus的Camera.Gallery.IO.Storage和Uploader来实现手机APP拍照或者从相册 ...