WyBox使用shell脚本检测io口是否正常
1、 修改mt7620a.dts文件,把gpio管脚复用全都定义为通用gpio
/dts-v1/; /include/ "mt7620a.dtsi" / {
compatible = "ralink,mt7620a-eval-board", "ralink,mt7620a-soc";
model = "Ralink MT7620a + MT7610e evaluation board"; palmbus@ {
gpio1: gpio@ {
status = "okay";
};
gpio2: gpio@ {
status = "okay";
};
gpio3: gpio@ {
status = "okay";
}; spi@b00 {
status = "okay"; m25p80@ {
#address-cells = <>;
#size-cells = <>;
compatible = "en25q64";
reg = < >;
linux,modalias = "m25p80", "en25q64";
spi-max-frequency = <>; partition@ {
label = "u-boot";
reg = <0x0 0x30000>;
read-only;
}; partition@ {
label = "u-boot-env";
reg = <0x30000 0x10000>;
read-only;
}; factory: partition@ {
label = "factory";
reg = <0x40000 0x10000>;
read-only;
}; partition@ {
label = "firmware";
reg = <0x50000 0x1fb0000>;
};
};
};
}; pinctrl {
state_default: pinctrl0 {
gpio {
ralink,group = "i2c", "uartf", "wdt", "pa", "mdio",
"rgmii1", "pcie","spi refclk","ephy", "nd_sd", "rgmii2","wled";
ralink,function = "gpio";
};
};
}; ethernet@ {
mtd-mac-address = <&factory 0x4>;
ralink,port-map = "llllw";
}; gpio-keys-polled {
compatible = "gpio-keys";
#address-cells = <>;
#size-cells = <>;
poll-interval = <>;
s2 {
label = "S2";
gpios = <&gpio0 >;
linux,code = <0x100>;
};
s3 {
label = "S3";
gpios = <&gpio0 >;
linux,code = <0x101>;
};
};
};
2、 将如下放shell脚本放在/root文件夹下,命名为test,依次执行如下,就可以将gpio0 ~ gpio72都设为输出,输出为低电平。
#!/bin/sh cd /sys/class/gpio for i in `seq `
do
echo $i >/sys/class/gpio/export
echo out >./gpio$i/direction
#echo out >/sys/devices/.palmbus/.gpio/gpio/gpio$i/direction
echo >./gpio$i/value
done
root@OpenWrt:~#
root@OpenWrt:~# chmod test
root@OpenWrt:~# ./test
3、可以得到如下管脚可以正常使用(打钩):
问题:
1、 其他的可以创建gpio的io不知道为什么,手动敲入命令行没反应,但直接执行脚本命令就有效果。
参考:
http://blog.sina.com.cn/s/blog_9d074aae01012ytf.html
WyBox使用shell脚本检测io口是否正常的更多相关文章
- 多线程shell脚本检测主机存活
局域网中分了很多网段,而IP地址使用情况也未知,前期也没有规划和记录,当新的主机需要使用固定IP的时候,能否第一时间知道哪个IP空闲就显得很重要了,如果一个一个去ping的话太浪费时间. 这里分享一个 ...
- linux shell脚本检测硬盘磁盘空间 邮件报警
使用 http://www.weiruoyu.cn/?p=368 shell脚本监控硬盘空间剩余空间 邮件报警 1.先观察一下磁盘,和如何使用脚本 [root@localhost ~]# df -h ...
- shell脚本检测网络是否畅通
shell初始化安装脚本执行时,需从网络上安装一些rpm包,所有需要先检测网络的畅通性, 代码 #检测网络链接&&ftp上传数据 function networkAndFtp() { ...
- shell脚本检测监控mysql的CPU占用率
网站访问量大的时候mysql的压力就比较大,当mysql的CPU利用率超过300%的时候就不能提供服务了,近乎卡死状态,这时候最好的方法 就是重启mysql服务.由于这种事具有不可预见性,我们不知道什 ...
- Shell脚本检测Tomcat是否正在运行
#!/bin/sh # configurations # computer 设备名称 # target 监控目标 # watcher 跟踪者(邮箱) computer="ehetong&qu ...
- Shell脚本检测程序,如果挂了就重启程序
脚本如下: #!/bin/sh #要检查的进程名 PROGRESS_NAME="heihu_server" #----------------------------------- ...
- Shell脚本检测文件夹是否已被挂载的方法
方法1: if grep -qs '/mnt/foo' /proc/mounts; then echo "It's mounted." else echo "It's n ...
- shell脚本检测局域网内存活主机
<1> d211 admin # for i in {3..254} ; do ping -c 1 192.168.1.$i &>/dev/null && e ...
- shell 脚本检测端口状态
方法一: # cat check_port.sh #!/bin/bash cat ip.txt|while read line do /usr/bin/nc -w 1 -z $line > /d ...
随机推荐
- freeswitch编译mod_av模块
需要先编译libav库 编译libav下载:git clone https://freeswitch.org/stash/scm/sd/libav.git cd libav ./configure - ...
- G++ C++之区别
1.遇到精度用C++ 2.G++内存超限,C++过了 其他都用G++
- web前端优化
在谈到Web优化之前,我们回到一个更原始的问题,Web前端的本质是什么.我的理解是: 将信息快速并友好的展示给用户并能够与用户进行交互.快速的意思就是在尽可能短的时间内完成页面的加载,试想一下当你在淘 ...
- 后台返回json字符串 页面js报错 Uncaught SyntaxError: Unexpected identifier
后台json字符串是 [{"name": "报销申请", "id": "start"}, {"name&quo ...
- c++ 继承(二)
不能自动继承的成员函数 1.构造函数 2.析构函数 3.=运算符 继承与构造函数 1.基类的构造函数不被继承,派生类中需要声明自己的构造函数 2.声明构造函数时,只需要对本类中新增成员进行初始化,对继 ...
- pytorch基础教程2
1. 四部曲 1)forward; 2) 计算误差 :3)backward; 4) 更新 eg: 1)outputs = net(inputs) 2)loss = criterion(outputs, ...
- ERROR: gnu-config-native-20150728+gitAUTOINC+b576fa87c1-r0 do_unpack: Function failed: Fetcher failure: Fetch command failed with exit code 128, output: fatal: the '--set-upstream' option is no longer
/********************************************************************** * ERROR: gnu-config-native-2 ...
- Groovy实现代码热载的机制和原理
前言: 真的很久没在博客园上更新博客了, 现在趁这段空闲的时间, 对之前接触的一些工程知识做下总结. 先来讲下借用Groovy如何来实现代码的热载, 以及其中涉及到的原理和需要注意的点. 总的来说, ...
- IK 中文分词器
链接:https://github.com/wks/ik-analyzerIKAnalyzer是一个开源的,基于java语言开发的轻量级的中文分词工具包.从2006年12月推出1.0版开始,IKAna ...
- NOI-1.8-17-最好的草-矩阵找最大连接井号-【递归】
17:最好的草 查看 提交 统计 提问 总时间限制: 10000ms 单个测试点时间限制: 1000ms 内存限制: 65536kB 描述 奶牛Bessie计划好好享受柔软的春季新草.新草分布在 ...