找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 18539|回复: 38

强迫症进来,K2潘多拉固件 开机过程红灯,开机后黄灯,联网后蓝灯,断网后黄灯

  [复制链接]
发表于 2016-10-1 14:08 | 显示全部楼层 |阅读模式
首先感谢 @east52 @xnvw @a86913179 ,综合各位的帖子,实现K2潘多拉固件 开机过程红灯,开机后黄灯,联网后蓝灯,断网后黄灯
本来是想解决K2多拨问题的,慢慢探索,结果多拨的问题还在,灯的问题倒是解决了。

如果“系统”-“led配置”中有关于wifi的设置,最好是删掉,以免各种颜色灯叠加在一起,乱...

潘多拉固件有一个命令可以用“gpioctl”,也是控制GPIO接口的命令。
在坛友的帖子上发现,K2指示灯“红、蓝、黄”的GPIO控制接口分别是“8、10、11”
gpioctl命令的使用方法:
gpioctl dirin|dirout|get|set|clear gpio
  dirin 定义接口为接收端 (这个用不着,一般为连接按键的接口用)
  dirout 定义接口为输出端 (这里就是使接口输出高电平和低电平来控制LED灯)
  get  获取接口状态
  set  使接口为高电平
  clear 使接口为低电平
  gpio  就是要设置的接口 (我们要设置8、10和11接口)

首先我们要先定义8、10、11接口为输出端,不然是无法控制的,切记
输入三条命令(每次开机后只需执行一次)
gpioctl dirout 8
gpioctl dirout 10
gpioctl dirout 11
这里说明下,定义后默认是低电平,8接口红灯为高电平点亮,10和11接口蓝灯和黄灯为低电平点亮,
以上输入三条命令后,红灯灭,蓝灯亮,黄灯亮,蓝灯黄灯叠加后为淡紫色
要纯黄色再把蓝灯灭了,输入命令拉高10接口电平,
gpioctl set 10
到此只要把上面四条命令加入到“系统”-“启动项”-“本地启动脚本”里面就可以是黄灯了。
本地启动脚本 如下:
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
gpioctl dirout 8
gpioctl dirout 10
gpioctl dirout 11
gpioctl set 10
exit 0



联网后蓝灯实现方法
在/etc/ppp/目录下新建目录 ip-up.d
在/etc/ppp/ip-up.d/目录下新建脚本文件 ip-up.sh
均赋予755权限,大概过程是这样的
cd /etc/ppp/
mkdir ip-up.d
chmod 755 'ip-up.d'
cd 'ip-up.d'
touch ip-up.sh
chmod 755 ip-up.sh
vi ip-up.sh
脚本内容
#!/bin/sh
sleep 8
#关红灯,开蓝灯,关黄灯
gpioctl clear 8
gpioctl clear 10
gpioctl set 11



断网,无拨号成功ip时,黄灯实现方法
在/etc/ppp/目录下新建目录 ip-down.d
在/etc/ppp/ip-down.d/目录下新建脚本文件 ip-down.sh
赋予755权限
/etc/ppp/ip-down.d/ip-down:
脚本内容
#!/bin/sh
sleep 8
#当前虚拟端口拨号成功取得ip的数目(排除掉其他物理端口发起的拨号):
upnum=$(ip a|grep peer|grep -v grep|grep 'pppoe-vwan'|wc -l)
if [ $upnum -eq 0 ]
then
#关蓝灯,开黄灯,关红灯
gpioctl set 10
gpioctl clear 11
gpioctl clear 8
fi

评分

参与人数 2恩山币 +2 收起 理由
a13678 + 1 亲,你太牛逼了,走,我请你吃鳇鱼头去~~~
twisted99 + 1 亲,你太牛逼了,走,我请你吃鳇鱼头去~~~

查看全部评分

我的恩山、我的无线 The best wifi forum is right here.
发表于 2016-10-1 14:13 | 显示全部楼层
我希望的是不要灯亮。

点评

灯不亮 本地启动脚本 如下: # Put your custom commands here that should be executed once # the system init finished. By default this file does nothing. gpioctl dirout 8 gpioctl dirout 10 gpioctl  详情 回复 发表于 2016-10-1 14:15
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2016-10-1 14:15 | 显示全部楼层
hjj123hjj 发表于 2016-10-1 14:13
我希望的是不要灯亮。

灯不亮
本地启动脚本 如下:
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
gpioctl dirout 8
gpioctl dirout 10
gpioctl dirout 11
gpioctl set 10
gpioctl set 11
exit 0
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-10-1 17:14 | 显示全部楼层
请问楼主在哪写
cd /etc/ppp/
mkdir ip-up.d
chmod 755 'ip-up.d'
cd 'ip-up.d'
touch ip-up.sh
chmod 755 ip-up.sh
vi ip-up.sh

命令啊

点评

用SecureCRT等工具telnet 或者ssh到 路由器上执行  详情 回复 发表于 2016-10-1 21:16
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-10-1 17:52 | 显示全部楼层
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2016-10-1 21:16 | 显示全部楼层
robinzorro 发表于 2016-10-1 17:14
请问楼主在哪写
cd /etc/ppp/
mkdir ip-up.d

用SecureCRT等工具telnet 或者ssh到 路由器上执行
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-10-3 22:29 | 显示全部楼层
感觉是好东西 虽然我看不懂
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-10-3 23:32 来自手机 | 显示全部楼层
最新的9月22日的pandorabox能不能用这个
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-10-4 11:13 | 显示全部楼层
楼主处女座的吧
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-10-5 06:58 | 显示全部楼层
太纠结了。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-10-5 15:51 来自手机 | 显示全部楼层
华硕版本可以用同样的方式修改吗?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-10-5 17:41 | 显示全部楼层
好复杂感觉
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-10-5 18:41 | 显示全部楼层
楼主好腻害
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-10-13 22:22 | 显示全部楼层
请问:  ip-up.sh和ip-down.sh的执行情况是什么样的?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-10-13 22:27 | 显示全部楼层

最新的9月22日的pandorabox能不能用这个

点评

我是911版的,922应该可以用  详情 回复 发表于 2016-10-18 15:21
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-20 04:20

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表