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" ...
随机推荐
- linux内核分析 第五周
一.实验相关 1.下载老师最新的menu文件,并在其中添加上周所编写的代码,并运行 下载 添加 运行 2.gdb调试跟踪 gdb设置跟踪文件(先进入linux-3.18.6所在的文件) gdb设置断点 ...
- 再谈vim中多窗口的编辑 ctrl+w+H窗口位置最大化和互换等操作
参考:http://blog.csdn.net/shuangde800/article/details/11430659 很好 鼠标在各个窗口间循环移动: ctrl+w+(小写的 hjkl), &qu ...
- JavaScript:Function/Object/prototype/__proto__
console.log(Object.__proto__===Function.prototype); //true console.log(Object.prototype.__proto__); ...
- sql:临时表和表变量
在SQL Server的性能调优中,有一个不可比拟的问题:那就是如何在一段需要长时间的代码或被频繁调用的代码中处理临时数据集,表变量和临时表是两种选择. 临时表: 临时对象都以#或##为前缀,临时表是 ...
- win7下配置IIS
Internet Information Services(IIS,互联网信息服务),是由微软公司提供的基于运行Microsoft Windows的互联网基本服务.最初是Windows NT版本的可选 ...
- Java ArrayDeque源码剖析
ArrayDeque 本文github地址 前言 Java里有一个叫做Stack的类,却没有叫做Queue的类(它是个接口名字).当需要使用栈时,Java已不推荐使用Stack,而是推荐使用更高效的A ...
- HDU 3549 Flow Problem(最大流模板)
http://acm.hdu.edu.cn/showproblem.php?pid=3549 刚接触网络流,感觉有点难啊,只好先拿几道基础的模板题来练练手. 最大流的模板题. #include< ...
- UVa 1220 Hali-Bula的晚会(树的最大独立集)
https://vjudge.net/problem/UVA-1220 题意: 公司里有n个人形成一个树状结构,即除了老板以外每个员工都有唯一的直属上司.要求选尽量多的人,但不能同时选择一个人和他的直 ...
- 【BZOJ】[HNOI2015]菜肴制作
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=4010 要是考场上想不出,但是还是有一个分治的做法的嘛 做法就是反向连边,然后再反向输出字典 ...
- kali linux下几个更新命令的区分
首先更新命令有:apt-get update ,apt-get upgrade ,apt-get dist-upgrade等三个: (1)apt-get update:只更新软件包的索引源,作用:同步 ...