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" ...
随机推荐
- 20145327《网络对抗》——注入shellcode并执行和Return-to-libc攻击深入
20145327<网络对抗>--注入shellcode并执行 准备一段Shellcode 老师的shellcode:\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68 ...
- python创建MySQL多实例-1
python创建MySQL多实例-1 前言 什么是多实例 多实例就是允许在同一台机器上创建另外一套不同配置文件的数据库,他们之间是相互独立的,主要有以下特点, 1> 不能同时使用一个端口 2&g ...
- SPA (单页应用程序)
单页Web应用 编辑 单页Web应用(single page web application,SPA),就是只有一张Web页面的应用.单页应用程序 (SPA) 是加载单个HTML 页面并在用户与应用程 ...
- Pytorch版本yolov3源码阅读
目录 Pytorch版本yolov3源码阅读 1. 阅读test.py 1.1 参数解读 1.2 data文件解析 1.3 cfg文件解析 1.4 根据cfg文件创建模块 1.5 YOLOLayer ...
- 使用JavaScript / JQuery导出 html table 数据至 Excel 兼容IE/Chrome/Firefox
function fnExcelReport() { var tab_text="<table border='2px'><tr bgcolor='#87AFC6'> ...
- samtools一些文档
https://github.com/samtools/hts-specs
- BZOJ 2669 【CQOI2012】 局部极小值
题目链接:局部极小值 这是一道\(dp\)好题. 由于需要保证某些位置比周围都要小,那么我们可以从小到大把每个数依次填入,保证每个局部极小值填入之前周围都不能填,就只需要在加入的时候计数了. 由于局部 ...
- ROS编译时(catkin_make)找不到bullet,Could NOT find Bullet (missing: BULLET_DYNAMICS_LIBRARY
sudo apt-get install libbullet-dev
- python 千位分隔符,
>>>) >>>'1,234,567,890'
- 会员通过消费攒积分,升级RENEW以及降级的需求
需求看上去及其简单,如下: 用文字描述就开始不容易了. 先按等级排个序,根据下一个等级,推前一个等级: --C---B----V-----A 在计算一下升级需要的积分:--C表示普通会员-----需要 ...