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. 20145333茹翔《网络对抗技术》Exp6 信息搜集技术

    20145333茹翔<网络对抗技术>Exp6 信息搜集技术 实验内容 本次实验的目标是掌握信息搜集的最基础技能.具体有(1)各种搜索技巧的应用(2)DNS IP注册信息的查询 (3)基本的 ...

  2. noip 2012 提高组 day2 部分题解

    这道题有多种解法,我用的是扩展欧几里得算法求到的答案 #include<iostream> #include<fstream> #include<cstdio> u ...

  3. Duilib Edit编辑框禁止输入中文的方法

    转载:http://www.myexception.cn/vc-mfc/300749.html 编辑框是供用户输入的,但有时候我们要限制用户输入的内容,比如我们不让用户输入中文,只能输入字符和数字,因 ...

  4. C#工程详解

    转:https://www.cnblogs.com/zhaoqingqing/p/5468072.html 前言 写这篇文章的目地是为了让更多的小伙伴对VS生成的工程有一个清晰的认识.在开发过程中,为 ...

  5. Python3基础 ** 幂运算 // 整除运算

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  6. github上不去了

    这几天发现github.com上不去了 可能是由于要杜绝国外的人使用最新的技术??从而屏蔽了吗?

  7. HBase底层存储原理——我靠,和cassandra本质上没有区别啊!都是kv 列存储,只是一个是p2p另一个是集中式而已!

    理解HBase(一个开源的Google的BigTable实际应用)最大的困难是HBase的数据结构概念究竟是什么?首先HBase不同于一般的关系数据库,它是一个适合于非结构化数据存储的数据库.另一个不 ...

  8. mysql 对比两个表的一致性

    -- A和B两个表 数据是否一致select 自定义 from A left join B on A.id = B.id where B.id is null 注释:这样查询的结果是A表中有而B表中没 ...

  9. TCGA系列--LncMAP

    LncMAP:http://www.bio-bigdata.com/LncMAP/index.jsp

  10. Intel微处理器学习笔记(三) 不可见寄存器

    参考资料: 1.  http://blog.chinaunix.net/uid-20797642-id-2495244.html 2.  http://www.techbulo.com/708.htm ...