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)的更多相关文章

  1. Openwrt Support MINI-PCIE EC20 (6)

    1      Scope of Document This document describes MINI PCIE usb hardware design, for EC20 4G module 2 ...

  2. OpenWRT中的按键和灯的GPIO控制实现_转

    本文转自:OpenWRT中的按键和灯的GPIO控制实现 基于BarrierBreaker版本,基于AR9331 AP121 Demo单板 来进行描述 1.灯 A.在mach-ap121.c中,定义了灯 ...

  3. OpenWRT中的按键和灯的GPIO控制实现

    基于BarrierBreaker版本,基于AR9331 AP121 Demo单板 来进行描述 1.灯 A.在mach-ap121.c中,定义了灯所对应的GPIO定义: #define AP121_GP ...

  4. JSF 2 button and commandButton example

    In JSF 2.0, both <h:button /> and <h:commandButton /> tags are used to render HTML input ...

  5. Windows phone常用控件之Button

    Button类:表示一个响应 ButtonBase.Click 事件的 Windows 按钮控件. 继承层次结构: 命名空间:    System.Windows.Controls ClickMode ...

  6. 项目中经常用到的reset.css文件

    html,body{width:100%; height: auto;} *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box- ...

  7. 表单提交中的input、button、submit的区别

    1.input[type=submit] 我们直接来看例子: 代码如下: <form> <input name="name"> <input type ...

  8. 【译文】CSS技术:如何正确的塑造button样式!

    , but useful for */ display: inline-block; text-align: center; text-decoration: none; /* create a sm ...

  9. input 和 button元素 作为提交、重置、按钮功用的区别。

    首先,input元素和button元素 都是可以作为普通按钮.提交按钮.重置按钮的. <input type="button" value="button" ...

随机推荐

  1. Linux 安装、启动和卸载SSH

    卸载SSH: 先停掉SSH服务:sudo stop ssh 检查SSH是否停止:ssh localhost 检查SSH是否启动: ps -e|grep ssh 卸载SSH:apt-get --purg ...

  2. How can I list all foreign keys referencing a given table in SQL Server?

    How can I list all foreign keys referencing a given table in SQL Server?  how to check if columns in ...

  3. 断开网络连接的dos命令

    https://zhidao.baidu.com/question/154994771.html 或者采用服务关闭开启模式,不过没有上面的好用net stop "network connec ...

  4. 【TCP/IP详解 卷一:协议】第十八章 TCP连接 的建立与终止 (2)其余内容

    18.5 TCP的半关闭 牢记 TCP 是 全双工 的. 半关闭:TCP提供了连接的一端 在结束了它的发送后 还能接收来自另外一端数据的能力.但是只有很少的应用程序利用它. 为了实现这个特性,编程接口 ...

  5. 【Coursera】Security Introduction -Eighth Week(2)

    Review -Terminology(术语): Confidentiallity & Integrity 泄密 & 欺骗 Confidentiallity: Prevent unau ...

  6. PTA第三次上机

    5-1 #include <iostream> #include <cstdlib> #include <string.h> using namespace std ...

  7. UVa 10766 Organising the Organisation(矩阵树定理)

    https://vjudge.net/problem/UVA-10766 题意: 给出n, m, k.表示n个点,其中m条边不能直接连通,求生成树个数. 思路: 这也算个裸题,把可以连接的边连接起来, ...

  8. python 集合交集

    #Intersection setx = set(["green", "blue"]) sety = set(["blue", " ...

  9. 《F4+2》β冲刺第二天

    β冲刺第二天 1.每个成员今日完成的任务: 马仲山:系统代码和开发总结文档的完善 马婧(12):完善需求文档 马婧(13):完善设计文档 马世芳:对部分功能实现进行测试 张俊逸:针对测试出现的问题完善 ...

  10. hihoCoder 1513 小Hi的烦恼

    hihoCoder 1513 小Hi的烦恼 思路: 用bitset判断交集个数 代码: #include<bits/stdc++.h> using namespace std; #defi ...