收起左侧

fnOS 控制绿联设备的 Led 灯

2
回复
156
查看
[ 复制链接 ]

2

主题

2

回帖

0

牛值

江湖小虾

前言

绿联设备刷了 fnOS 系统以后,设备的 Led 灯默认为跑马灯状态,没办法实现 Led 灯的功能。

有一个大佬弄了一个工具,大家可以通过代码去控制

大佬的 github 开源的代码在这里

https://github.com/miskcoo/ugreen_leds_controller

fnOS中开启SSH功能

在系统的“系统设置”里面找到“SSH”然后打开这个功能

使用工具连接 fnOS

我这里用 mac 为例

在 mac 中使用终端就可以直接连接 fnOS

ssh 用户名@192.168.X.X

直接在终端使用使用以上的代码然后输入密码就可以直接连接

下载 ugren_leds_cli 工具

#切换到 root 
sudo -i
#下载 ugreen_leds_cli 工具
cd /usr/bin
wget https://github.com/miskcoo/ugreen_leds_controller/releases/download/v0.1-debian12/ugreen_leds_cli
chmod +x ugreen_leds_cli

试试看工具能不能用

#检查功能能不能用
./ugreen_leds_cli all -off

控制代码

大家可以根据用代码去控制

Usage: ugreen_leds_cli  [LED-NAME...] [-on] [-off] [-(blink|breath) T_ON T_OFF]
                    [-color R G B] [-brightness BRIGHTNESS] [-status]

       LED_NAME:    separated by white space, possible values are
                    { power, netdev, disk[1-8], all }.
       -on / -off:  turn on / off corresponding LEDs.
       -blink / -breath:  set LED to the blink / breath mode. This
                    mode keeps the LED on for T_ON millseconds and then
                    keeps it off for T_OFF millseconds.
                    T_ON and T_OFF should belong to [0, 65535].
       -color:      set the color of corresponding LEDs.
                    R, G and B should belong to [0, 255].
       -brightness: set the brightness of corresponding LEDs.
                    BRIGHTNESS should belong to [0, 255].
       -status:     display the status of corresponding LEDs.

案例

# 打开所有的 LED 灯
ugreen_leds_cli all -on

# 关闭所有的 LED 灯
ugreen_leds_cli all -off

# 打开开机灯
ugreen_leds_cli power -on

# 设置开机灯颜色为红色
ugreen_leds_cli power -color 255 0 0

# 设置开机灯亮度 最高为 255
ugreen_leds_cli power -brightness 30

# 开机灯 power 网络灯 netdev 硬盘灯 disk1 disk2 disk3 以此类推

下次再分享脚本来控制 LED 灯实现对应的功能。

收藏
送赞
分享

3

主题

1

回帖

0

牛值

江湖小虾

期待大佬的脚本控制功能

1

主题

1

回帖

0

牛值

江湖小虾

Err: fail to open the I2C device.
Please check that (1) you have the root permission;
              and (2) the i2c-dev module is loaded.
提示这个 这个怎么破 大佬
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则